Skip to content

Commit 6f05b62

Browse files
committed
Add limit builder tests
1 parent 79cdcd8 commit 6f05b62

File tree

1 file changed

+25
-0
lines changed

1 file changed

+25
-0
lines changed

test/builders/limit-query.test.js

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
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+
// Limit Query Test
13+
//------------------------------------------------------------
14+
15+
test('It should return all launches with a limit of zero', async () => {
16+
const response = await request(app.callback()).get('/v2/launches?limit=0');
17+
expect(response.statusCode).toBe(200);
18+
expect(response.body.length).toBeGreaterThan(0);
19+
});
20+
21+
test('It should return only the first five launches', async () => {
22+
const response = await request(app.callback()).get('/v2/launches?limit=5');
23+
expect(response.statusCode).toBe(200);
24+
expect(response.body.length).toBe(5);
25+
});

0 commit comments

Comments
 (0)