diff --git a/packages/core/test/client.test.ts b/packages/core/test/client.test.ts index 39385826cf..9805fba27c 100644 --- a/packages/core/test/client.test.ts +++ b/packages/core/test/client.test.ts @@ -117,7 +117,7 @@ describe('Tests ReactNativeClient', () => { }); await expect(client.eventFromMessage('test')).resolves.toBeDefined(); - await expect(RN.LogBox.ignoreLogs).not.toBeCalled(); + await expect(RN.LogBox.ignoreLogs).not.toHaveBeenCalled(); }); test('invalid dsn is thrown', () => { @@ -168,7 +168,7 @@ describe('Tests ReactNativeClient', () => { client.captureMessage('This message will never be sent because the client is disabled.'); - expect(mockTransport.send).not.toBeCalled(); + expect(mockTransport.send).not.toHaveBeenCalled(); }); test('captureException does not call transport when enabled false', () => { @@ -177,7 +177,7 @@ describe('Tests ReactNativeClient', () => { client.captureException(new Error('This exception will never be sent because the client is disabled.')); - expect(mockTransport.send).not.toBeCalled(); + expect(mockTransport.send).not.toHaveBeenCalled(); }); test('captureEvent does not call transport when enabled false', () => { @@ -188,7 +188,7 @@ describe('Tests ReactNativeClient', () => { message: 'This event will never be sent because the client is disabled.', }); - expect(mockTransport.send).not.toBeCalled(); + expect(mockTransport.send).not.toHaveBeenCalled(); }); test('captureSession does not call transport when enabled false', () => { @@ -197,16 +197,17 @@ describe('Tests ReactNativeClient', () => { client.captureSession(getMockSession()); - expect(mockTransport.send).not.toBeCalled(); + expect(mockTransport.send).not.toHaveBeenCalled(); }); + // TODO: Replacy by Sentry.captureFeedback test('captureUserFeedback does not call transport when enabled false', () => { const mockTransport = createMockTransport(); const client = createDisabledClientWith(mockTransport); client.captureUserFeedback(getMockUserFeedback()); - expect(mockTransport.send).not.toBeCalled(); + expect(mockTransport.send).not.toHaveBeenCalled(); }); function createDisabledClientWith(transport: Transport) { @@ -298,7 +299,7 @@ describe('Tests ReactNativeClient', () => { }); client.nativeCrash(); - expect(RN.NativeModules.RNSentry.crash).toBeCalled(); + expect(RN.NativeModules.RNSentry.crash).toHaveBeenCalled(); }); }); @@ -452,7 +453,7 @@ describe('Tests ReactNativeClient', () => { client.captureEvent({ message: 'test event' }); - expect(mockedSend).toBeCalled(); + expect(mockedSend).toHaveBeenCalled(); const actualEvent: Event | undefined = ( mockedSend.mock.calls[0][firstArg][envelopeItems][0][envelopeItemPayload] ); @@ -486,7 +487,7 @@ describe('Tests ReactNativeClient', () => { client.captureEvent(circularEvent); - expect(mockedSend).toBeCalled(); + expect(mockedSend).toHaveBeenCalled(); const actualEvent: Event | undefined = ( mockedSend.mock.calls[0][firstArg][envelopeItems][0][envelopeItemPayload] ); @@ -534,7 +535,7 @@ describe('Tests ReactNativeClient', () => { client.captureMessage('message_test_value'); - expect(mockTransportSend).toBeCalledTimes(1); + expect(mockTransportSend).toHaveBeenCalledTimes(1); expect(mockTransportSend.mock.calls[0][firstArg][envelopeItems][1][envelopeItemHeader]).toEqual({ type: 'client_report', }); @@ -607,7 +608,7 @@ describe('Tests ReactNativeClient', () => { mockDroppedEvent(client); client.captureMessage('message_test_value_2'); - expect(mockTransportSend).toBeCalledTimes(2); + expect(mockTransportSend).toHaveBeenCalledTimes(2); expect(mockTransportSend.mock.calls[0][firstArg][envelopeItems].length).toEqual(2); expect(mockTransportSend.mock.calls[0][firstArg][envelopeItems][1][envelopeItemHeader]).toEqual({ type: 'client_report', @@ -627,7 +628,7 @@ describe('Tests ReactNativeClient', () => { }); function expectOnlyMessageEventInEnvelope(transportSend: jest.Mock) { - expect(transportSend).toBeCalledTimes(1); + expect(transportSend).toHaveBeenCalledTimes(1); expect(transportSend.mock.calls[0][firstArg][envelopeItems]).toHaveLength(1); expect(transportSend.mock.calls[0][firstArg][envelopeItems][0][envelopeItemHeader]).toEqual( expect.objectContaining({ type: 'event' }), diff --git a/packages/core/test/integrations/nativelinkederrors.test.ts b/packages/core/test/integrations/nativelinkederrors.test.ts index 60d0b1e6ff..233686ebab 100644 --- a/packages/core/test/integrations/nativelinkederrors.test.ts +++ b/packages/core/test/integrations/nativelinkederrors.test.ts @@ -127,8 +127,8 @@ describe('NativeLinkedErrors', () => { }, ); - expect(NATIVE.fetchNativePackageName).toBeCalledTimes(1); - expect(NATIVE.fetchNativeStackFramesBy).not.toBeCalled(); + expect(NATIVE.fetchNativePackageName).toHaveBeenCalledTimes(1); + expect(NATIVE.fetchNativeStackFramesBy).not.toHaveBeenCalled(); expect(actualEvent).toEqual( expect.objectContaining(>{ exception: { @@ -266,9 +266,9 @@ describe('NativeLinkedErrors', () => { }, ); - expect(NATIVE.fetchNativePackageName).toBeCalledTimes(0); // not need for iOS - expect(NATIVE.fetchNativeStackFramesBy).toBeCalledTimes(1); - expect(NATIVE.fetchNativeStackFramesBy).toBeCalledWith([6446871344, 6442783348, 4350761216]); + expect(NATIVE.fetchNativePackageName).toHaveBeenCalledTimes(0); // not need for iOS + expect(NATIVE.fetchNativeStackFramesBy).toHaveBeenCalledTimes(1); + expect(NATIVE.fetchNativeStackFramesBy).toHaveBeenCalledWith([6446871344, 6442783348, 4350761216]); expect(actualEvent).toEqual( expect.objectContaining(>{ debug_meta: { diff --git a/packages/core/test/integrations/reactnativeinfo.test.ts b/packages/core/test/integrations/reactnativeinfo.test.ts index 2a6ab284be..03bd75c8e9 100644 --- a/packages/core/test/integrations/reactnativeinfo.test.ts +++ b/packages/core/test/integrations/reactnativeinfo.test.ts @@ -261,11 +261,11 @@ describe('React Native Info', () => { }); function expectMocksToBeCalledOnce() { - expect(mockedIsHermesEnabled).toBeCalledTimes(1); - expect(mockedIsTurboModuleEnabled).toBeCalledTimes(1); - expect(mockedIsFabricEnabled).toBeCalledTimes(1); - expect(mockedGetExpoGoVersion).toBeCalledTimes(1); - expect(mockedGetExpoSdkVersion).toBeCalledTimes(1); + expect(mockedIsHermesEnabled).toHaveBeenCalledTimes(1); + expect(mockedIsTurboModuleEnabled).toHaveBeenCalledTimes(1); + expect(mockedIsFabricEnabled).toHaveBeenCalledTimes(1); + expect(mockedGetExpoGoVersion).toHaveBeenCalledTimes(1); + expect(mockedGetExpoSdkVersion).toHaveBeenCalledTimes(1); } function executeIntegrationFor(mockedEvent: Event, mockedHint: EventHint): Event | null | PromiseLike { diff --git a/packages/core/test/integrations/sdkinfo.test.ts b/packages/core/test/integrations/sdkinfo.test.ts index b166491834..8fd8bf43c6 100644 --- a/packages/core/test/integrations/sdkinfo.test.ts +++ b/packages/core/test/integrations/sdkinfo.test.ts @@ -39,7 +39,7 @@ describe('Sdk Info', () => { expect(processedEvent?.sdk?.packages).toEqual(expect.arrayContaining([mockCocoaPackage])); expect(processedEvent?.platform === 'javascript'); - expect(mockedFetchNativeSdkInfo).toBeCalledTimes(1); + expect(mockedFetchNativeSdkInfo).toHaveBeenCalledTimes(1); }); it('Adds native package and javascript platform to event on Android', async () => { @@ -50,7 +50,7 @@ describe('Sdk Info', () => { expect(processedEvent?.sdk?.packages).toEqual(expect.not.arrayContaining([mockCocoaPackage])); expect(processedEvent?.platform === 'javascript'); - expect(mockedFetchNativeSdkInfo).toBeCalledTimes(1); + expect(mockedFetchNativeSdkInfo).toHaveBeenCalledTimes(1); }); it('Does not add any default non native packages', async () => { @@ -60,7 +60,7 @@ describe('Sdk Info', () => { expect(processedEvent?.sdk?.packages).toEqual([]); expect(processedEvent?.platform === 'javascript'); - expect(mockedFetchNativeSdkInfo).toBeCalledTimes(1); + expect(mockedFetchNativeSdkInfo).toHaveBeenCalledTimes(1); }); it('Does not overwrite existing sdk name and version', async () => { diff --git a/packages/core/test/profiling/integration.test.ts b/packages/core/test/profiling/integration.test.ts index bd904136fb..e0a4b393a6 100644 --- a/packages/core/test/profiling/integration.test.ts +++ b/packages/core/test/profiling/integration.test.ts @@ -365,7 +365,7 @@ describe('profiling integration', () => { transaction.end(); jest.runAllTimers(); - expect(mockWrapper.NATIVE.startProfiling).toBeCalledWith(false); + expect(mockWrapper.NATIVE.startProfiling).toHaveBeenCalledWith(false); }); }); diff --git a/packages/core/test/replay/CustomMask.test.ts b/packages/core/test/replay/CustomMask.test.ts index af8d677a62..7dd8d081e6 100644 --- a/packages/core/test/replay/CustomMask.test.ts +++ b/packages/core/test/replay/CustomMask.test.ts @@ -74,8 +74,8 @@ describe('CustomMask', () => { expect(Mask).toBe(mockMaskComponent); expect(Unmask).toBe(mockUnmaskComponent); - expect(mockNativeComponentRegistryGet).toBeCalledTimes(2); - expect(mockNativeComponentRegistryGet).toBeCalledWith('RNSentryReplayMask', expect.any(Function)); - expect(mockNativeComponentRegistryGet).toBeCalledWith('RNSentryReplayUnmask', expect.any(Function)); + expect(mockNativeComponentRegistryGet).toHaveBeenCalledTimes(2); + expect(mockNativeComponentRegistryGet).toHaveBeenCalledWith('RNSentryReplayMask', expect.any(Function)); + expect(mockNativeComponentRegistryGet).toHaveBeenCalledWith('RNSentryReplayUnmask', expect.any(Function)); }); }); diff --git a/packages/core/test/scopeSync.test.ts b/packages/core/test/scopeSync.test.ts index 989490de6e..abfba69291 100644 --- a/packages/core/test/scopeSync.test.ts +++ b/packages/core/test/scopeSync.test.ts @@ -30,7 +30,7 @@ describe('ScopeSync', () => { scope.addBreadcrumb({ message: 'test' }); - expect(NATIVE.addBreadcrumb).toBeCalledTimes(1); + expect(NATIVE.addBreadcrumb).toHaveBeenCalledTimes(1); }); it('adds default level if no level specified', () => { @@ -61,7 +61,7 @@ describe('ScopeSync', () => { message: 'test', }; scope.addBreadcrumb(breadcrumb); - expect(NATIVE.addBreadcrumb).toBeCalledWith( + expect(NATIVE.addBreadcrumb).toHaveBeenCalledWith( expect.objectContaining({ timestamp: expect.any(Number), }), @@ -73,7 +73,7 @@ describe('ScopeSync', () => { data: undefined, }; scope.addBreadcrumb(breadcrumb); - expect(NATIVE.addBreadcrumb).toBeCalledWith( + expect(NATIVE.addBreadcrumb).toHaveBeenCalledWith( expect.objectContaining({ data: undefined, }), @@ -87,7 +87,7 @@ describe('ScopeSync', () => { }, }; scope.addBreadcrumb(breadcrumb); - expect(NATIVE.addBreadcrumb).toBeCalledWith( + expect(NATIVE.addBreadcrumb).toHaveBeenCalledWith( expect.objectContaining({ data: { foo: '[NaN]' }, }), @@ -99,7 +99,7 @@ describe('ScopeSync', () => { data: 'foo' as unknown as object, }; scope.addBreadcrumb(breadcrumb); - expect(NATIVE.addBreadcrumb).toBeCalledWith( + expect(NATIVE.addBreadcrumb).toHaveBeenCalledWith( expect.objectContaining({ data: { value: 'foo' }, }), @@ -171,7 +171,7 @@ describe('ScopeSync', () => { expect(SentryCore.getIsolationScope().setTags).not.toBe(setTagsScopeSpy); SentryCore.setTags({ key: 'value', second: 'bar' }); - expect(NATIVE.setTag).toBeCalledTimes(2); + expect(NATIVE.setTag).toHaveBeenCalledTimes(2); expect(NATIVE.setTag).toHaveBeenCalledWith('key', 'value'); expect(NATIVE.setTag).toHaveBeenCalledWith('second', 'bar'); expect(setTagsScopeSpy).toHaveBeenCalledExactlyOnceWith({ key: 'value', second: 'bar' }); @@ -189,7 +189,7 @@ describe('ScopeSync', () => { expect(SentryCore.getIsolationScope().setExtras).not.toBe(setExtrasScopeSpy); SentryCore.setExtras({ key: 'value', second: 'bar' }); - expect(NATIVE.setExtra).toBeCalledTimes(2); + expect(NATIVE.setExtra).toHaveBeenCalledTimes(2); expect(NATIVE.setExtra).toHaveBeenCalledWith('key', 'value'); expect(NATIVE.setExtra).toHaveBeenCalledWith('second', 'bar'); expect(setExtrasScopeSpy).toHaveBeenCalledExactlyOnceWith({ key: 'value', second: 'bar' }); diff --git a/packages/core/test/sdk.test.ts b/packages/core/test/sdk.test.ts index 4856f185fd..017a0a9780 100644 --- a/packages/core/test/sdk.test.ts +++ b/packages/core/test/sdk.test.ts @@ -211,7 +211,7 @@ describe('Tests the SDK functionality', () => { it('fetchTransport set and enableNative set to false', () => { (NATIVE.isNativeAvailable as jest.Mock).mockImplementation(() => false); init({}); - expect(NATIVE.isNativeAvailable).toBeCalled(); + expect(NATIVE.isNativeAvailable).toHaveBeenCalled(); // @ts-expect-error enableNative not publicly available here. expect(usedOptions()?.enableNative).toEqual(false); expect(usedOptions()?.transport).toEqual(makeFetchTransport); @@ -220,7 +220,7 @@ describe('Tests the SDK functionality', () => { it('fetchTransport set and passed enableNative ignored when true', () => { (NATIVE.isNativeAvailable as jest.Mock).mockImplementation(() => false); init({ enableNative: true }); - expect(NATIVE.isNativeAvailable).toBeCalled(); + expect(NATIVE.isNativeAvailable).toHaveBeenCalled(); // @ts-expect-error enableNative not publicly available here. expect(usedOptions()?.enableNative).toEqual(false); expect(usedOptions()?.transport).toEqual(makeFetchTransport); @@ -229,7 +229,7 @@ describe('Tests the SDK functionality', () => { it('fetchTransport set and isNativeAvailable not called when passed enableNative set to false', () => { (NATIVE.isNativeAvailable as jest.Mock).mockImplementation(() => false); init({ enableNative: false }); - expect(NATIVE.isNativeAvailable).not.toBeCalled(); + expect(NATIVE.isNativeAvailable).not.toHaveBeenCalled(); // @ts-expect-error enableNative not publicly available here. expect(usedOptions()?.enableNative).toEqual(false); expect(usedOptions()?.transport).toEqual(makeFetchTransport); @@ -242,7 +242,7 @@ describe('Tests the SDK functionality', () => { transport: mockTransport, }); expect(usedOptions()?.transport).toEqual(mockTransport); - expect(NATIVE.isNativeAvailable).toBeCalled(); + expect(NATIVE.isNativeAvailable).toHaveBeenCalled(); // @ts-expect-error enableNative not publicly available here. expect(usedOptions()?.enableNative).toEqual(false); }); @@ -272,14 +272,14 @@ describe('Tests the SDK functionality', () => { (NATIVE.isNativeAvailable as jest.Mock).mockImplementation(() => true); init({ enableNative: false }); expect(usedOptions()?.transport).toEqual(makeFetchTransport); - expect(NATIVE.isNativeAvailable).not.toBeCalled(); + expect(NATIVE.isNativeAvailable).not.toHaveBeenCalled(); }); it('check both options and native availability', () => { (NATIVE.isNativeAvailable as jest.Mock).mockImplementation(() => true); init({ enableNative: true }); expect(usedOptions()?.transport).toEqual(makeNativeTransport); - expect(NATIVE.isNativeAvailable).toBeCalled(); + expect(NATIVE.isNativeAvailable).toHaveBeenCalled(); }); }); @@ -294,7 +294,7 @@ describe('Tests the SDK functionality', () => { expect(() => { (usedOptions()?.initialScope as (scope: Scope) => Scope)({} as any); }).not.toThrow(); - expect(mockInitialScope).toBeCalledTimes(1); + expect(mockInitialScope).toHaveBeenCalledTimes(1); }); test('beforeBreadcrumb callback is safe after init', () => { const mockBeforeBreadcrumb = jest.fn(() => { @@ -306,7 +306,7 @@ describe('Tests the SDK functionality', () => { expect(() => { usedOptions()?.beforeBreadcrumb?.({} as any); }).not.toThrow(); - expect(mockBeforeBreadcrumb).toBeCalledTimes(1); + expect(mockBeforeBreadcrumb).toHaveBeenCalledTimes(1); }); test('integrations callback should not crash init', () => { @@ -317,7 +317,7 @@ describe('Tests the SDK functionality', () => { expect(() => { init({ integrations: mockIntegrations }); }).not.toThrow(); - expect(mockIntegrations).toBeCalledTimes(1); + expect(mockIntegrations).toHaveBeenCalledTimes(1); }); test('tracesSampler callback is safe after init', () => { @@ -330,7 +330,7 @@ describe('Tests the SDK functionality', () => { expect(() => { usedOptions()?.tracesSampler?.({} as any); }).not.toThrow(); - expect(mockTraceSampler).toBeCalledTimes(1); + expect(mockTraceSampler).toHaveBeenCalledTimes(1); }); }); @@ -560,7 +560,7 @@ describe('Tests the SDK functionality', () => { }); expect(() => withScope(mockScopeCallback)).not.toThrow(); - expect(mockScopeCallback).toBeCalledTimes(1); + expect(mockScopeCallback).toHaveBeenCalledTimes(1); }); }); @@ -1005,6 +1005,7 @@ describe('Tests the SDK functionality', () => { expectIntegration('ExpoContext'); }); + // TODO: No longer an experiment on major version. it('adds mobile replay integration when _experiments.replaysOnErrorSampleRate is set', () => { init({ _experiments: { @@ -1023,6 +1024,7 @@ describe('Tests the SDK functionality', () => { expectIntegration('MobileReplay'); }); + // TODO: No longer an experiment on major version. it('adds mobile replay integration when _experiments.replaysSessionSampleRate is set', () => { init({ _experiments: { @@ -1041,6 +1043,7 @@ describe('Tests the SDK functionality', () => { expectIntegration('MobileReplay'); }); + // TODO: No longer an experiment on major version. it('does not add mobile replay integration when no replay sample rates are set', () => { init({ _experiments: {}, @@ -1049,6 +1052,7 @@ describe('Tests the SDK functionality', () => { expectNotIntegration('MobileReplay'); }); + // TODO: No longer an experiment on major version. it('does not add any replay integration when on web even with on experimental error sample rate', () => { (notWeb as jest.Mock).mockImplementation(() => false); init({ @@ -1061,6 +1065,7 @@ describe('Tests the SDK functionality', () => { expectNotIntegration('MobileReplay'); }); + // TODO: No longer an experiment on major version. it('does not add any replay integration when on web even with experimental session sample rate', () => { (notWeb as jest.Mock).mockImplementation(() => false); init({ @@ -1101,6 +1106,7 @@ describe('Tests the SDK functionality', () => { expectNotIntegration('MobileReplay'); }); + // TODO: No longer an experiment on major version. it('ignores experimental replay options when ga options are set', () => { (notWeb as jest.Mock).mockImplementation(() => false); init({ @@ -1121,6 +1127,7 @@ describe('Tests the SDK functionality', () => { ); }); + // TODO: No longer an experiment on major version. it('converts experimental replay options to standard web options when on web', () => { (notWeb as jest.Mock).mockImplementation(() => false); init({ @@ -1139,6 +1146,7 @@ describe('Tests the SDK functionality', () => { ); }); + // TODO: No longer an experiment on major version. it('converts experimental replay options to standard web options when on mobile', () => { (notWeb as jest.Mock).mockImplementation(() => true); init({ diff --git a/packages/core/test/sdk.withclient.test.ts b/packages/core/test/sdk.withclient.test.ts index 0d7258ef63..f788717e73 100644 --- a/packages/core/test/sdk.withclient.test.ts +++ b/packages/core/test/sdk.withclient.test.ts @@ -21,7 +21,7 @@ describe('Tests the SDK functionality', () => { it('Calls flush on the client', async () => { const flushResult = await flush(); - expect(client.flush).toBeCalled(); + expect(client.flush).toHaveBeenCalled(); expect(flushResult).toBe(true); }); @@ -30,9 +30,9 @@ describe('Tests the SDK functionality', () => { const flushResult = await flush(); - expect(client.flush).toBeCalled(); + expect(client.flush).toHaveBeenCalled(); expect(flushResult).toBe(false); - expect(debug.error).toBeCalledWith('Failed to flush the event queue.'); + expect(debug.error).toHaveBeenCalledWith('Failed to flush the event queue.'); }); }); @@ -40,15 +40,15 @@ describe('Tests the SDK functionality', () => { it('Returns Native crashedLastRun', async () => { NATIVE.crashedLastRun.mockClear().mockResolvedValue(true); expect(await crashedLastRun()).toBe(true); - expect(NATIVE.crashedLastRun).toBeCalled(); + expect(NATIVE.crashedLastRun).toHaveBeenCalled(); NATIVE.crashedLastRun.mockClear().mockResolvedValue(false); expect(await crashedLastRun()).toBe(false); - expect(NATIVE.crashedLastRun).toBeCalled(); + expect(NATIVE.crashedLastRun).toHaveBeenCalled(); NATIVE.crashedLastRun.mockClear().mockResolvedValue(null); expect(await crashedLastRun()).toBe(null); - expect(NATIVE.crashedLastRun).toBeCalled(); + expect(NATIVE.crashedLastRun).toHaveBeenCalled(); }); }); }); diff --git a/packages/core/test/tools/metroconfig.test.ts b/packages/core/test/tools/metroconfig.test.ts index e4ab6d2529..2d2addeb11 100644 --- a/packages/core/test/tools/metroconfig.test.ts +++ b/packages/core/test/tools/metroconfig.test.ts @@ -315,9 +315,9 @@ describe('metroconfig', () => { platform: string | null, ) { if (oldMetro) { - expect(received).toBeCalledWith(contextMock, `real${moduleName}`, platform, moduleName); + expect(received).toHaveBeenCalledWith(contextMock, `real${moduleName}`, platform, moduleName); } else { - expect(received).toBeCalledWith(contextMock, moduleName, platform); + expect(received).toHaveBeenCalledWith(contextMock, moduleName, platform); } } }); diff --git a/packages/core/test/touchevents.test.tsx b/packages/core/test/touchevents.test.tsx index 32c5504386..11c62e64d3 100644 --- a/packages/core/test/touchevents.test.tsx +++ b/packages/core/test/touchevents.test.tsx @@ -27,7 +27,7 @@ describe('TouchEventBoundary._onTouchStart', () => { boundary.componentDidMount(); - expect(addIntegration).toBeCalledWith(expect.objectContaining({ name: 'TouchEventBoundary' })); + expect(addIntegration).toHaveBeenCalledWith(expect.objectContaining({ name: 'TouchEventBoundary' })); }); it('tree without displayName or label is not logged', () => { @@ -60,7 +60,7 @@ describe('TouchEventBoundary._onTouchStart', () => { // @ts-expect-error Calling private member boundary._onTouchStart(event); - expect(addBreadcrumb).not.toBeCalled(); + expect(addBreadcrumb).not.toHaveBeenCalled(); }); it('sentry-label is preferred over labelName and displayName', () => { @@ -97,7 +97,7 @@ describe('TouchEventBoundary._onTouchStart', () => { // @ts-expect-error Calling private member boundary._onTouchStart(event); - expect(addBreadcrumb).toBeCalledWith({ + expect(addBreadcrumb).toHaveBeenCalledWith({ category: defaultProps.breadcrumbCategory, data: { path: [{ name: 'View' }, { name: 'Connect(View)' }, { label: 'LABEL!' }], @@ -156,7 +156,7 @@ describe('TouchEventBoundary._onTouchStart', () => { // @ts-expect-error Calling private member boundary._onTouchStart(event); - expect(addBreadcrumb).toBeCalledWith({ + expect(addBreadcrumb).toHaveBeenCalledWith({ category: defaultProps.breadcrumbCategory, data: { path: [{ name: 'Styled(View)' }], @@ -206,7 +206,7 @@ describe('TouchEventBoundary._onTouchStart', () => { // @ts-expect-error Calling private member boundary._onTouchStart(event); - expect(addBreadcrumb).toBeCalledWith({ + expect(addBreadcrumb).toHaveBeenCalledWith({ category: defaultProps.breadcrumbCategory, data: { path: [{ label: 'Connect(View)' }, { name: 'Styled(View)' }], @@ -263,7 +263,7 @@ describe('TouchEventBoundary._onTouchStart', () => { // @ts-expect-error Calling private member boundary._onTouchStart(event); - expect(addBreadcrumb).toBeCalledWith({ + expect(addBreadcrumb).toHaveBeenCalledWith({ category: defaultProps.breadcrumbCategory, data: { path: [ @@ -300,7 +300,7 @@ describe('TouchEventBoundary._onTouchStart', () => { // @ts-expect-error Calling private member boundary._onTouchStart(event); - expect(addBreadcrumb).toBeCalledWith({ + expect(addBreadcrumb).toHaveBeenCalledWith({ category: defaultProps.breadcrumbCategory, data: { path: [{ name: 'Text' }], diff --git a/packages/core/test/tracing/idleNavigationSpan.test.ts b/packages/core/test/tracing/idleNavigationSpan.test.ts index 3bb473afc9..74cca511c1 100644 --- a/packages/core/test/tracing/idleNavigationSpan.test.ts +++ b/packages/core/test/tracing/idleNavigationSpan.test.ts @@ -65,7 +65,7 @@ describe('startIdleNavigationSpan', () => { expect(routeTransaction).toBeDefined(); expect(spanToJSON(routeTransaction!).status).toBe('cancelled'); - expect(mockedAppState.removeSubscription).toBeCalledTimes(1); + expect(mockedAppState.removeSubscription).toHaveBeenCalledTimes(1); }); it('Does not crash when AppState is not available', async () => { diff --git a/packages/core/test/tracing/integrations/appStart.test.ts b/packages/core/test/tracing/integrations/appStart.test.ts index f017d2b113..883dbe4242 100644 --- a/packages/core/test/tracing/integrations/appStart.test.ts +++ b/packages/core/test/tracing/integrations/appStart.test.ts @@ -375,7 +375,7 @@ describe('App Start Integration', () => { const actualEvent = await captureStandAloneAppStart(); expect(actualEvent).toStrictEqual(undefined); - expect(NATIVE.fetchNativeAppStart).toBeCalledTimes(1); + expect(NATIVE.fetchNativeAppStart).toHaveBeenCalledTimes(1); }); it('Does not add app start if native returns null', async () => { @@ -383,7 +383,7 @@ describe('App Start Integration', () => { const actualEvent = await captureStandAloneAppStart(); expect(actualEvent).toStrictEqual(undefined); - expect(NATIVE.fetchNativeAppStart).toBeCalledTimes(1); + expect(NATIVE.fetchNativeAppStart).toHaveBeenCalledTimes(1); }); }); @@ -775,7 +775,7 @@ describe('App Start Integration', () => { const actualEvent = await processEvent(getMinimalTransactionEvent()); expect(actualEvent).toStrictEqual(getMinimalTransactionEvent()); - expect(NATIVE.fetchNativeAppStart).toBeCalledTimes(1); + expect(NATIVE.fetchNativeAppStart).toHaveBeenCalledTimes(1); }); it('Does not add app start if native returns null', async () => { @@ -783,7 +783,7 @@ describe('App Start Integration', () => { const actualEvent = await processEvent(getMinimalTransactionEvent()); expect(actualEvent).toStrictEqual(getMinimalTransactionEvent()); - expect(NATIVE.fetchNativeAppStart).toBeCalledTimes(1); + expect(NATIVE.fetchNativeAppStart).toHaveBeenCalledTimes(1); }); }); }); diff --git a/packages/core/test/tracing/integrations/stallTracking/stalltracking.background.test.ts b/packages/core/test/tracing/integrations/stallTracking/stalltracking.background.test.ts index e83d0d505b..8a7270124f 100644 --- a/packages/core/test/tracing/integrations/stallTracking/stalltracking.background.test.ts +++ b/packages/core/test/tracing/integrations/stallTracking/stalltracking.background.test.ts @@ -48,7 +48,7 @@ describe('BackgroundEventListener', () => { }); stallTracking['_internalState']['backgroundEventListener']('active' as AppStateStatus); - expect(stallTracking['_internalState']['iteration']).not.toBeCalled(); + expect(stallTracking['_internalState']['iteration']).not.toHaveBeenCalled(); }); it('Stall tracking should call _iteration when state is active and _timeout is defined', () => { const stallTracking = stallTrackingIntegration() as StallTrackingWithTestProperties; @@ -60,6 +60,6 @@ describe('BackgroundEventListener', () => { doNotFake: ['performance'], // Keep real performance API }); stallTracking['_internalState']['backgroundEventListener']('active' as AppStateStatus); - expect(stallTracking['_internalState']['iteration']).toBeCalled(); + expect(stallTracking['_internalState']['iteration']).toHaveBeenCalled(); }); }); diff --git a/packages/core/test/tracing/integrations/userInteraction.test.ts b/packages/core/test/tracing/integrations/userInteraction.test.ts index 4b983a5390..f01034cd5e 100644 --- a/packages/core/test/tracing/integrations/userInteraction.test.ts +++ b/packages/core/test/tracing/integrations/userInteraction.test.ts @@ -151,7 +151,7 @@ describe('User Interaction Tracing', () => { status: 'cancelled', }), ); - expect(mockedAppState.removeSubscription).toBeCalledTimes(1); + expect(mockedAppState.removeSubscription).toHaveBeenCalledTimes(1); }); test('do not overwrite existing status of UI event transactions', () => { diff --git a/packages/core/test/tracing/reactnativetracing.test.ts b/packages/core/test/tracing/reactnativetracing.test.ts index 7aab318b6d..eabd944984 100644 --- a/packages/core/test/tracing/reactnativetracing.test.ts +++ b/packages/core/test/tracing/reactnativetracing.test.ts @@ -61,7 +61,7 @@ describe('ReactNativeTracing', () => { integrations: [reactNativeTracingIntegration()], }); - expect(instrumentOutgoingRequests).toBeCalledWith( + expect(instrumentOutgoingRequests).toHaveBeenCalledWith( expect.anything(), expect.objectContaining({ tracePropagationTargets: ['test1', 'test2'], @@ -77,7 +77,7 @@ describe('ReactNativeTracing', () => { integrations: [reactNativeTracingIntegration()], }); - expect(instrumentOutgoingRequests).toBeCalledWith( + expect(instrumentOutgoingRequests).toHaveBeenCalledWith( expect.anything(), expect.objectContaining({ tracePropagationTargets: [/.*/], @@ -93,7 +93,7 @@ describe('ReactNativeTracing', () => { integrations: [reactNativeTracingIntegration()], }); - expect(instrumentOutgoingRequests).toBeCalledWith( + expect(instrumentOutgoingRequests).toHaveBeenCalledWith( expect.anything(), expect.objectContaining({ tracePropagationTargets: undefined, diff --git a/packages/core/test/utils/safe.test.ts b/packages/core/test/utils/safe.test.ts index 0e781ef313..d023ea3517 100644 --- a/packages/core/test/utils/safe.test.ts +++ b/packages/core/test/utils/safe.test.ts @@ -6,14 +6,14 @@ describe('safe', () => { const mockFn = jest.fn(); const actualSafeFunction = safeFactory(mockFn); actualSafeFunction('foo', 'bar'); - expect(mockFn).toBeCalledTimes(1); - expect(mockFn).toBeCalledWith('foo', 'bar'); + expect(mockFn).toHaveBeenCalledTimes(1); + expect(mockFn).toHaveBeenCalledWith('foo', 'bar'); }); test('calls given function amd return its result', () => { const mockFn = jest.fn(() => 'bar'); const actualSafeFunction = safeFactory(mockFn); const actualResult = actualSafeFunction('foo'); - expect(mockFn).toBeCalledTimes(1); + expect(mockFn).toHaveBeenCalledTimes(1); expect(actualResult).toBe('bar'); }); test('passes undefined trough', () => { @@ -30,7 +30,7 @@ describe('safe', () => { }); const actualSafeFunction = safeFactory(<(foo: string) => string>mockFn); const actualResult = actualSafeFunction('foo'); - expect(mockFn).toBeCalledTimes(1); + expect(mockFn).toHaveBeenCalledTimes(1); expect(actualResult).toEqual('foo'); }); }); @@ -46,8 +46,8 @@ describe('safe', () => { transactionContext: { name: 'foo' }, inheritOrSampleWith: expectedInheritOrSampleWith, }); - expect(mockFn).toBeCalledTimes(1); - expect(mockFn).toBeCalledWith({ + expect(mockFn).toHaveBeenCalledTimes(1); + expect(mockFn).toHaveBeenCalledWith({ name: 'foo', transactionContext: { name: 'foo' }, inheritOrSampleWith: expectedInheritOrSampleWith, @@ -63,7 +63,7 @@ describe('safe', () => { return fallbackSampleRate; }, }); - expect(mockFn).toBeCalledTimes(1); + expect(mockFn).toHaveBeenCalledTimes(1); expect(actualResult).toBe(0.5); }); test('passes undefined trough', () => { @@ -82,7 +82,7 @@ describe('safe', () => { return fallbackSampleRate; }, }); - expect(mockFn).toBeCalledTimes(1); + expect(mockFn).toHaveBeenCalledTimes(1); expect(actualResult).toEqual(0); }); }); diff --git a/packages/core/test/utils/sentryeventemitter.test.ts b/packages/core/test/utils/sentryeventemitter.test.ts index 8f925b9ca6..7338e86061 100644 --- a/packages/core/test/utils/sentryeventemitter.test.ts +++ b/packages/core/test/utils/sentryeventemitter.test.ts @@ -16,7 +16,7 @@ describe('Sentry Event Emitter', () => { const sut = createSentryEventEmitter(undefined, mockedCreateNativeEventEmitter); expect(sut).toBeDefined(); - expect(mockedCreateNativeEventEmitter).not.toBeCalled(); + expect(mockedCreateNativeEventEmitter).not.toHaveBeenCalled(); }); test('should add listener to the native event emitter when initialized', () => { @@ -24,8 +24,8 @@ describe('Sentry Event Emitter', () => { sut.initAsync('rn_sentry_new_frame'); - expect(mockedCreateNativeEventEmitter).toBeCalledTimes(1); - expect(mockedAddListener).toBeCalledWith('rn_sentry_new_frame', expect.any(Function)); + expect(mockedCreateNativeEventEmitter).toHaveBeenCalledTimes(1); + expect(mockedAddListener).toHaveBeenCalledWith('rn_sentry_new_frame', expect.any(Function)); }); test('should not add listener to the native event emitter when initialized if already initialized', () => { @@ -34,8 +34,8 @@ describe('Sentry Event Emitter', () => { sut.initAsync('rn_sentry_new_frame'); sut.initAsync('rn_sentry_new_frame'); - expect(mockedCreateNativeEventEmitter).toBeCalledTimes(1); - expect(mockedAddListener).toBeCalledTimes(1); + expect(mockedCreateNativeEventEmitter).toHaveBeenCalledTimes(1); + expect(mockedAddListener).toHaveBeenCalledTimes(1); }); test('should remove all native listeners when closed', () => { @@ -45,7 +45,7 @@ describe('Sentry Event Emitter', () => { sut.initAsync('test_event' as NewFrameEventName); sut.closeAllAsync(); - expect(mockedRemoveListener).toBeCalledTimes(2); + expect(mockedRemoveListener).toHaveBeenCalledTimes(2); }); test('should call added listeners when native event is emitted', () => { @@ -58,7 +58,7 @@ describe('Sentry Event Emitter', () => { const nativeListener = mockedAddListener.mock.calls[0][1]; nativeListener({ type: 'rn_sentry_new_frame' }); - expect(listener).toBeCalledTimes(1); + expect(listener).toHaveBeenCalledTimes(1); }); test('should not call removed listeners when native event is emitted', () => { @@ -72,7 +72,7 @@ describe('Sentry Event Emitter', () => { const nativeListener = mockedAddListener.mock.calls[0][1]; nativeListener({ type: 'rn_sentry_new_frame' }); - expect(listener).not.toBeCalled(); + expect(listener).not.toHaveBeenCalled(); }); test('should call once listeners only once when native event is emitted', () => { @@ -86,6 +86,6 @@ describe('Sentry Event Emitter', () => { nativeListener({ type: 'rn_sentry_new_frame' }); nativeListener({ type: 'rn_sentry_new_frame' }); - expect(listener).toBeCalledTimes(1); + expect(listener).toHaveBeenCalledTimes(1); }); }); diff --git a/packages/core/test/utils/sentryeventemitterfallback.test.ts b/packages/core/test/utils/sentryeventemitterfallback.test.ts index c4e2de2c58..dcee207da9 100644 --- a/packages/core/test/utils/sentryeventemitterfallback.test.ts +++ b/packages/core/test/utils/sentryeventemitterfallback.test.ts @@ -210,7 +210,7 @@ describe('SentryEventEmitterFallback', () => { newFrameTimestampInSeconds: 67890, isFallback: undefined, }); - expect(debug.log).not.toBeCalled(); + expect(debug.log).not.toHaveBeenCalled(); }); it('should retry up to maxRetries and emit fallback if no response', async () => { diff --git a/packages/core/test/wrapper.test.ts b/packages/core/test/wrapper.test.ts index e15f98e7df..a27b13bdc8 100644 --- a/packages/core/test/wrapper.test.ts +++ b/packages/core/test/wrapper.test.ts @@ -104,7 +104,7 @@ describe('Tests Native Wrapper', () => { mobileReplayOptions: undefined, }); - expect(RNSentry.initNativeSdk).toBeCalled(); + expect(RNSentry.initNativeSdk).toHaveBeenCalled(); }); test('warns if there is no dsn', async () => { @@ -117,7 +117,7 @@ describe('Tests Native Wrapper', () => { mobileReplayOptions: undefined, }); - expect(RNSentry.initNativeSdk).not.toBeCalled(); + expect(RNSentry.initNativeSdk).not.toHaveBeenCalled(); expect(debug.warn).toHaveBeenLastCalledWith( 'Warning: No DSN was provided. The Sentry SDK will be disabled. Native SDK will also not be initalized.', ); @@ -135,7 +135,7 @@ describe('Tests Native Wrapper', () => { mobileReplayOptions: undefined, }); - expect(RNSentry.initNativeSdk).not.toBeCalled(); + expect(RNSentry.initNativeSdk).not.toHaveBeenCalled(); expect(NATIVE.enableNative).toBe(false); expect(debug.warn).toHaveBeenLastCalledWith('Note: Native Sentry SDK is disabled.'); }); @@ -151,7 +151,7 @@ describe('Tests Native Wrapper', () => { mobileReplayOptions: undefined, }); - expect(RNSentry.initNativeSdk).toBeCalled(); + expect(RNSentry.initNativeSdk).toHaveBeenCalled(); // @ts-expect-error mock value const initParameter = RNSentry.initNativeSdk.mock.calls[0][0]; expect(initParameter).not.toHaveProperty('beforeSend'); @@ -169,7 +169,7 @@ describe('Tests Native Wrapper', () => { mobileReplayOptions: undefined, }); - expect(RNSentry.initNativeSdk).toBeCalled(); + expect(RNSentry.initNativeSdk).toHaveBeenCalled(); // @ts-expect-error mock value const initParameter = RNSentry.initNativeSdk.mock.calls[0][0]; expect(initParameter).not.toHaveProperty('beforeBreadcrumb'); @@ -187,7 +187,7 @@ describe('Tests Native Wrapper', () => { mobileReplayOptions: undefined, }); - expect(RNSentry.initNativeSdk).toBeCalled(); + expect(RNSentry.initNativeSdk).toHaveBeenCalled(); // @ts-expect-error mock value const initParameter = RNSentry.initNativeSdk.mock.calls[0][0]; expect(initParameter).not.toHaveProperty('beforeSendTransaction'); @@ -205,7 +205,7 @@ describe('Tests Native Wrapper', () => { mobileReplayOptions: undefined, }); - expect(RNSentry.initNativeSdk).toBeCalled(); + expect(RNSentry.initNativeSdk).toHaveBeenCalled(); // @ts-expect-error mock value const initParameter = RNSentry.initNativeSdk.mock.calls[0][0]; expect(initParameter).not.toHaveProperty('integrations'); @@ -225,12 +225,12 @@ describe('Tests Native Wrapper', () => { mobileReplayOptions: undefined, }); - expect(RNSentry.initNativeSdk).not.toBeCalled(); + expect(RNSentry.initNativeSdk).not.toHaveBeenCalled(); expect(NATIVE.enableNative).toBe(true); // Test that native bridge methods will go through callAllScopeMethods(); - expect(RNSentry.addBreadcrumb).toBeCalledWith({ + expect(RNSentry.addBreadcrumb).toHaveBeenCalledWith({ message: 'test', data: { map: { a: 1 }, @@ -238,15 +238,15 @@ describe('Tests Native Wrapper', () => { unique: 123, }, }); - expect(RNSentry.clearBreadcrumbs).toBeCalled(); - expect(RNSentry.setUser).toBeCalledWith( + expect(RNSentry.clearBreadcrumbs).toHaveBeenCalled(); + expect(RNSentry.setUser).toHaveBeenCalledWith( { id: 'setUser', }, {}, ); - expect(RNSentry.setTag).toBeCalledWith('key', 'value'); - expect(RNSentry.setContext).toBeCalledWith('key', { + expect(RNSentry.setTag).toHaveBeenCalledWith('key', 'value'); + expect(RNSentry.setContext).toHaveBeenCalledWith('key', { value: 'value', data: { map: { a: 1 }, @@ -254,7 +254,7 @@ describe('Tests Native Wrapper', () => { unique: 123, }, }); - expect(RNSentry.setExtra).toBeCalledWith('key', 'value'); + expect(RNSentry.setExtra).toHaveBeenCalledWith('key', 'value'); }); test('enableNative: false takes precedence over autoInitializeNativeSdk: false', async () => { @@ -269,17 +269,17 @@ describe('Tests Native Wrapper', () => { autoInitializeNativeSdk: false, }); - expect(RNSentry.initNativeSdk).not.toBeCalled(); + expect(RNSentry.initNativeSdk).not.toHaveBeenCalled(); expect(NATIVE.enableNative).toBe(false); // Test that native bridge methods will NOT go through callAllScopeMethods(); - expect(RNSentry.addBreadcrumb).not.toBeCalled(); - expect(RNSentry.clearBreadcrumbs).not.toBeCalled(); - expect(RNSentry.setUser).not.toBeCalled(); - expect(RNSentry.setTag).not.toBeCalled(); - expect(RNSentry.setContext).not.toBeCalled(); - expect(RNSentry.setExtra).not.toBeCalled(); + expect(RNSentry.addBreadcrumb).not.toHaveBeenCalled(); + expect(RNSentry.clearBreadcrumbs).not.toHaveBeenCalled(); + expect(RNSentry.setUser).not.toHaveBeenCalled(); + expect(RNSentry.setTag).not.toHaveBeenCalled(); + expect(RNSentry.setContext).not.toHaveBeenCalled(); + expect(RNSentry.setExtra).not.toHaveBeenCalled(); }); test('sets ignoreErrorsStr and ignoreErrorsRegex correctly when ignoreErrors contains strings and regex', async () => { @@ -293,7 +293,7 @@ describe('Tests Native Wrapper', () => { defaultSidecarUrl: undefined, mobileReplayOptions: undefined, }); - expect(RNSentry.initNativeSdk).toBeCalled(); + expect(RNSentry.initNativeSdk).toHaveBeenCalled(); const initParameter = (RNSentry.initNativeSdk as jest.MockedFunction).mock.calls[0][0]; expect(initParameter.ignoreErrorsStr).toEqual(['string1', 'string2']); expect(initParameter.ignoreErrorsRegex).toEqual([regex1.source, regex2.source]); @@ -307,7 +307,7 @@ describe('Tests Native Wrapper', () => { defaultSidecarUrl: undefined, mobileReplayOptions: undefined, }); - expect(RNSentry.initNativeSdk).toBeCalled(); + expect(RNSentry.initNativeSdk).toHaveBeenCalled(); const initParameter = (RNSentry.initNativeSdk as jest.MockedFunction).mock.calls[0][0]; expect(initParameter.ignoreErrorsStr).toBeUndefined(); expect(initParameter.ignoreErrorsRegex).toBeUndefined(); @@ -369,7 +369,7 @@ describe('Tests Native Wrapper', () => { await NATIVE.sendEnvelope(env); - expect(RNSentry.captureEnvelope).toBeCalledWith( + expect(RNSentry.captureEnvelope).toHaveBeenCalledWith( base64StringFromByteArray( utf8ToBytes( '{"event_id":"event0","sent_at":"123"}\n' + @@ -401,7 +401,7 @@ describe('Tests Native Wrapper', () => { await NATIVE.sendEnvelope(env); - expect(RNSentry.captureEnvelope).toBeCalledWith( + expect(RNSentry.captureEnvelope).toHaveBeenCalledWith( base64StringFromByteArray( utf8ToBytes( '{"event_id":"event0","sent_at":"123"}\n' + @@ -428,7 +428,7 @@ describe('Tests Native Wrapper', () => { // @ts-expect-error it is an error but it does not know the type. expect(error.message).toMatch('Native is disabled'); } - expect(RNSentry.captureEnvelope).not.toBeCalled(); + expect(RNSentry.captureEnvelope).not.toHaveBeenCalled(); }); test('Encloses message to an object and not introduce empty breadcrumbs on Android', async () => { NATIVE.platform = 'android'; @@ -444,7 +444,7 @@ describe('Tests Native Wrapper', () => { await NATIVE.sendEnvelope(env); - expect(RNSentry.captureEnvelope).toBeCalledWith( + expect(RNSentry.captureEnvelope).toHaveBeenCalledWith( base64StringFromByteArray( utf8ToBytes( '{"event_id":"event0","sent_at":"123"}\n' + @@ -483,7 +483,7 @@ describe('Tests Native Wrapper', () => { await NATIVE.sendEnvelope(env); - expect(RNSentry.captureEnvelope).toBeCalledWith( + expect(RNSentry.captureEnvelope).toHaveBeenCalledWith( base64StringFromByteArray( utf8ToBytes( '{"event_id":"event0","sent_at":"123"}\n' + @@ -512,7 +512,7 @@ describe('Tests Native Wrapper', () => { await NATIVE.sendEnvelope(env); - expect(RNSentry.captureEnvelope).toBeCalledWith( + expect(RNSentry.captureEnvelope).toHaveBeenCalledWith( base64StringFromByteArray( utf8ToBytes( '{"event_id":"event0","sent_at":"123"}\n' + @@ -551,7 +551,7 @@ describe('Tests Native Wrapper', () => { await NATIVE.sendEnvelope(env); - expect(RNSentry.captureEnvelope).toBeCalledWith( + expect(RNSentry.captureEnvelope).toHaveBeenCalledWith( base64StringFromByteArray( utf8ToBytes( '{"event_id":"event0","sent_at":"123"}\n' + @@ -584,7 +584,7 @@ describe('Tests Native Wrapper', () => { }, }); - expect(RNSentry.fetchNativeDeviceContexts).toBeCalled(); + expect(RNSentry.fetchNativeDeviceContexts).toHaveBeenCalled(); }); test('returns context object from native module on android', async () => { NATIVE.platform = 'android'; @@ -595,7 +595,7 @@ describe('Tests Native Wrapper', () => { }, }); - expect(RNSentry.fetchNativeDeviceContexts).toBeCalled(); + expect(RNSentry.fetchNativeDeviceContexts).toHaveBeenCalled(); }); }); @@ -609,7 +609,7 @@ describe('Tests Native Wrapper', () => { test('calls the native crash', () => { NATIVE.nativeCrash(); - expect(RNSentry.crash).toBeCalled(); + expect(RNSentry.crash).toHaveBeenCalled(); }); test('does not call crash if enableNative is false', async () => { await NATIVE.initNativeSdk({ @@ -621,7 +621,7 @@ describe('Tests Native Wrapper', () => { }); NATIVE.nativeCrash(); - expect(RNSentry.crash).not.toBeCalled(); + expect(RNSentry.crash).not.toHaveBeenCalled(); }); }); @@ -633,7 +633,7 @@ describe('Tests Native Wrapper', () => { unique: 123, }); - expect(RNSentry.setUser).toBeCalledWith( + expect(RNSentry.setUser).toHaveBeenCalledWith( { email: 'hello@sentry.io', id: '3.14159265359', @@ -649,7 +649,7 @@ describe('Tests Native Wrapper', () => { id: 'Hello', }); - expect(RNSentry.setUser).toBeCalledWith( + expect(RNSentry.setUser).toHaveBeenCalledWith( { id: 'Hello', }, @@ -670,7 +670,7 @@ describe('Tests Native Wrapper', () => { customField: 'customValue', }); - expect(RNSentry.setUser).toBeCalledWith( + expect(RNSentry.setUser).toHaveBeenCalledWith( { id: '123', email: 'test@example.com', @@ -696,7 +696,7 @@ describe('Tests Native Wrapper', () => { }, }); - expect(RNSentry.setUser).toBeCalledWith( + expect(RNSentry.setUser).toHaveBeenCalledWith( { id: '123', geo: JSON.stringify({ @@ -714,7 +714,7 @@ describe('Tests Native Wrapper', () => { geo: {}, }); - expect(RNSentry.setUser).toBeCalledWith( + expect(RNSentry.setUser).toHaveBeenCalledWith( { id: '123', geo: '{}', @@ -729,7 +729,7 @@ describe('Tests Native Wrapper', () => { geo: undefined, }); - expect(RNSentry.setUser).toBeCalledWith( + expect(RNSentry.setUser).toHaveBeenCalledWith( { id: '123', geo: undefined, @@ -757,7 +757,7 @@ describe('Tests Native Wrapper', () => { test('closeNativeSdk calls native bridge', async () => { await NATIVE.closeNativeSdk(); - expect(RNSentry.closeNativeSdk).toBeCalled(); + expect(RNSentry.closeNativeSdk).toHaveBeenCalled(); expect(NATIVE.enableNative).toBe(false); }); });