/*!
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();
};
|