Skip to content

Commit

Permalink
Merge 9cba124 into 1a85dc4
Browse files Browse the repository at this point in the history
  • Loading branch information
Oluwafayokemi committed Aug 21, 2019
2 parents 1a85dc4 + 9cba124 commit a2ba406
Showing 1 changed file with 23 additions and 0 deletions.
23 changes: 23 additions & 0 deletions src/test/test.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,29 @@ describe('POST /api/v1/auth/signup', () => {
done();
});
});

it('Should return an error if the email already exists', (done) => {
chai.request(server)
.post('/api/v1/auth/signup')
.type('form')
.send({
firstName: 'James',
lastName: 'Potter',
email: 'JeanGray@hogwarts.com',
password: 'expeliamus',
})
.end((err, res) => {
// eslint-disable-next-line no-unused-expressions
expect(err).to.be.null;
expect(res).to.has.status(400);
expect(res.body).to.be.a('object');
expect(res.body).to.haveOwnProperty('status');
expect(res.body.status).to.equal(400);
expect(res.body).to.haveOwnProperty('error');
expect(res.body.error).to.be.a('string');
done();
});
});
});
after((done) => {
UserModel.destroy({
Expand Down

0 comments on commit a2ba406

Please sign in to comment.