Skip to content

Commit ee461a1

Browse files
committed
added tests for v2 core and capsule endpoints
1 parent 7f4946f commit ee461a1

File tree

1 file changed

+42
-1
lines changed

1 file changed

+42
-1
lines changed

test/v2-all.test.js

Lines changed: 42 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -375,7 +375,7 @@ test("It should return all past launches", () => {
375375
// Upcoming Launches V2
376376
//------------------------------------------------------------
377377

378-
test("It should return all past launches", () => {
378+
test("It should return all upcoming launches", () => {
379379
return request(app.listen()).get("/v2/launches/upcoming").then(response => {
380380
expect(response.statusCode).toBe(200)
381381
response.body.forEach(item => {
@@ -435,3 +435,44 @@ test("It should return all past launches", () => {
435435
})
436436
})
437437
})
438+
439+
//------------------------------------------------------------
440+
// Capsule V2
441+
//------------------------------------------------------------
442+
443+
test("It should return all v2 capsules", () => {
444+
return request(app).get("/v2/parts/caps").then(response => {
445+
expect(response.statusCode).toBe(200)
446+
response.body.forEach(item => {
447+
expect(item).toHaveProperty("capsule_serial")
448+
expect(item).toHaveProperty("status")
449+
expect(item).toHaveProperty("original_launch")
450+
expect(item.missions.length).toBeGreaterThan(0)
451+
expect(item).toHaveProperty("landings")
452+
expect(item).toHaveProperty("type")
453+
expect(item).toHaveProperty("details")
454+
})
455+
})
456+
})
457+
458+
//------------------------------------------------------------
459+
// Core V2
460+
//------------------------------------------------------------
461+
462+
test("It should return all v2 cores", () => {
463+
return request(app).get("/v2/parts/cores").then(response => {
464+
expect(response.statusCode).toBe(200)
465+
response.body.forEach(item => {
466+
expect(item).toHaveProperty("core_serial")
467+
expect(item).toHaveProperty("status")
468+
expect(item).toHaveProperty("original_launch")
469+
expect(item.missions.length).toBeGreaterThan(0)
470+
expect(item).toHaveProperty("rtls_attempt")
471+
expect(item).toHaveProperty("rtls_landings")
472+
expect(item).toHaveProperty("asds_attempt")
473+
expect(item).toHaveProperty("asds_landings")
474+
expect(item).toHaveProperty("water_landing")
475+
expect(item).toHaveProperty("details")
476+
})
477+
})
478+
})

0 commit comments

Comments
 (0)