Skip to content

Commit c3ef027

Browse files
committed
Add querysting filter support for nationality + manufacturer
1 parent e5b3bda commit c3ef027

File tree

2 files changed

+28
-0
lines changed

2 files changed

+28
-0
lines changed

src/builders/launch-query.js

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -132,6 +132,14 @@ module.exports = (q) => {
132132
query['rocket.second_stage.payloads.customers'] = q.customer;
133133
}
134134

135+
if (q.nationality) {
136+
query['rocket.second_stage.payloads.nationality'] = q.nationality;
137+
}
138+
139+
if (q.manufacturer) {
140+
query['rocket.second_stage.payloads.manufacturer'] = q.manufacturer;
141+
}
142+
135143
if (q.payload_type) {
136144
query['rocket.second_stage.payloads.payload_type'] = q.payload_type;
137145
}

test/builders/launch-query.test.js

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -238,6 +238,26 @@ test('It should return launches with Bulgaria Sat customer', async () => {
238238
});
239239
});
240240

241+
test('It should return launches with Bulgaria nationality', async () => {
242+
const response = await request(app.callback()).get('/v2/launches?nationality=Bulgaria');
243+
expect(response.statusCode).toBe(200);
244+
response.body.forEach((item) => {
245+
item.rocket.second_stage.payloads.forEach((payload) => {
246+
expect(payload).toHaveProperty('nationality', 'Bulgaria');
247+
});
248+
});
249+
});
250+
251+
test('It should return launches with an SSL manufacturer', async () => {
252+
const response = await request(app.callback()).get('/v2/launches?manufacturer=SSL');
253+
expect(response.statusCode).toBe(200);
254+
response.body.forEach((item) => {
255+
item.rocket.second_stage.payloads.forEach((payload) => {
256+
expect(payload).toHaveProperty('manufacturer', 'SSL');
257+
});
258+
});
259+
});
260+
241261
test('It should return launches with Satellite payloads', async () => {
242262
const response = await request(app.callback()).get('/v2/launches?payload_type=Satellite');
243263
expect(response.statusCode).toBe(200);

0 commit comments

Comments
 (0)