Skip to content

Commit

Permalink
feature(follow-users):Improve follow user tests[Finishes #167313409]
Browse files Browse the repository at this point in the history
  • Loading branch information
Noah Kalyesubula authored and Noah Kalyesubula committed Aug 15, 2019
1 parent 922e848 commit 75ef00e
Showing 1 changed file with 26 additions and 0 deletions.
26 changes: 26 additions & 0 deletions test/test-follow.js
Original file line number Diff line number Diff line change
Expand Up @@ -83,4 +83,30 @@ describe('test for following and unfollowing a user', () => {
done();
});
});
it('test for a non existing user ', (done) => {
chai.request(server)
.post('/api/v1/users/profiles/199990/follow')
.send({})
.set('Authorization', usertoken)
.end((error, res) => {
expect(res.status).to.equal(404);
expect(res.body).to.be.an('object');
expect(res.body).to.have.property('message');
expect(res.body.message).to.contain('user does not exist');
done();
});
});
it('test for user not being able to follow himself', (done) => {
chai.request(server)
.post('/api/v1/users/profiles/3/follow')
.send({})
.set('Authorization', usertoken)
.end((error, res) => {
expect(res.status).to.equal(400);
expect(res.body).to.be.an('object');
expect(res.body).to.have.property('message');
expect(res.body.message).to.contain('You cannot follow yourself');
done();
});
});
});

0 comments on commit 75ef00e

Please sign in to comment.