Created
February 3, 2019 20:33
-
-
Save espoirMur/66cf399d0d74e130ae43d151bc4bb944 to your computer and use it in GitHub Desktop.
Test for rating a given article
This file contains 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
const canRate = done => { | |
request(app) | |
.post(`/api/v1/post/${post.id}/rating`) | |
.set('Authorization', `Bearer ${user.token}`) | |
.send({ userId: user.id, postId: post.id, rating: 4 }) | |
.end((err, res) => { | |
expect(res.status).toBe(201); | |
expect(res.body.rating).toBeDefined(); | |
ratingId = res.body.rating.id; | |
expect(res.body.message).toBe('Post rated successfully'); | |
done(); | |
}); | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment