Last active
March 21, 2019 07:50
-
-
Save Joyce-O/6330205e41ff6990d492724527076f81 to your computer and use it in GitHub Desktop.
Unit test for get tags api endpoint in the medium.com website
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('Test for get tags endpoint', () => { | |
it('Should return status code 200 for success', (done) => { | |
chai.request(app) | |
.get('/api/tags') | |
.set('authorization', token) | |
.end((error, response) => { | |
expect(response).to.have.status(200); | |
done(); | |
}); | |
it('should return 404 for tags not found', (done) => { | |
chai.request(app) | |
.get('/api/tags') | |
.set('authorization', token) | |
.end((error, response) => { | |
expect(response).to.have.status(404); | |
expect(response.body.error).to.equal('tags not found'); | |
done(); | |
}); | |
}); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Good job with your test but I think you may need to improve on the following: