blob: b6f8576df323af18783d1054eaa4fd0e108df412 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
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);
});
});
|