Skip to content

Instantly share code, notes, and snippets.

@RaymondMwaura
Last active October 31, 2019 11:00
Show Gist options
  • Save RaymondMwaura/cab37aa65af6113a3c175fe98db95b9b to your computer and use it in GitHub Desktop.
Save RaymondMwaura/cab37aa65af6113a3c175fe98db95b9b to your computer and use it in GitHub Desktop.
// This test confirms if the feature that allows a user to add an article works
describe('POST /article', () => {
it('Create an article if given complete request by user', async () => {
const res = await chai.request(server)
.post('/api/v1/article')
.field('username', 'rmwaura')
.field('text', 'A very well written article')
.field('date', '2019-10-31');
expect(res.status).to.equal(200);
res.body.data.should.be.a('object');
res.body.data.should.have.property('id');
res.body.data.should.have.property('username');
res.body.should.have.property('username').eql('rmwaura');
res.body.data.should.have.property('text');
res.body.should.have.property('text').eql('A very well written article');
res.body.data.should.have.property('date');
});
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment