Skip to content

Commit

Permalink
Add JWT test
Browse files Browse the repository at this point in the history
  • Loading branch information
kunalkapadia committed Feb 18, 2017
1 parent 2f43830 commit 9ceb619
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions server/tests/auth.test.js
Expand Up @@ -63,6 +63,18 @@ describe('## Auth APIs', () => {
.catch(done);
});

it('should fail to get random number because of wrong token', (done) => {
request(app)
.get('/api/auth/random-number')
.set('Authorization', 'Bearer inValidToken')
.expect(httpStatus.UNAUTHORIZED)
.then((res) => {
expect(res.body.message).to.equal('Unauthorized');
done();
})
.catch(done);
});

it('should get a random number', (done) => {
request(app)
.get('/api/auth/random-number')
Expand Down

0 comments on commit 9ceb619

Please sign in to comment.