@@ -9,71 +9,6 @@ beforeAll((done) => {
99 } ) ;
1010} ) ;
1111
12- //------------------------------------------------------------
13- // Past Launches V2
14- //------------------------------------------------------------
15-
16- test ( 'It should return all past launches' , ( ) => {
17- return request ( app . listen ( ) ) . get ( '/v2/launches' ) . then ( ( response ) => {
18- expect ( response . statusCode ) . toBe ( 200 ) ;
19- response . body . forEach ( ( item ) => {
20- expect ( item ) . toHaveProperty ( 'flight_number' , expect . anything ( ) ) ;
21- expect ( item ) . toHaveProperty ( 'launch_year' , expect . stringMatching ( / ^ [ 0 - 9 ] { 4 } $ / ) ) ;
22- expect ( item ) . toHaveProperty ( 'launch_date_unix' ) ;
23- expect ( item ) . toHaveProperty ( 'launch_date_utc' , expect . anything ( ) ) ;
24- expect ( item ) . toHaveProperty ( 'launch_date_local' , expect . anything ( ) ) ;
25- expect ( item ) . toHaveProperty ( 'rocket.rocket_id' ) ;
26- expect ( item ) . toHaveProperty ( 'rocket.rocket_name' ) ;
27- expect ( item ) . toHaveProperty ( 'rocket.rocket_type' ) ;
28- expect ( item . rocket . first_stage . cores . length ) . toBeGreaterThan ( 0 ) ;
29- item . rocket . first_stage . cores . forEach ( ( core ) => {
30- expect ( core ) . toHaveProperty ( 'core_serial' ) ;
31- expect ( core ) . toHaveProperty ( 'reused' ) ;
32- expect ( core ) . toHaveProperty ( 'land_success' ) ;
33- expect ( core ) . toHaveProperty ( 'landing_type' ) ;
34- expect ( core ) . toHaveProperty ( 'landing_vehicle' ) ;
35- } ) ;
36- expect ( item . rocket . second_stage . payloads . length ) . toBeGreaterThan ( 0 ) ;
37- if ( item . hasOwnProperty . call ( 'cap_serial' ) ) {
38- item . rocket . second_stage . payloads . forEach ( ( payload ) => {
39- expect ( payload ) . toHaveProperty ( 'payload_id' ) ;
40- expect ( payload ) . toHaveProperty ( 'reused' ) ;
41- expect ( payload ) . toHaveProperty ( 'cap_serial' ) ;
42- expect ( payload . customers . length ) . toBeGreaterThan ( 0 ) ;
43- expect ( payload ) . toHaveProperty ( 'payload_mass_kg' ) ;
44- expect ( payload ) . toHaveProperty ( 'payload_mass_lbs' ) ;
45- expect ( payload ) . toHaveProperty ( 'orbit' ) ;
46- expect ( payload ) . toHaveProperty ( 'mass_returned_kg' ) ;
47- expect ( payload ) . toHaveProperty ( 'mass_returned_lbs' ) ;
48- expect ( payload ) . toHaveProperty ( 'flight_time_sec' ) ;
49- expect ( payload ) . toHaveProperty ( 'cargo_manifest' ) ;
50- } ) ;
51- } else {
52- item . rocket . second_stage . payloads . forEach ( ( payload ) => {
53- expect ( payload ) . toHaveProperty ( 'payload_id' ) ;
54- expect ( payload ) . toHaveProperty ( 'reused' ) ;
55- expect ( payload . customers . length ) . toBeGreaterThan ( 0 ) ;
56- expect ( payload ) . toHaveProperty ( 'payload_mass_kg' ) ;
57- expect ( payload ) . toHaveProperty ( 'payload_mass_lbs' ) ;
58- expect ( payload ) . toHaveProperty ( 'orbit' ) ;
59- } ) ;
60- }
61- expect ( item ) . toHaveProperty ( 'telemetry.flight_club' ) ;
62- expect ( item ) . toHaveProperty ( 'reuse.core' ) ;
63- expect ( item ) . toHaveProperty ( 'reuse.side_core1' ) ;
64- expect ( item ) . toHaveProperty ( 'reuse.side_core2' ) ;
65- expect ( item ) . toHaveProperty ( 'reuse.fairings' ) ;
66- expect ( item ) . toHaveProperty ( 'reuse.capsule' ) ;
67- expect ( item ) . toHaveProperty ( 'launch_site.site_id' ) ;
68- expect ( item ) . toHaveProperty ( 'launch_site.site_name' ) ;
69- expect ( item ) . toHaveProperty ( 'launch_site.site_name_long' ) ;
70- expect ( item ) . toHaveProperty ( 'launch_success' ) ;
71- expect ( item ) . toHaveProperty ( 'links' ) ;
72- expect ( item ) . toHaveProperty ( 'details' ) ;
73- } ) ;
74- } ) ;
75- } ) ;
76-
7712//------------------------------------------------------------
7813// Upcoming Launches V2
7914//------------------------------------------------------------
0 commit comments