Skip to content

Commit

Permalink
fix stuff
Browse files Browse the repository at this point in the history
  • Loading branch information
mydea committed Jun 13, 2024
1 parent df376ce commit 3eda481
Show file tree
Hide file tree
Showing 10 changed files with 16 additions and 12 deletions.
2 changes: 1 addition & 1 deletion packages/nextjs/test/clientSdk.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ describe('Client init()', () => {
it('supports passing unrelated integrations through options', () => {
init({ integrations: [breadcrumbsIntegration({ console: false })] });

const reactInitOptions = reactInit.mock.calls[0][0] as ModifiedInitOptionsIntegrationArray;
const reactInitOptions = reactInit.mock.calls[0]![0] as ModifiedInitOptionsIntegrationArray;
const installedBreadcrumbsIntegration = findIntegrationByName(reactInitOptions.integrations, 'Breadcrumbs');

expect(installedBreadcrumbsIntegration).toBeDefined();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ describe('Tracing 200', () => {
});

const sentryTransactionEnvelope = envelopes.find(envelope => {
const envelopeItem = envelope[2];
const envelopeItem = envelope[2]!;
return envelopeItem.transaction === 'GET /api/users';
});

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ describe('Tracing 500', () => {
});

const sentryTransactionEnvelope = envelopes.find(envelope => {
const envelopeItem = envelope[2];
const envelopeItem = envelope[2]!;
return envelopeItem.transaction === 'GET /api/broken';
});

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ describe('Tracing HTTP', () => {

expect(sentryTransactionEnvelope).toBeDefined();

const envelopeItem = sentryTransactionEnvelope![2];
const envelopeItem = sentryTransactionEnvelope![2]!;

expect(envelopeItem).toMatchObject({
contexts: {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ describe('getInitialProps', () => {
});

const sentryTransactionEnvelope = envelopes.find(envelope => {
const envelopeItem = envelope[2];
const envelopeItem = envelope[2]!;
return envelopeItem.transaction === `/[id]/withInitialProps`;
});

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ describe('getServerSideProps', () => {
});

const sentryTransactionEnvelope = envelopes.find(envelope => {
const envelopeItem = envelope[2];
const envelopeItem = envelope[2]!;
return envelopeItem.transaction === '/[id]/withServerSideProps';
});

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ describe('tracingServerGetServerSidePropsCustomPageExtension', () => {
});

const sentryTransactionEnvelope = envelopes.find(envelope => {
const envelopeItem = envelope[2];
const envelopeItem = envelope[2]!;
return envelopeItem.transaction === '/customPageExtension';
});

Expand Down
4 changes: 4 additions & 0 deletions packages/nextjs/test/integration/test/tsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"extends": "../../../tsconfig.test.json",

}
Original file line number Diff line number Diff line change
Expand Up @@ -29,16 +29,16 @@ jest.mock('next/router', () => {
eventHandlers[type] = new Set();
}

eventHandlers[type].add(handler);
eventHandlers[type]!.add(handler);
},
off: jest.fn((type: string, handler: (...args: any[]) => void) => {
if (eventHandlers[type]) {
eventHandlers[type].delete(handler);
eventHandlers[type]!.delete(handler);
}
}),
emit(type: string, ...eventArgs: any[]) {
if (eventHandlers[type]) {
eventHandlers[type].forEach(eventHandler => {
eventHandlers[type]!.forEach(eventHandler => {
eventHandler(...eventArgs);
});
}
Expand Down
4 changes: 2 additions & 2 deletions packages/nextjs/test/serverSdk.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ describe('Server init()', () => {
it('adds default integrations', () => {
init({});

const nodeInitOptions = nodeInit.mock.calls[0][0] as ModifiedInitOptions;
const nodeInitOptions = nodeInit.mock.calls[0]?.[0] as ModifiedInitOptions;
const integrationNames = nodeInitOptions.defaultIntegrations.map(integration => integration.name);
const onUncaughtExceptionIntegration = findIntegrationByName(
nodeInitOptions.defaultIntegrations,
Expand All @@ -106,7 +106,7 @@ describe('Server init()', () => {
it('supports passing unrelated integrations through options', () => {
init({ integrations: [SentryNode.consoleIntegration()] });

const nodeInitOptions = nodeInit.mock.calls[0][0] as ModifiedInitOptions;
const nodeInitOptions = nodeInit.mock.calls[0]?.[0] as ModifiedInitOptions;
const consoleIntegration = findIntegrationByName(nodeInitOptions.integrations, 'Console');

expect(consoleIntegration).toBeDefined();
Expand Down

0 comments on commit 3eda481

Please sign in to comment.