Skip to content

Commit c1b8fb0

Browse files
committed
added test for v2 launches
1 parent 5868bb1 commit c1b8fb0

File tree

1 file changed

+49
-0
lines changed

1 file changed

+49
-0
lines changed

test/v1-all.test.js

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -483,6 +483,55 @@ test("It should return all past RTLS launches", () => {
483483
})
484484
})
485485

486+
//------------------------------------------------------------
487+
// Past Launches V2
488+
//------------------------------------------------------------
489+
490+
test("It should return all past launches", () => {
491+
return request(app).get("/v2/launches").then(response => {
492+
expect(response.statusCode).toBe(200)
493+
response.body.forEach(item => {
494+
expect(item).toHaveProperty("flight_number", expect.anything())
495+
expect(item).toHaveProperty("launch_year", expect.stringMatching(/^[0-9]{4}$/))
496+
expect(item).toHaveProperty("launch_date_unix")
497+
expect(item).toHaveProperty("launch_date_utc", expect.anything())
498+
expect(item).toHaveProperty("launch_date_local", expect.anything())
499+
expect(item).toHaveProperty("rocket.rocket_id")
500+
expect(item).toHaveProperty("rocket.rocket_name")
501+
expect(item).toHaveProperty("rocket.rocket_type")
502+
expect(item.rocket.first_stage.cores.length).toBeGreaterThan(0)
503+
item.rocket.first_stage.cores.forEach(core => {
504+
expect(core).toHaveProperty("core_serial")
505+
expect(core).toHaveProperty("reused")
506+
expect(core).toHaveProperty("land_success")
507+
expect(core).toHaveProperty("landing_type")
508+
expect(core).toHaveProperty("landing_vehicle")
509+
})
510+
expect(item.rocket.second_stage.payloads.length).toBeGreaterThan(0)
511+
item.rocket.second_stage.payloads.forEach(payload => {
512+
expect(payload).toHaveProperty("payload_id")
513+
expect(payload).toHaveProperty("reused")
514+
expect(payload.customers.length).toBeGreaterThan(0)
515+
expect(payload).toHaveProperty("payload_mass_kg")
516+
expect(payload).toHaveProperty("payload_mass_lbs")
517+
expect(payload).toHaveProperty("orbit")
518+
})
519+
expect(item).toHaveProperty("telemetry.flight_club")
520+
expect(item).toHaveProperty("reuse.core")
521+
expect(item).toHaveProperty("reuse.side_core1")
522+
expect(item).toHaveProperty("reuse.side_core2")
523+
expect(item).toHaveProperty("reuse.fairings")
524+
expect(item).toHaveProperty("reuse.capsule")
525+
expect(item).toHaveProperty("launch_site.site_id")
526+
expect(item).toHaveProperty("launch_site.site_name")
527+
expect(item).toHaveProperty("launch_site.site_name_long")
528+
expect(item).toHaveProperty("launch_success")
529+
expect(item).toHaveProperty("links")
530+
expect(item).toHaveProperty("details")
531+
})
532+
})
533+
})
534+
486535
//------------------------------------------------------------
487536
// Upcoming Launches
488537
//------------------------------------------------------------

0 commit comments

Comments
 (0)