Last active
July 24, 2018 14:53
-
-
Save klevamane/c39b3d7ee0179d551a9edbf78256c9c1 to your computer and use it in GitHub Desktop.
Test case to delete an article
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
import app from 'location/of/app' | |
// Assume npm packages has been installed | |
import chaiHttp from 'chai-http'; | |
import chai from 'chai'; | |
import app from '../app'; | |
const { expect } = chai; | |
let adminAuthToken = res.body.someToken; | |
chai.use(chaiHttp); | |
describe('Delete an Article', () => { | |
const slug = 'a-slog-that-exist-in-the-database'; | |
it('should delete an article', (done) => { | |
chai.request(app) | |
.delete(`/api/articles/${slug)`) | |
.set('Authorization', `Bearer ${adminAuthToken}`) | |
.end((err, res ) => { | |
expect(res).to.have.status(200); | |
expect(res.body.message).to.equal('The Article has been deleted'); | |
}) | |
}); | |
}); |
Great Job! You handled the test case well, keep it up
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Excellent piece!, very well laid out. Nice work.