Skip to content

Commit

Permalink
fix: clear mock cache when restore
Browse files Browse the repository at this point in the history
  • Loading branch information
popomore committed Jun 12, 2016
1 parent 0065bc3 commit 790b26c
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 0 deletions.
1 change: 1 addition & 0 deletions lib/method.js
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@ method.restore = function restoreMocks() {
}
}
mocks = [];
cache.clear();

/*
requireMocks.forEach(function(m) {
Expand Down
2 changes: 2 additions & 0 deletions test/method-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -200,8 +200,10 @@ describe('Mock check', function() {
a: 1,
};
muk(obj, 'a', 2);
assert.equal(muk.isMocked(obj, 'a'), true);
muk.restore();
assert.equal(obj.a, 1);
assert.equal(muk.isMocked(obj, 'a'), false);
});

it('Should check different type', function() {
Expand Down

0 comments on commit 790b26c

Please sign in to comment.