All files / universal.klown/gpii/node_modules/testing/src NockUtils.js

100% Statements 6/6
100% Branches 0/0
100% Functions 1/1
100% Lines 6/6

Press n or j to go to the next uncovered block, b, p or k for the previous block.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37                                    1x 1x 1x   1x                     1x 8x    
/*!
GPII add-on grade with Nock set up
 
Copyright 2017 OCAD University
 
Licensed under the New BSD license. You may not use this file except in
compliance with this License.
 
You may obtain a copy of the License at
https://github.com/gpii/universal/LICENSE.txt
*/
 
// Nock (https://github.com/node-nock/nock) is a mocking library on node.js that can
// mock http server responses. This file creates a add-on component that integrates
// the setup and clean up of Nock into the component lifecycles.
 
"use strict";
 
var fluid = require("infusion"),
    gpii = fluid.registerNamespace("gpii"),
    nock = require("nock");
 
fluid.defaults("gpii.test.testWithNock", {
    gradeNames: ["fluid.component"],
    listeners: {
        "onCreate.setUpNock": "{that}.setUpNock",
        "onDestroy.cleanNock": "gpii.test.testWithNock.cleanNock"
    },
    invokers: {
        setUpNock: "fluid.notImplemented"   // must be supplied by integrators
    }
});
 
gpii.test.testWithNock.cleanNock = function () {
    nock.cleanAll();
};