Skip to content

Commit

Permalink
Merge pull request #821 from wheresrhys/rhys/top-level-reset
Browse files Browse the repository at this point in the history
refactor: prefer to use top level methods exposed in @fetch-mock/core…
  • Loading branch information
wheresrhys authored Aug 29, 2024
2 parents 7f50243 + 7fae636 commit c50c4d5
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
1 change: 1 addition & 0 deletions packages/core/src/FetchMock.ts
Original file line number Diff line number Diff line change
Expand Up @@ -143,6 +143,7 @@ export class FetchMock {
this.callHistory.clear();
return this;
}

mockGlobal(this: FetchMock): FetchMock {
globalThis.fetch = this.fetchHandler;
return this;
Expand Down
4 changes: 2 additions & 2 deletions packages/vitest/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,11 @@ import './vitest-extensions';

class FetchMockVitest extends FetchMock {
mockClear() {
this.callHistory.clear();
this.clearHistory();
return this;
}
mockReset(options?: RemoveRouteOptions) {
this.router.removeRoutes(options);
this.removeRoutes(options);
return this.mockClear();
}
mockRestore(options?: RemoveRouteOptions) {
Expand Down

0 comments on commit c50c4d5

Please sign in to comment.