Skip to content

Commit ff08601

Browse files
committed
fix tests
1 parent 9738a37 commit ff08601

File tree

3 files changed

+10
-10
lines changed

3 files changed

+10
-10
lines changed

packages/core/test/lib/base.test.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -920,13 +920,13 @@ describe('BaseClient', () => {
920920
const options = getDefaultTestClientOptions({ dsn: PUBLIC_DSN, beforeSend });
921921
const client = new TestClient(options);
922922
const captureExceptionSpy = jest.spyOn(client, 'captureException');
923-
const loggerWarnSpy = jest.spyOn(logger, 'warn');
923+
const loggerWarnSpy = jest.spyOn(logger, 'log');
924924

925925
client.captureEvent({ message: 'hello' });
926926

927927
expect(TestClient.instance!.event).toBeUndefined();
928928
expect(captureExceptionSpy).not.toBeCalled();
929-
expect(loggerWarnSpy).toBeCalledWith(new SentryError('`beforeSend` returned `null`, will not send event.'));
929+
expect(loggerWarnSpy).toBeCalledWith('`beforeSend` returned `null`, will not send event.');
930930
});
931931

932932
test('calls beforeSend and log info about invalid return value', () => {
@@ -1065,15 +1065,15 @@ describe('BaseClient', () => {
10651065

10661066
const client = new TestClient(getDefaultTestClientOptions({ dsn: PUBLIC_DSN }));
10671067
const captureExceptionSpy = jest.spyOn(client, 'captureException');
1068-
const loggerWarnSpy = jest.spyOn(logger, 'warn');
1068+
const loggerLogSpy = jest.spyOn(logger, 'log');
10691069
const scope = new Scope();
10701070
scope.addEventProcessor(() => null);
10711071

10721072
client.captureEvent({ message: 'hello' }, {}, scope);
10731073

10741074
expect(TestClient.instance!.event).toBeUndefined();
10751075
expect(captureExceptionSpy).not.toBeCalled();
1076-
expect(loggerWarnSpy).toBeCalledWith(new SentryError('An event processor returned null, will not send event.'));
1076+
expect(loggerLogSpy).toBeCalledWith('An event processor returned null, will not send event.');
10771077
});
10781078

10791079
test('eventProcessor records dropped events', () => {

packages/nextjs/test/index.client.test.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import { getCurrentHub } from '@sentry/hub';
33
import * as SentryReact from '@sentry/react';
44
import { Integrations as TracingIntegrations } from '@sentry/tracing';
55
import { Integration } from '@sentry/types';
6-
import { getGlobalObject, logger, SentryError } from '@sentry/utils';
6+
import { getGlobalObject, logger } from '@sentry/utils';
77

88
import { init, Integrations, nextRouterInstrumentation } from '../src/index.client';
99
import { NextjsOptions } from '../src/utils/nextjsOptions';
@@ -14,7 +14,7 @@ const global = getGlobalObject();
1414

1515
const reactInit = jest.spyOn(SentryReact, 'init');
1616
const captureEvent = jest.spyOn(BaseClient.prototype, 'captureEvent');
17-
const logWarn = jest.spyOn(logger, 'warn');
17+
const loggerLogSpy = jest.spyOn(logger, 'log');
1818

1919
describe('Client init()', () => {
2020
afterEach(() => {
@@ -75,7 +75,7 @@ describe('Client init()', () => {
7575

7676
expect(transportSend).not.toHaveBeenCalled();
7777
expect(captureEvent.mock.results[0].value).toBeUndefined();
78-
expect(logWarn).toHaveBeenCalledWith(new SentryError('An event processor returned null, will not send event.'));
78+
expect(loggerLogSpy).toHaveBeenCalledWith('An event processor returned null, will not send event.');
7979
});
8080

8181
describe('integrations', () => {

packages/nextjs/test/index.server.test.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import { RewriteFrames } from '@sentry/integrations';
22
import * as SentryNode from '@sentry/node';
33
import { getCurrentHub, NodeClient } from '@sentry/node';
44
import { Integration } from '@sentry/types';
5-
import { getGlobalObject, logger, SentryError } from '@sentry/utils';
5+
import { getGlobalObject, logger } from '@sentry/utils';
66
import * as domain from 'domain';
77

88
import { init } from '../src/index.server';
@@ -16,7 +16,7 @@ const global = getGlobalObject();
1616
(global as typeof global & { __rewriteFramesDistDir__: string }).__rewriteFramesDistDir__ = '.next';
1717

1818
const nodeInit = jest.spyOn(SentryNode, 'init');
19-
const logWarn = jest.spyOn(logger, 'warn');
19+
const loggerLogSpy = jest.spyOn(logger, 'log');
2020

2121
describe('Server init()', () => {
2222
afterEach(() => {
@@ -104,7 +104,7 @@ describe('Server init()', () => {
104104
await SentryNode.flush();
105105

106106
expect(transportSend).not.toHaveBeenCalled();
107-
expect(logWarn).toHaveBeenCalledWith(new SentryError('An event processor returned null, will not send event.'));
107+
expect(loggerLogSpy).toHaveBeenCalledWith('An event processor returned null, will not send event.');
108108
});
109109

110110
it("initializes both global hub and domain hub when there's an active domain", () => {

0 commit comments

Comments
 (0)