Skip to content

Commit 301c02f

Browse files
committed
Add second stage block to querystring builder + tests
1 parent c0f403b commit 301c02f

File tree

2 files changed

+9
-0
lines changed

2 files changed

+9
-0
lines changed

src/builders/launch-query.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,9 @@ module.exports = (request) => {
6969
if (request.query.block) {
7070
query['rocket.first_stage.cores.block'] = parseInt(request.query.block, 10);
7171
}
72+
if (request.query.second_stage_block) {
73+
query['rocket.second_stage.block'] = parseInt(request.query.second_stage_block, 10);
74+
}
7275
if (request.query.core_reuse) {
7376
query['reuse.core'] = (request.query.core_reuse === 'true');
7477
}

test/builders/launch-query.test.js

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -126,6 +126,12 @@ test('It should return launches block 4 cores', async () => {
126126
});
127127
});
128128

129+
test('It should return 11 launches with second stage block 1 cores', async () => {
130+
const response = await request(app.callback()).get('/v2/launches?block=4');
131+
expect(response.statusCode).toBe(200);
132+
expect(response.body.length).toBe(11);
133+
});
134+
129135
test('It should return launches with cap serial C113', async () => {
130136
const response = await request(app.callback()).get('/v2/launches?cap_serial=C113');
131137
expect(response.statusCode).toBe(200);

0 commit comments

Comments
 (0)