March 2018
Intermediate to advanced
592 pages
13h 44m
English
I'm going to add a describe block, which is going to describe the GET /todos route, passing in our arrow function, and then we can add our single test case, it('should get all todos', ). Now, in this case, all todos refer to the two Todos we just added previously. I'm going to pass in an arrow function with the done argument and we are good to go. All we have to do is start the super test request—I'm going to request something on the express application—this is going to be a GET request so we'll call .get, passing in the URL /todos:
describe('GET /todos', () => {
it('should get all todos', (done) => {
request(app)
.get('/todos')
)};
});
With this in place, we're now ready to make our assertions; we're ...