Comparing version 0.3.0 to 0.3.1
@@ -26,5 +26,6 @@ // keep track of mocks | ||
method.restore = function restoreMocks() { | ||
mocks.forEach(function(m) { | ||
for (var i = mocks.length - 1; i >= 0; i--) { | ||
var m = mocks[i]; | ||
m.obj[m.key] = m.original; | ||
}); | ||
} | ||
mocks = []; | ||
@@ -31,0 +32,0 @@ |
@@ -5,3 +5,3 @@ { | ||
"keywords": ["test", "mock", "dependency"], | ||
"version": "0.3.0", | ||
"version": "0.3.1", | ||
"repository": { | ||
@@ -8,0 +8,0 @@ "type": "git", |
# muk [![Build Status](https://secure.travis-ci.org/fent/node-muk.png)](http://travis-ci.org/fent/node-muk) | ||
![muk](http://cdn.bulbagarden.net/upload/7/7c/089Muk.png) | ||
![muk](http://www.pokemonelite2000.com/sprites/bwb/89.png) | ||
@@ -5,0 +5,0 @@ |
@@ -45,2 +45,10 @@ var muk = require('..'); | ||
assert.equal(fs.mkdir, mkdir, 'original method is restored'); | ||
var readFileMock = function(path, callback) { | ||
process.nextTick(callback.bind(null, null, 'hello!')); | ||
}; | ||
muk(fs, 'readFile', readFileMock); | ||
muk(fs, 'readFile', readFileMock); | ||
muk.restore(); | ||
assert.equal(fs.readFile, readFile, 'mock twices, original method should be restored too'); | ||
}); | ||
@@ -67,2 +75,12 @@ }); | ||
}); | ||
it('Should have original properties after muk.restore()', function () { | ||
muk(config, 'enableCache', false); | ||
muk(config, 'enableCache', false); | ||
muk(config, 'delay', 0); | ||
muk.restore(); | ||
assert.equal(config.enableCache, true, 'enableCache is true'); | ||
assert.equal(config.delay, 10, 'delay is 10'); | ||
}); | ||
}); |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
10731
238