Skip to content

Commit

Permalink
fix: the issue for jest clear mocks
Browse files Browse the repository at this point in the history
  • Loading branch information
xiaoweii committed Jun 7, 2024
1 parent 3f28270 commit 7a233fe
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
5 changes: 3 additions & 2 deletions test/browser/BrowserInfo.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,10 @@ describe('BrowserInfo test', () => {
afterEach(() => {
jest.clearAllMocks();
jest.resetAllMocks();
jest.restoreAllMocks();
});
test('test create BrowserInfo', () => {
StorageUtil.clearAllEvents()
StorageUtil.clearAllEvents();
const referrer = 'https://example.com/collect';
Object.defineProperty(window.document, 'referrer', {
writable: true,
Expand Down Expand Up @@ -111,7 +112,7 @@ describe('BrowserInfo test', () => {
test('test web page not from reload', () => {
(global as any).PerformanceObserver = MockObserver;
setPerformanceEntries(true, true);
StorageUtil.savePreviousPageUrl("http://localhost:8080")
StorageUtil.savePreviousPageUrl('http://localhost:8080');
expect(BrowserInfo.isFromReload()).toBeTruthy();
});
});
1 change: 1 addition & 0 deletions test/tracker/PageViewTracker.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,7 @@ describe('PageViewTracker test', () => {

afterEach(() => {
jest.restoreAllMocks();
jest.resetAllMocks();
jest.clearAllMocks();
provider = undefined;
Object.defineProperty(window, 'location', {
Expand Down

0 comments on commit 7a233fe

Please sign in to comment.