We're going to expect that a 200 comes back and we're also going to create a custom assertion, expecting something about the body. We'll provide our callback function with the response and we're going to expect that res.body.todos has a length of 2, .toBe(2). Now that we have this in place, all we have to do is tack on an end call, and pass in done as the argument.
describe('GET /todos', () => {
it('should get all todos', (done) => {
request(app)
.get('/todos')
.expect(200)
.expect((res) => {
expect(res.body.todos.length).toBe(2);
})
.end(done);
)};
});
There is no need to provide a function to end, because we're not doing anything asynchronously.
With this in place, we are now good to go. We can save the server.test file. This is going to rerun the test suite using nodemon; we should see our new test and it should be passing. In the Terminal, we get just that:

We have our section for POST /todos; both of these tests are passing and we have our section for GET /todos, and the one test is indeed passing. Now if I change the status to 201, the test is going to fail because that's not the status that came back. If I change the length to 3, it's going to fail because we only added 2 Todos in as the seed data.
Now that we're done, let's go ahead and make a commit, saving this code. I'm going to shut down the test-watch script, run a git status command, and we have two modified files, which means I can use git commit with the -a flag and the -m flag. Remember, the -a flag adds modified files to the next commit. A good message for this commit is going to be Add tests for GET /todos:
git commit -a -m 'Add tests for GET /todos'
I'm going to make the commit, push it up to GitHub, and then we are done.