Last active
July 23, 2018 19:36
-
-
Save ascii-dev/d8da20e4e22a4e2ac69709bc8b26d946 to your computer and use it in GitHub Desktop.
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
describe('/POST /api/articles', () => { | |
const data = { | |
title: "How to train your dragon", | |
description: "Ever wonder how?", | |
body: "You have to believe", | |
tagList: ["reactjs", "angularjs", "dragons"] | |
}; | |
it('should create a new article if required fields are entered', (done) => { | |
chai.request(app) | |
.get('/api/articles/') | |
.set('Authorization', 'Bearer theusersjwtoken') | |
.send(data) | |
.end((err, res) => { | |
res.should.have.status(201); | |
res.body.should.be.a('object'); | |
res.body.should.have.property('message').to.equals('Your request has been created successfully'); | |
done(); | |
}); | |
}); | |
}); |
Good approach! You checked if the response object contains a success message, that's good practice keep it up
Great Job!, You covered all test cases for the POST
request, Keep it up.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Nice one! You did a good coverage on the test case.