Skip to content

Commit

Permalink
fix: Clear unexpected calls on reset()
Browse files Browse the repository at this point in the history
  • Loading branch information
NiGhTTraX committed May 7, 2020
1 parent d722a82 commit 04493f7
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 0 deletions.
1 change: 1 addition & 0 deletions src/base-repository.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ export abstract class BaseRepository implements ExpectationRepository {
clear(): void {
this.expectations.clear();
this.expectedCallStats.clear();
this.unexpectedCallStats.clear();
}

get(property: PropertyKey): any {
Expand Down
3 changes: 3 additions & 0 deletions tests/repo-contract.ts
Original file line number Diff line number Diff line change
Expand Up @@ -247,6 +247,9 @@ export const repoContractTests: ExpectationRepositoryContract = {
repo.add(new MatchingPropertyExpectation('foo', 23));

repo.get('foo');
try {
repo.get('foo');
} catch (e) {}
repo.clear();

const callStats: CallStats = {
Expand Down

0 comments on commit 04493f7

Please sign in to comment.