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-12 01:29:10 +0400
committerJohannes <mail@johannesewald.de>2012-06-12 01:29:10 +0400
commit0af1dcb6b2ccbc7ec0ae757549688e666cf569a7 (patch)
tree4b3854b937ff1f05bf8677c8fc1547fa733e6feb /test/getImportGlobalsSrc.test.js
parent75f6a7765a09344dab54a4a2ca99ac12f547a75d (diff)
- changed APIv0.2.0
- introduced __set__ and __get__ to rewired modules
Diffstat (limited to 'test/getImportGlobalsSrc.test.js')
-rw-r--r--test/getImportGlobalsSrc.test.js24
1 files changed, 24 insertions, 0 deletions
diff --git a/test/getImportGlobalsSrc.test.js b/test/getImportGlobalsSrc.test.js
new file mode 100644
index 0000000..b6f8576
--- /dev/null
+++ b/test/getImportGlobalsSrc.test.js
@@ -0,0 +1,24 @@
+"use strict"; // run code in ES5 strict mode
+
+var expect = require("expect.js"),
+ vm = require("vm"),
+ getImportGlobalsSrc = require("../lib/getImportGlobalsSrc.js");
+
+describe("getImportGlobalsSrc", function () {
+ it("should declare all globals with a var", function () {
+ var context = {
+ global: global
+ },
+ src,
+ actualGlobals,
+ expectedGlobals = Object.keys(global);
+
+ src = getImportGlobalsSrc();
+ vm.runInNewContext(src, context);
+ actualGlobals = Object.keys(context);
+ actualGlobals.sort();
+ expectedGlobals.sort();
+ expect(actualGlobals).to.eql(expectedGlobals);
+ expect(actualGlobals.length).to.be.above(1);
+ });
+}); \ No newline at end of file