File tree Expand file tree Collapse file tree 1 file changed +25
-0
lines changed Expand file tree Collapse file tree 1 file changed +25
-0
lines changed Original file line number Diff line number Diff line change 1+
2+ const request = require ( 'supertest' ) ;
3+ const app = require ( '../../src/app' ) ;
4+
5+ beforeAll ( ( done ) => {
6+ app . on ( 'ready' , ( ) => {
7+ done ( ) ;
8+ } ) ;
9+ } ) ;
10+
11+ //------------------------------------------------------------
12+ // Limit Query Test
13+ //------------------------------------------------------------
14+
15+ test ( 'It should return all launches with a limit of zero' , async ( ) => {
16+ const response = await request ( app . callback ( ) ) . get ( '/v2/launches?limit=0' ) ;
17+ expect ( response . statusCode ) . toBe ( 200 ) ;
18+ expect ( response . body . length ) . toBeGreaterThan ( 0 ) ;
19+ } ) ;
20+
21+ test ( 'It should return only the first five launches' , async ( ) => {
22+ const response = await request ( app . callback ( ) ) . get ( '/v2/launches?limit=5' ) ;
23+ expect ( response . statusCode ) . toBe ( 200 ) ;
24+ expect ( response . body . length ) . toBe ( 5 ) ;
25+ } ) ;
You can’t perform that action at this time.
0 commit comments