Skip to content

Instantly share code, notes, and snippets.

@kayroy247
Last active March 20, 2019 16:17
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kayroy247/cb3ccf70e79e6c8e903044bf984f2980 to your computer and use it in GitHub Desktop.
Save kayroy247/cb3ccf70e79e6c8e903044bf984f2980 to your computer and use it in GitHub Desktop.
Author's Haven Signup Test Demo
describe('Test User Registration', () => {
it('Should register a user and return user object', (done) => {
const user = {
username: 'kaykay',
email: 'kayode.okunlade@andela.com',
password: 'itsasecret'
};
request(app)
.post('api/users')
.send(user)
.end((err, res) => {
expect(res).to.have.status(201);
expect(res.body).to.be.an('object');
expect(res.body).to.have.property('user');
expect(res.body.user).to.have.property('username')
.to.be.equal('kaykay');
expect(res.body.user).to.have.property('email')
.to.be.equal('kayode.okunlade@andela.com');
expect(res.body.user).to.have.property('password')
.to.be.equal('itsasecret');
});
done();
});
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment