File tree Expand file tree Collapse file tree
dev-packages/e2e-tests/test-applications
app/route-handlers/[param] Expand file tree Collapse file tree Original file line number Diff line number Diff 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- } ) ;
Original file line number Diff line number Diff line change @@ -5,5 +5,5 @@ export async function GET() {
55}
66
77export async function POST ( ) {
8- return NextResponse . json ( { name : 'John Doe' } , { status : 404 } ) ;
8+ return NextResponse . json ( { name : 'John Doe' } , { status : 403 } ) ;
99}
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
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
Original file line number Diff line number Diff 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
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
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 ( ) ;
Original file line number Diff line number Diff 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' ) ) {
Original file line number Diff line number Diff 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 ;
You can’t perform that action at this time.
0 commit comments