Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/twbs/rewire.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohannes <mail@johannesewald.de>2012-06-04 03:29:39 +0400
committerJohannes <mail@johannesewald.de>2012-06-04 03:29:39 +0400
commitf36825ab2607e9444f9a29f5ed666817583d0aa3 (patch)
tree5da79c9a9ede869fbf2f9d5bd28687dabe899cee /test/rewire.test.js
parentb4b2794f5a5e5977e048ff777ac53263144126e6 (diff)
added documentation
Diffstat (limited to 'test/rewire.test.js')
-rw-r--r--test/rewire.test.js11
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