Skip to content

Commit 94ec0f2

Browse files
committed
fix tests
1 parent 5ae3c07 commit 94ec0f2

7 files changed

Lines changed: 9 additions & 26 deletions

File tree

dev-packages/e2e-tests/test-applications/nextjs-14/tests/generation-functions.test.ts

Lines changed: 0 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -125,20 +125,3 @@ test('Should send a transaction event with correct status for a generateMetadata
125125

126126
expect((await transactionPromise).contexts?.trace?.status).toBe('ok');
127127
});
128-
129-
test('Should send a transaction event with correct status for a generateMetadata() function invocation with notfound()', async ({
130-
page,
131-
}) => {
132-
const testTitle = 'notfound-foobar';
133-
134-
const transactionPromise = waitForTransaction('nextjs-14', async transactionEvent => {
135-
return (
136-
transactionEvent.contexts?.trace?.data?.['http.target'] ===
137-
`/generation-functions/with-notfound?metadataTitle=${testTitle}`
138-
);
139-
});
140-
141-
await page.goto(`/generation-functions/with-notfound?metadataTitle=${testTitle}`);
142-
143-
expect((await transactionPromise).contexts?.trace?.status).toBe('not_found');
144-
});

dev-packages/e2e-tests/test-applications/nextjs-app-dir/app/route-handlers/[param]/route.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,5 +5,5 @@ export async function GET() {
55
}
66

77
export async function POST() {
8-
return NextResponse.json({ name: 'John Doe' }, { status: 404 });
8+
return NextResponse.json({ name: 'John Doe' }, { status: 403 });
99
}

dev-packages/e2e-tests/test-applications/nextjs-app-dir/tests/route-handlers.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ test('Should create a transaction for route handlers and correctly set span stat
2828

2929
const routehandlerTransaction = await routehandlerTransactionPromise;
3030

31-
expect(routehandlerTransaction.contexts?.trace?.status).toBe('not_found');
31+
expect(routehandlerTransaction.contexts?.trace?.status).toBe('permission_denied');
3232
expect(routehandlerTransaction.contexts?.trace?.op).toBe('http.server');
3333
});
3434

dev-packages/e2e-tests/test-applications/node-express/src/app.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -123,8 +123,8 @@ export const appRouter = t.router({
123123
.mutation(() => {
124124
throw new Error('I crashed in a trpc handler');
125125
}),
126-
dontFindSomething: procedure.mutation(() => {
127-
throw new TRPCError({ code: 'NOT_FOUND', cause: new Error('Page not found') });
126+
unauthorized: procedure.mutation(() => {
127+
throw new TRPCError({ code: 'UNAUTHORIZED', cause: new Error('Unauthorized') });
128128
}),
129129
});
130130

dev-packages/e2e-tests/test-applications/node-express/tests/trpc.test.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -109,12 +109,12 @@ test('Should record transaction and error for a trpc handler that returns a stat
109109
const transactionEventPromise = waitForTransaction('node-express', transactionEvent => {
110110
return (
111111
transactionEvent.transaction === 'POST /trpc' &&
112-
!!transactionEvent.spans?.find(span => span.description === 'trpc/dontFindSomething')
112+
!!transactionEvent.spans?.find(span => span.description === 'trpc/unauthorized')
113113
);
114114
});
115115

116116
const errorEventPromise = waitForError('node-express', errorEvent => {
117-
return !!errorEvent?.exception?.values?.some(exception => exception.value?.includes('Page not found'));
117+
return !!errorEvent?.exception?.values?.some(exception => exception.value?.includes('Unauthorized'));
118118
});
119119

120120
const trpcClient = createTRPCProxyClient<AppRouter>({
@@ -125,7 +125,7 @@ test('Should record transaction and error for a trpc handler that returns a stat
125125
],
126126
});
127127

128-
await expect(trpcClient.dontFindSomething.mutate()).rejects.toBeDefined();
128+
await expect(trpcClient.unauthorized.mutate()).rejects.toBeDefined();
129129

130130
await expect(transactionEventPromise).resolves.toBeDefined();
131131
await expect(errorEventPromise).resolves.toBeDefined();

dev-packages/e2e-tests/test-applications/node-hapi/src/app.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@ const init = async () => {
102102
const path = request.route.path;
103103

104104
if (path.includes('boom-4xx')) {
105-
throw Boom.notFound('4xx not found (onPreResponse)');
105+
throw Boom.badRequest('4xx bad request (onPreResponse)');
106106
} else if (path.includes('boom-5xx')) {
107107
throw Boom.gatewayTimeout('5xx not implemented (onPreResponse)');
108108
} else if (path.includes('JS-error-onPreResponse')) {

dev-packages/e2e-tests/test-applications/node-hapi/tests/errors.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ test('Does not send errors to Sentry if boom throws in "onPreResponse" after JS
7777
const response4xx = await fetch(`${baseURL}/test-failure-boom-4xx`);
7878
const response5xx = await fetch(`${baseURL}/test-failure-boom-5xx`);
7979

80-
expect(response4xx.status).toBe(404);
80+
expect(response4xx.status).toBe(400);
8181
expect(response5xx.status).toBe(504);
8282

8383
const transactionEvent4xx = await transactionEventPromise4xx;

0 commit comments

Comments
 (0)