Skip to content

Commit ae10209

Browse files
committed
fix test
1 parent 992af87 commit ae10209

File tree

1 file changed

+9
-3
lines changed

1 file changed

+9
-3
lines changed

packages/react/test/redux.test.ts

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,16 @@
11
import * as Sentry from '@sentry/browser';
2+
import * as SentryCore from '@sentry/core';
23
import * as Redux from 'redux';
34

45
import { createReduxEnhancer } from '../src/redux';
56

6-
const mockAddBreadcrumb = jest.fn();
77
const mockSetContext = jest.fn();
88
const mockGlobalScopeAddEventProcessor = jest.fn();
99

1010
jest.mock('@sentry/core', () => ({
1111
...jest.requireActual('@sentry/core'),
1212
getCurrentScope() {
1313
return {
14-
addBreadcrumb: mockAddBreadcrumb,
1514
setContext: mockSetContext,
1615
};
1716
},
@@ -21,15 +20,22 @@ jest.mock('@sentry/core', () => ({
2120
};
2221
},
2322
addEventProcessor: jest.fn(),
23+
addBreadcrumb: jest.fn(),
2424
}));
2525

2626
afterEach(() => {
27-
mockAddBreadcrumb.mockReset();
2827
mockSetContext.mockReset();
2928
mockGlobalScopeAddEventProcessor.mockReset();
3029
});
3130

3231
describe('createReduxEnhancer', () => {
32+
let mockAddBreadcrumb: jest.SpyInstance;
33+
34+
beforeEach(() => {
35+
mockAddBreadcrumb = SentryCore.addBreadcrumb as unknown as jest.SpyInstance;
36+
mockAddBreadcrumb.mockReset();
37+
});
38+
3339
it('logs redux action as breadcrumb', () => {
3440
const enhancer = createReduxEnhancer();
3541

0 commit comments

Comments
 (0)