Last active
March 21, 2019 12:53
-
-
Save kayroy247/c01d254d972c759396ff3c8478d32962 to your computer and use it in GitHub Desktop.
Author's Haven Signup Test Demo
This file contains hidden or 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
describe('Test User Registration', () => { | |
it('Should register a user and return user object', (done) => { | |
const user = { | |
username: 'kaykay', | |
email: '[email protected]', | |
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('[email protected]'); | |
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
Thanks for the feedback.