Skip to content

Commit d37b8c9

Browse files
committed
fix test
1 parent 5860651 commit d37b8c9

File tree

2 files changed

+7
-6
lines changed

2 files changed

+7
-6
lines changed

packages/core/test/lib/hint.test.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@ describe('Hint', () => {
1414

1515
afterEach(() => {
1616
jest.clearAllMocks();
17-
// @ts-expect-error for testing
1817
delete GLOBAL_OBJ.__SENTRY__;
1918
});
2019

packages/core/test/utils-hoist/envelope.test.ts

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ import {
77
spanToJSON,
88
} from '@sentry/core';
99
import { SentrySpan } from '@sentry/core';
10+
import { getSentryCarrier } from '../../src/carrier';
1011
import {
1112
addItemToEnvelope,
1213
createEnvelope,
@@ -107,17 +108,18 @@ describe('envelope', () => {
107108
{
108109
name: 'with TextEncoder/Decoder polyfill',
109110
before: () => {
110-
GLOBAL_OBJ.__SENTRY__ = {} as InternalGlobal['__SENTRY__'];
111-
GLOBAL_OBJ.__SENTRY__.encodePolyfill = jest.fn<Uint8Array, [string]>((input: string) =>
111+
GLOBAL_OBJ.__SENTRY__ = {};
112+
113+
getSentryCarrier(GLOBAL_OBJ).encodePolyfill = jest.fn<Uint8Array, [string]>((input: string) =>
112114
new TextEncoder().encode(input),
113115
);
114-
GLOBAL_OBJ.__SENTRY__.decodePolyfill = jest.fn<string, [Uint8Array]>((input: Uint8Array) =>
116+
getSentryCarrier(GLOBAL_OBJ).decodePolyfill = jest.fn<string, [Uint8Array]>((input: Uint8Array) =>
115117
new TextDecoder().decode(input),
116118
);
117119
},
118120
after: () => {
119-
expect(GLOBAL_OBJ.__SENTRY__.encodePolyfill).toHaveBeenCalled();
120-
expect(GLOBAL_OBJ.__SENTRY__.decodePolyfill).toHaveBeenCalled();
121+
expect(getSentryCarrier(GLOBAL_OBJ).encodePolyfill).toHaveBeenCalled();
122+
expect(getSentryCarrier(GLOBAL_OBJ).decodePolyfill).toHaveBeenCalled();
121123
},
122124
},
123125
{

0 commit comments

Comments
 (0)