Skip to content

Commit fd704f8

Browse files
committed
add client test
1 parent a7b492d commit fd704f8

File tree

1 file changed

+14
-1
lines changed

1 file changed

+14
-1
lines changed

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

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import { getCurrentHub } from '@sentry/hub';
22
import * as SentryReact from '@sentry/react';
33
import { Integrations as TracingIntegrations } from '@sentry/tracing';
44
import { Integration } from '@sentry/types';
5-
import { getGlobalObject } from '@sentry/utils';
5+
import { getGlobalObject, logger, SentryError } from '@sentry/utils';
66

77
import { init, Integrations, nextRouterInstrumentation } from '../src/index.client';
88
import { NextjsOptions } from '../src/utils/nextjsOptions';
@@ -12,6 +12,7 @@ const { BrowserTracing } = TracingIntegrations;
1212
const global = getGlobalObject();
1313

1414
const reactInit = jest.spyOn(SentryReact, 'init');
15+
const logError = jest.spyOn(logger, 'error');
1516

1617
describe('Client init()', () => {
1718
afterEach(() => {
@@ -50,6 +51,18 @@ describe('Client init()', () => {
5051
expect(currentScope._tags).toEqual({ runtime: 'browser' });
5152
});
5253

54+
it('adds 404 transaction filter', () => {
55+
init({
56+
dsn: 'https://dogsarebadatkeepingsecrets@squirrelchasers.ingest.sentry.io/12312012',
57+
tracesSampleRate: 1.0,
58+
});
59+
60+
const transaction = getCurrentHub().startTransaction({ name: '/404' });
61+
transaction.finish();
62+
63+
expect(logError).toHaveBeenCalledWith(new SentryError('An event processor returned null, will not send event.'));
64+
});
65+
5366
describe('integrations', () => {
5467
it('does not add BrowserTracing integration by default if tracesSampleRate is not set', () => {
5568
init({});

0 commit comments

Comments
 (0)