Skip to content

Commit 54d5cff

Browse files
committed
fixes
1 parent ae78173 commit 54d5cff

File tree

2 files changed

+7
-2
lines changed

2 files changed

+7
-2
lines changed

static/app/utils/handleXhrErrorResponse.spec.tsx

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -81,8 +81,12 @@ describe('handleXhrErrorResponse', function () {
8181
const mockScope = new Sentry.Scope();
8282
const setExtrasSpy = jest.spyOn(mockScope, 'setExtras');
8383
const setTagsSpy = jest.spyOn(mockScope, 'setTags');
84-
const hub = Sentry.getCurrentHub();
85-
jest.spyOn(hub, 'pushScope').mockReturnValueOnce(mockScope);
84+
// @ts-expect-error this is fine...
85+
jest.spyOn(Sentry, 'withScope').mockImplementation(function (
86+
callback: (scope: Sentry.Scope) => any
87+
) {
88+
return callback(mockScope);
89+
});
8690

8791
handleXhrErrorResponse("Can't fetch ball", err);
8892

tests/js/setup.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,7 @@ jest.mock('echarts-for-react/lib/core', function echartsMockFactory() {
9696
jest.mock('@sentry/react', function sentryReact() {
9797
const SentryReact = jest.requireActual('@sentry/react');
9898
return {
99+
...SentryReact,
99100
init: jest.fn(),
100101
setTag: jest.fn(),
101102
setTags: jest.fn(),

0 commit comments

Comments
 (0)