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 Ewald <johannes.ewald@peerigon.com>2014-07-08 03:30:48 +0400
committerJohannes Ewald <johannes.ewald@peerigon.com>2014-07-08 03:30:48 +0400
commit3f7b23aec53d97bed6489f3be9ad3954bc629b7d (patch)
treea5e3d68c8a595c03a14c406130f37bd6d892bb36 /test/__set__.test.js
parent71733c8dad414c08efd57821b896bfc1d6868e22 (diff)
Refactor tests
Diffstat (limited to 'test/__set__.test.js')
-rw-r--r--test/__set__.test.js9
1 files changed, 5 insertions, 4 deletions
diff --git a/test/__set__.test.js b/test/__set__.test.js
index c883c27..ef69a07 100644
--- a/test/__set__.test.js
+++ b/test/__set__.test.js
@@ -2,7 +2,6 @@ var expect = require("expect.js"),
__set__ = require("../lib/__set__.js"),
vm = require("vm"),
- expectReferenceError = expectError(ReferenceError),
expectTypeError = expectError(TypeError);
function expectError(ErrConstructor) {
@@ -12,7 +11,8 @@ function expectError(ErrConstructor) {
}
describe("__set__", function () {
- var moduleFake;
+ var moduleFake,
+ undo;
beforeEach(function () {
moduleFake = {
@@ -24,6 +24,7 @@ describe("__set__", function () {
};
vm.runInNewContext(
+ //__set__ requires __set__ to be present on module.exports
"__set__ = module.exports.__set__ = " + __set__.toString() + "; " +
"getValue = function () { return myValue; }; " +
"getReference = function () { return myReference; }; ",
@@ -74,7 +75,7 @@ describe("__set__", function () {
});
it("should return a function that when invoked reverts to the values before set was called", function () {
undo = moduleFake.__set__("myValue", 4);
- expect(typeof undo).to.be("function");
+ expect(undo).to.be.a("function");
expect(moduleFake.getValue()).to.be(4);
undo();
expect(moduleFake.getValue()).to.be(0);
@@ -85,7 +86,7 @@ describe("__set__", function () {
expect(moduleFake.getValue()).to.be(0);
expect(moduleFake.getReference()).to.eql({});
- var undo = moduleFake.__set__({
+ undo = moduleFake.__set__({
myValue: 2,
myReference: newObj
});