Skip to content

Instantly share code, notes, and snippets.

@Jesse-efe
Last active March 21, 2019 13:06
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 Jesse-efe/74fd987c433bd09fa6a398800f4bff71 to your computer and use it in GitHub Desktop.
Save Jesse-efe/74fd987c433bd09fa6a398800f4bff71 to your computer and use it in GitHub Desktop.
TDD test Spec
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();
});
});
});
@Bobjayafam
Copy link

The test is descriptive enough and was well written. Good job!

@Jesse-efe
Copy link
Author

thank you

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment