Last active
December 18, 2019 18:15
-
-
Save hellotunmbi/b3e6b8b9ca3566c8140659fdb6d71a8c to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// movies.spec.js | |
... | |
// Testing the POST /movies endpoint | |
it("tests the post new movies endpoint and returns as success message", async () => { | |
const response = await supertest(app).post('/movies').send({ | |
title: 'New Movie', | |
synopsis: 'Synopsis of the new movie', | |
rating: 'PG' | |
}); | |
expect(response.status).toBe(200); | |
expect(response.body.status).toBe('success'); | |
expect(response.body.message).toBe('Movies Saved Successfully.'); | |
}); | |
// This is run after | |
afterEach(async () => { | |
await Movies.deleteOne({ | |
title: 'New Movie' | |
}) | |
}) | |
... |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment