Skip to content

Instantly share code, notes, and snippets.

@frostyblok
Last active November 22, 2018 12:23
Show Gist options
  • Save frostyblok/0e764ef07adc29101e91c5b8d5cffb5b to your computer and use it in GitHub Desktop.
Save frostyblok/0e764ef07adc29101e91c5b8d5cffb5b to your computer and use it in GitHub Desktop.
import chai from 'chai';
import chaiHttp from 'chai-http';
import app from '../../../server';
import data from '../model/ariticles';
describe('Get no article', () => {
it('should not get an article that does not exit', async () => {
const res = await chai.request(app)
.get('/api/v1/articles/234');
expect(res.body.status).to.be.equal(404);
expect(res.body.message).to.be.deep.equals('Article not found');
});
});
@frostyblok
Copy link
Author

This test is for a GET request. It tests for an article with unknown Id and ensures the appropriate status code is displayed.

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