Skip to content

Commit 329d632

Browse files
committed
Add querysting filter support for NORAD id's
1 parent 34fb615 commit 329d632

File tree

2 files changed

+14
-0
lines changed

2 files changed

+14
-0
lines changed

src/builders/launch-query.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -128,6 +128,10 @@ module.exports = (q) => {
128128
query['rocket.second_stage.payloads.payload_id'] = q.payload_id;
129129
}
130130

131+
if (q.norad_id) {
132+
query['rocket.second_stage.payloads.norad_id'] = parseInt(q.norad_id, 10);
133+
}
134+
131135
if (q.customer) {
132136
query['rocket.second_stage.payloads.customers'] = q.customer;
133137
}

test/builders/launch-query.test.js

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -226,6 +226,16 @@ test('It should return launch of BulgariaSat-1', async () => {
226226
});
227227
});
228228

229+
test('It should return Iridium NEXT 7 with the correct NORAD id', async () => {
230+
const response = await request(app.callback()).get('/v2/launches?norad_id=43571');
231+
expect(response.statusCode).toBe(200);
232+
response.body.forEach((item) => {
233+
item.rocket.second_stage.payloads.forEach((payload) => {
234+
expect(payload).toHaveProperty('payload_id', 'Iridium NEXT 7');
235+
});
236+
});
237+
});
238+
229239
test('It should return launches with Bulgaria Sat customer', async () => {
230240
const response = await request(app.callback()).get('/v2/launches?customer=Bulgaria+Sat');
231241
expect(response.statusCode).toBe(200);

0 commit comments

Comments
 (0)