Skip to content

Commit 5314f99

Browse files
committed
move v2 launchpad test to unique file
1 parent 7f7c952 commit 5314f99

File tree

2 files changed

+41
-32
lines changed

2 files changed

+41
-32
lines changed

test/v2-launchpad.test.js

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
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+
// Launchpads V2
13+
//------------------------------------------------------------
14+
15+
test('It should return all launchpads', () => {
16+
return request(app).get('/v2/launchpads').then((response) => {
17+
expect(response.statusCode).toBe(200);
18+
expect(response.body).toHaveLength(8);
19+
response.body.forEach((item) => {
20+
expect(item).toHaveProperty('id');
21+
expect(item).toHaveProperty('full_name');
22+
expect(item).toHaveProperty('status');
23+
expect(item).toHaveProperty('vehicles_launched');
24+
expect(item).toHaveProperty('details');
25+
});
26+
});
27+
});
28+
29+
test('It should return LC-39A info', () => {
30+
return request(app).get('/v2/launchpads/ksc_lc_39a').then((response) => {
31+
expect(response.statusCode).toBe(200);
32+
expect(response.text).toContain('ksc_lc_39a');
33+
});
34+
});
35+
36+
test('It should return no launchpad info', () => {
37+
return request(app).get('/v2/launchpads/ksc_lc_40a').then((response) => {
38+
expect(response.statusCode).toBe(200);
39+
expect(response.text).toContain('');
40+
});
41+
});

test/v2-routes.test.js

Lines changed: 0 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -9,38 +9,6 @@ beforeAll((done) => {
99
});
1010
});
1111

12-
//------------------------------------------------------------
13-
// Launchpads V2
14-
//------------------------------------------------------------
15-
16-
test('It should return all launchpads', () => {
17-
return request(app).get('/v2/launchpads').then((response) => {
18-
expect(response.statusCode).toBe(200);
19-
expect(response.body).toHaveLength(8);
20-
response.body.forEach((item) => {
21-
expect(item).toHaveProperty('id');
22-
expect(item).toHaveProperty('full_name');
23-
expect(item).toHaveProperty('status');
24-
expect(item).toHaveProperty('vehicles_launched');
25-
expect(item).toHaveProperty('details');
26-
});
27-
});
28-
});
29-
30-
test('It should return LC-39A info', () => {
31-
return request(app).get('/v2/launchpads/ksc_lc_39a').then((response) => {
32-
expect(response.statusCode).toBe(200);
33-
expect(response.text).toContain('ksc_lc_39a');
34-
});
35-
});
36-
37-
test('It should return no launchpad info', () => {
38-
return request(app).get('/v2/launchpads/ksc_lc_40a').then((response) => {
39-
expect(response.statusCode).toBe(200);
40-
expect(response.text).toContain('');
41-
});
42-
});
43-
4412
//------------------------------------------------------------
4513
// Past Launches V2
4614
//------------------------------------------------------------

0 commit comments

Comments
 (0)