File tree Expand file tree Collapse file tree 4 files changed +7
-7
lines changed
dev-packages/e2e-tests/test-applications
app/route-handlers/[param] Expand file tree Collapse file tree 4 files changed +7
-7
lines changed Original file line number Diff line number Diff line change @@ -5,5 +5,5 @@ export async function GET() {
5
5
}
6
6
7
7
export async function POST ( ) {
8
- return NextResponse . json ( { name : 'John Doe' } , { status : 403 } ) ;
8
+ return NextResponse . json ( { name : 'John Doe' } , { status : 400 } ) ;
9
9
}
Original file line number Diff line number Diff line change @@ -28,7 +28,7 @@ test('Should create a transaction for route handlers and correctly set span stat
28
28
29
29
const routehandlerTransaction = await routehandlerTransactionPromise ;
30
30
31
- expect ( routehandlerTransaction . contexts ?. trace ?. status ) . toBe ( 'permission_denied ' ) ;
31
+ expect ( routehandlerTransaction . contexts ?. trace ?. status ) . toBe ( 'invalid_argument ' ) ;
32
32
expect ( routehandlerTransaction . contexts ?. trace ?. op ) . toBe ( 'http.server' ) ;
33
33
} ) ;
34
34
Original file line number Diff line number Diff line change @@ -143,8 +143,8 @@ export const appRouter = t.router({
143
143
. mutation ( ( ) => {
144
144
throw new Error ( 'I crashed in a trpc handler' ) ;
145
145
} ) ,
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 ' ) } ) ;
148
148
} ) ,
149
149
} ) ;
150
150
Original file line number Diff line number Diff line change @@ -109,12 +109,12 @@ test('Should record transaction and error for a trpc handler that returns a stat
109
109
const transactionEventPromise = waitForTransaction ( 'node-express' , transactionEvent => {
110
110
return (
111
111
transactionEvent . transaction === 'POST /trpc' &&
112
- ! ! transactionEvent . spans ?. find ( span => span . description === 'trpc/unauthorized ' )
112
+ ! ! transactionEvent . spans ?. find ( span => span . description === 'trpc/badRequest ' )
113
113
) ;
114
114
} ) ;
115
115
116
116
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 ' ) ) ;
118
118
} ) ;
119
119
120
120
const trpcClient = createTRPCProxyClient < AppRouter > ( {
@@ -125,7 +125,7 @@ test('Should record transaction and error for a trpc handler that returns a stat
125
125
] ,
126
126
} ) ;
127
127
128
- await expect ( trpcClient . unauthorized . mutate ( ) ) . rejects . toBeDefined ( ) ;
128
+ await expect ( trpcClient . badRequest . mutate ( ) ) . rejects . toBeDefined ( ) ;
129
129
130
130
await expect ( transactionEventPromise ) . resolves . toBeDefined ( ) ;
131
131
await expect ( errorEventPromise ) . resolves . toBeDefined ( ) ;
You can’t perform that action at this time.
0 commit comments