Skip to content

Commit 790b26c

Browse files
committed
fix: clear mock cache when restore
1 parent 0065bc3 commit 790b26c

File tree

2 files changed

+3
-0
lines changed

2 files changed

+3
-0
lines changed

lib/method.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,7 @@ method.restore = function restoreMocks() {
7272
}
7373
}
7474
mocks = [];
75+
cache.clear();
7576

7677
/*
7778
requireMocks.forEach(function(m) {

test/method-test.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -200,8 +200,10 @@ describe('Mock check', function() {
200200
a: 1,
201201
};
202202
muk(obj, 'a', 2);
203+
assert.equal(muk.isMocked(obj, 'a'), true);
203204
muk.restore();
204205
assert.equal(obj.a, 1);
206+
assert.equal(muk.isMocked(obj, 'a'), false);
205207
});
206208

207209
it('Should check different type', function() {

0 commit comments

Comments
 (0)