File tree Expand file tree Collapse file tree 1 file changed +24
-9
lines changed Expand file tree Collapse file tree 1 file changed +24
-9
lines changed Original file line number Diff line number Diff line change 1
- " use strict" ;
1
+ ' use strict'
2
2
3
- const { test } = require ( " tap" ) ;
4
- const { buildApp } = require ( " ../helper" ) ;
3
+ const { test } = require ( ' tap' )
4
+ const { buildApp } = require ( ' ../helper' )
5
5
6
- test ( " default root route" , async ( t ) => {
7
- const app = await buildApp ( t ) ;
6
+ test ( ' default root route' , async ( t ) => {
7
+ const app = await buildApp ( t )
8
8
9
9
const res = await app . inject ( {
10
- url : "/" ,
11
- } ) ;
12
- t . same ( JSON . parse ( res . payload ) , { root : true } ) ;
13
- } ) ;
10
+ url : '/' ,
11
+ } )
12
+ t . same ( JSON . parse ( res . payload ) , { root : true } )
13
+ } )
14
+
15
+ test ( 'non-existent route returns 404' , async ( t ) => {
16
+ const app = await buildApp ( t )
17
+
18
+ const res = await app . inject ( {
19
+ url : '/non-existent' ,
20
+ } )
21
+ t . equal ( res . statusCode , 404 )
22
+ t . same ( JSON . parse ( res . payload ) , {
23
+ statusCode : 404 ,
24
+ error : 'Not Found' ,
25
+ message : 'The requested resource could not be found' ,
26
+ requestId : JSON . parse ( res . payload ) . requestId ,
27
+ } )
28
+ } )
You can’t perform that action at this time.
0 commit comments