Comparing version 0.3.1 to 0.3.2
@@ -16,3 +16,4 @@ // keep track of mocks | ||
key: key, | ||
original: obj[key] | ||
original: obj[key], | ||
exist: key in obj | ||
}); | ||
@@ -29,3 +30,7 @@ obj[key] = method === undefined ? function() {} : method; | ||
var m = mocks[i]; | ||
m.obj[m.key] = m.original; | ||
if (!m.exist) { | ||
delete m.obj[m.key]; | ||
} else { | ||
m.obj[m.key] = m.original; | ||
} | ||
} | ||
@@ -32,0 +37,0 @@ mocks = []; |
{ | ||
"name": "muk", | ||
"description": "Mock object methods and dependencies.", | ||
"keywords": ["test", "mock", "dependency"], | ||
"version": "0.3.1", | ||
"keywords": [ | ||
"test", | ||
"mock", | ||
"dependency" | ||
], | ||
"version": "0.3.2", | ||
"repository": { | ||
@@ -21,6 +25,8 @@ "type": "git", | ||
}, | ||
"licenses": [ { | ||
"type": "MIT", | ||
"url" : "http://github.com/fent/node-muk/raw/master/LICENSE" | ||
}] | ||
"licenses": [ | ||
{ | ||
"type": "MIT", | ||
"url": "http://github.com/fent/node-muk/raw/master/LICENSE" | ||
} | ||
] | ||
} |
@@ -79,2 +79,4 @@ var muk = require('..'); | ||
muk(config, 'delay', 0); | ||
muk(config, 'notExistProp', 'value'); | ||
muk(process.env, 'notExistProp', 0); | ||
muk.restore(); | ||
@@ -84,3 +86,9 @@ | ||
assert.equal(config.delay, 10, 'delay is 10'); | ||
assert(!hasOwnProperty(config, 'notExistProp'), 'notExistProp is deleted'); | ||
assert(!hasOwnProperty(process.env, 'notExistProp'), 'notExistProp is deleted'); | ||
}); | ||
}); | ||
}); | ||
function hasOwnProperty(obj, prop) { | ||
return Object.prototype.hasOwnProperty.call(obj, prop); | ||
} |
Sorry, the diff of this file is not supported yet
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
Environment variable access
Supply chain riskPackage accesses environment variables, which may be a sign of credential stuffing or data theft.
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
11267
251
13