File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -18,40 +18,17 @@ afterAll(() => {
1818} ) ;
1919
2020describe ( '🧪 Express Application' , ( ) => {
21- describe ( 'Root' , ( ) => {
22- describe ( 'GET /api' , ( ) => {
23- it ( '200: should return a successful response' , ( ) => {
24- return request ( app )
25- . get ( '/api' )
26- . expect ( 200 )
27- . then ( ( { body } ) => {
28- expect ( body ) . toEqual ( {
29- success : true ,
30- } ) ;
21+ describe ( 'GET /api' , ( ) => {
22+ it ( '200: should return a successful response' , ( ) => {
23+ return request ( app )
24+ . get ( '/api' )
25+ . expect ( 200 )
26+ . then ( ( { body } ) => {
27+ expect ( body ) . toEqual ( {
28+ success : true ,
29+ data : expect . any ( Object ) ,
3130 } ) ;
32- } ) ;
33- } ) ;
34-
35- describe ( 'GET /api/endpoints' , ( ) => {
36- const expectedData = { } ;
37- endpointsJson . forEach ( ( endpoint ) => {
38- const copy = JSON . parse ( JSON . stringify ( endpoint ) ) ;
39- delete copy . path ;
40- Object . assign ( expectedData , {
41- [ endpoint . path ] : {
42- ...copy ,
43- } ,
4431 } ) ;
45- } ) ;
46- it ( '200: should return a successful response' , ( ) => {
47- return request ( app )
48- . get ( '/api/endpoints' )
49- . expect ( 200 )
50- . then ( ( { body : { success, data } } ) => {
51- expect ( success ) . toBe ( true ) ;
52- expect ( data ) . toEqual ( expectedData ) ;
53- } ) ;
54- } ) ;
5532 } ) ;
5633 } ) ;
5734
You can’t perform that action at this time.
0 commit comments