Last active
October 31, 2019 11:00
-
-
Save RaymondMwaura/cab37aa65af6113a3c175fe98db95b9b to your computer and use it in GitHub Desktop.
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
// 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