Skip to content

Commit

Permalink
added test for launch sort builder
Browse files Browse the repository at this point in the history
  • Loading branch information
jakewmeyer committed Feb 12, 2018
1 parent f09b3b1 commit 21c8425
Showing 1 changed file with 27 additions and 0 deletions.
27 changes: 27 additions & 0 deletions test/builders/launch-sort.test.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@

const request = require('supertest');
const app = require('../../src/app');

beforeAll((done) => {
app.on('ready', () => {
done();
});
});

//------------------------------------------------------------
// Launch Sort Test
//------------------------------------------------------------

test('It should return launches sorted from smallest to greatest', () => {
return request(app).get('/v2/launches?order=asc').then((response) => {
expect(response.statusCode).toBe(200);
expect(response.body[0]).toHaveProperty('flight_number', 1);
});
});

test('It should return launches sorted from greatest to smallest', () => {
return request(app).get('/v2/launches?order=desc').then((response) => {
expect(response.statusCode).toBe(200);
expect(response.body[response.body.length - 1]).toHaveProperty('flight_number', 1);
});
});

0 comments on commit 21c8425

Please sign in to comment.