Last active
March 21, 2019 13:06
-
-
Save Jesse-efe/74fd987c433bd09fa6a398800f4bff71 to your computer and use it in GitHub Desktop.
TDD test Spec
This file contains 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
import chai from 'chai'; | |
import chaiHttp from 'chai-http'; | |
import app from '../source/app'; | |
const { expect } = chai; | |
chai.use(chaiHttp); | |
describe('/api/v1/auth/login', () => { | |
it('should not login with invalid email', (done) => { | |
chai.request(app) | |
.post('/api/v1/auth/login') | |
.send({ | |
email: 'myemail.com', | |
password: 'mypassword', | |
}) | |
.end((err, res) => { | |
expect(res).to.be.json; | |
expect(res).to.have.status(400); | |
expect(res.body.error).to.equal('please provide a valid email'); | |
done(); | |
}); | |
}); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
The test is descriptive enough and was well written. Good job!