diff options
author | Johannes <mail@johannesewald.de> | 2012-06-04 03:29:39 +0400 |
---|---|---|
committer | Johannes <mail@johannesewald.de> | 2012-06-04 03:29:39 +0400 |
commit | f36825ab2607e9444f9a29f5ed666817583d0aa3 (patch) | |
tree | 5da79c9a9ede869fbf2f9d5bd28687dabe899cee /test/rewire.test.js | |
parent | b4b2794f5a5e5977e048ff777ac53263144126e6 (diff) |
added documentation
Diffstat (limited to 'test/rewire.test.js')
-rw-r--r-- | test/rewire.test.js | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/test/rewire.test.js b/test/rewire.test.js index 41dff60..2df19e0 100644 --- a/test/rewire.test.js +++ b/test/rewire.test.js @@ -109,4 +109,15 @@ describe("#rewire", function () { rewired.requireIndex();
expect(rewired.index.b).not.to.be(rewired);
});
+ it("should not influence the original node require if nothing has been required within the rewired module", function () {
+ var moduleCMock = {},
+ moduleB,
+ mocks = {
+ "../C/moduleC.js": moduleCMock
+ };
+
+ rewire("./testModules/C/moduleC.js", mocks); // nothing happens here because moduleC doesn't require anything
+ moduleB = require("./testModules/A/moduleA.js"); // if restoring the original node require didn't worked, the mock would be applied now
+ expect(moduleB.c).not.to.be(moduleCMock);
+ });
});
\ No newline at end of file |