Skip to content

Commit

Permalink
get update test working for post
Browse files Browse the repository at this point in the history
  • Loading branch information
ezy committed Jul 24, 2018
1 parent 5a2e0f2 commit 5f827c4
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions test/post/post.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,25 @@ describe('[POST] /api/posts Testing', () => {
});
});

it('should be able to update a post if logged in', (done) => {
let updatedPost = postRequest,
newTitle = faker.lorem.sentence(1);
updatedPost.postTitle = newTitle;
request(app)
.patch(`/api/posts/${postSlug}`)
.send(updatedPost)
.set('Authorization', `Bearer ${token}`)
.set('Accept', 'application/json')
.expect('Content-Type', /json/)
.expect(200)
.end((err, res) => {
expect(res.body.post).to.be.an('object');
expect(res.body.post).to.have.all.keys(postKeys);
expect(res.body.post.postSlug).to.include(changeCase.paramCase(newTitle));
done();
});
});

it('should be able to delete a post if logged in', (done) => {
request(app)
.delete(`/api/posts/${postSlug}`)
Expand Down

0 comments on commit 5f827c4

Please sign in to comment.