Skip to content

Commit 793a4b5

Browse files
author
Luca Forstner
committed
Delete tests that have become redundant
1 parent 75f9a6e commit 793a4b5

File tree

2 files changed

+1
-74
lines changed

2 files changed

+1
-74
lines changed

packages/nextjs/test/edge/edgeWrapperUtils.test.ts

Lines changed: 0 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
import * as coreSdk from '@sentry/core';
2-
import { SEMANTIC_ATTRIBUTE_SENTRY_SOURCE } from '@sentry/core';
32

43
import { withEdgeWrapping } from '../../src/common/utils/edgeWrapperUtils';
54

@@ -61,38 +60,6 @@ describe('withEdgeWrapping', () => {
6160
expect(captureExceptionSpy).toHaveBeenCalledTimes(1);
6261
});
6362

64-
it('should return a function that calls trace', async () => {
65-
const startSpanSpy = jest.spyOn(coreSdk, 'startSpan');
66-
67-
const request = new Request('https://sentry.io/');
68-
const origFunction = jest.fn(_req => new Response());
69-
70-
const wrappedFunction = withEdgeWrapping(origFunction, {
71-
spanDescription: 'some label',
72-
mechanismFunctionName: 'some name',
73-
spanOp: 'some op',
74-
});
75-
76-
await wrappedFunction(request);
77-
78-
expect(startSpanSpy).toHaveBeenCalledTimes(1);
79-
expect(startSpanSpy).toHaveBeenCalledWith(
80-
expect.objectContaining({
81-
attributes: {
82-
[SEMANTIC_ATTRIBUTE_SENTRY_SOURCE]: 'route',
83-
[coreSdk.SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.function.nextjs.withEdgeWrapping',
84-
},
85-
name: 'some label',
86-
op: 'some op',
87-
}),
88-
expect.any(Function),
89-
);
90-
91-
expect(coreSdk.getIsolationScope().getScopeData().sdkProcessingMetadata).toEqual({
92-
request: { headers: {} },
93-
});
94-
});
95-
9663
it("should return a function that doesn't crash when req isn't passed", async () => {
9764
const origFunctionReturnValue = new Response();
9865
const origFunction = jest.fn(() => origFunctionReturnValue);
Lines changed: 1 addition & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,3 @@
1-
import * as coreSdk from '@sentry/core';
2-
import { SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN, SEMANTIC_ATTRIBUTE_SENTRY_SOURCE } from '@sentry/core';
3-
41
import { wrapApiHandlerWithSentry } from '../../src/edge';
52

63
const origRequest = global.Request;
@@ -31,53 +28,16 @@ afterAll(() => {
3128
global.Response = origResponse;
3229
});
3330

34-
const startSpanSpy = jest.spyOn(coreSdk, 'startSpan');
35-
3631
afterEach(() => {
3732
jest.clearAllMocks();
3833
});
3934

4035
describe('wrapApiHandlerWithSentry', () => {
41-
it('should return a function that calls trace', async () => {
42-
const request = new Request('https://sentry.io/');
43-
const origFunction = jest.fn(_req => new Response());
44-
45-
const wrappedFunction = wrapApiHandlerWithSentry(origFunction, '/user/[userId]/post/[postId]');
46-
47-
await wrappedFunction(request);
48-
49-
expect(startSpanSpy).toHaveBeenCalledTimes(1);
50-
expect(startSpanSpy).toHaveBeenCalledWith(
51-
expect.objectContaining({
52-
attributes: {
53-
[SEMANTIC_ATTRIBUTE_SENTRY_SOURCE]: 'route',
54-
[SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.function.nextjs.withEdgeWrapping',
55-
},
56-
name: 'POST /user/[userId]/post/[postId]',
57-
op: 'http.server',
58-
}),
59-
expect.any(Function),
60-
);
61-
});
62-
63-
it('should return a function that calls trace without throwing when no request is passed', async () => {
36+
it('should return a function that does not throw when no request is passed', async () => {
6437
const origFunction = jest.fn(() => new Response());
6538

6639
const wrappedFunction = wrapApiHandlerWithSentry(origFunction, '/user/[userId]/post/[postId]');
6740

6841
await wrappedFunction();
69-
70-
expect(startSpanSpy).toHaveBeenCalledTimes(1);
71-
expect(startSpanSpy).toHaveBeenCalledWith(
72-
expect.objectContaining({
73-
attributes: {
74-
[SEMANTIC_ATTRIBUTE_SENTRY_SOURCE]: 'route',
75-
[coreSdk.SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.function.nextjs.withEdgeWrapping',
76-
},
77-
name: 'handler (/user/[userId]/post/[postId])',
78-
op: 'http.server',
79-
}),
80-
expect.any(Function),
81-
);
8242
});
8343
});

0 commit comments

Comments
 (0)