Skip to content

Commit 072ca80

Browse files
committed
Adjust e2e tests
1 parent f7498ce commit 072ca80

File tree

4 files changed

+7
-7
lines changed

4 files changed

+7
-7
lines changed

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: 403 });
8+
return NextResponse.json({ name: 'John Doe' }, { status: 400 });
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('permission_denied');
31+
expect(routehandlerTransaction.contexts?.trace?.status).toBe('invalid_argument');
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
@@ -143,8 +143,8 @@ export const appRouter = t.router({
143143
.mutation(() => {
144144
throw new Error('I crashed in a trpc handler');
145145
}),
146-
unauthorized: procedure.mutation(() => {
147-
throw new TRPCError({ code: 'UNAUTHORIZED', cause: new Error('Unauthorized') });
146+
badRequest: procedure.mutation(() => {
147+
throw new TRPCError({ code: 'BAD_REQUEST', cause: new Error('Bad Request') });
148148
}),
149149
});
150150

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/unauthorized')
112+
!!transactionEvent.spans?.find(span => span.description === 'trpc/badRequest')
113113
);
114114
});
115115

116116
const errorEventPromise = waitForError('node-express', errorEvent => {
117-
return !!errorEvent?.exception?.values?.some(exception => exception.value?.includes('Unauthorized'));
117+
return !!errorEvent?.exception?.values?.some(exception => exception.value?.includes('Bad Request'));
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.unauthorized.mutate()).rejects.toBeDefined();
128+
await expect(trpcClient.badRequest.mutate()).rejects.toBeDefined();
129129

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

0 commit comments

Comments
 (0)