diff options
author | Jeroen Valcke <valcke_jeroen@hotmail.com> | 2017-10-19 11:24:01 +0300 |
---|---|---|
committer | Jeroen Valcke <valcke_jeroen@hotmail.com> | 2017-10-19 11:24:01 +0300 |
commit | 1ef610465275414b830879719417da1ed91f3203 (patch) | |
tree | 4b747f837a81c58d220f0e22f6e3cf391b097727 /testLib/sharedTestCases.js | |
parent | fff5037950f78b4164c299560f761bd5e3dc9e06 (diff) |
Add optional babel const to let parser.
Diffstat (limited to 'testLib/sharedTestCases.js')
-rw-r--r-- | testLib/sharedTestCases.js | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/testLib/sharedTestCases.js b/testLib/sharedTestCases.js index 54e4218..310071a 100644 --- a/testLib/sharedTestCases.js +++ b/testLib/sharedTestCases.js @@ -372,4 +372,32 @@ describe("rewire " + (typeof testEnv === "undefined"? "(node)": "(" + testEnv + revert(); }); + it("Should be possible to mock a const variable using __with__ syntax", function() { + var ES2015Module = rewire("./ES2015Module", { + convertConst: true + }); + + ES2015Module.__with__({ + language: "en" + })(function() { + expect(ES2015Module.getLang()).to.equal("en"); + expect(ES2015Module.getOtherModuleName()).to.equal("somOtherModule"); + }) + }) + + it("Should be possible to mock a const required variable using __with__ syntax", function() { + var ES2015Module = rewire("./ES2015Module", { + convertConst: true + }); + + ES2015Module.__with__({ + someOtherModule: { + name: "mocked" + } + })(function() { + expect(ES2015Module.getLang()).to.equal("nl"); + expect(ES2015Module.getOtherModuleName()).to.equal("mocked"); + }) + }) + }); |