Skip to content

Instantly share code, notes, and snippets.

@Oloyedesinmiloluwa
Last active July 24, 2018 15:02
Show Gist options
  • Save Oloyedesinmiloluwa/766266129741ecf68bf4957b6227f7ff to your computer and use it in GitHub Desktop.
Save Oloyedesinmiloluwa/766266129741ecf68bf4957b6227f7ff to your computer and use it in GitHub Desktop.
Fargo Team TDD activity - Sinmiloluwa
// Test for creating an Article
describe('POST ARTICLE', () => {
it('It should not create article if description is missing', (done) => {
chai.request(userRoute)
.post('/api/articles')
.send({
title: 'First Article', description: '', body: 'This is the first article so you should not expect a full article but gibberish'
})
.end((err, res) => {
res.should.have.status(400);
res.body.errors[0].should.be.eql('Description field cannot be empty');
done();
});
});
@anneKay
Copy link

anneKay commented Jul 24, 2018

Clear and concise test structure, good job testing for that edge case when posting an article

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