Skip to content

Commit a4d2709

Browse files
authored
Add JWT test (#299)
1 parent 2f43830 commit a4d2709

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

server/tests/auth.test.js

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,18 @@ describe('## Auth APIs', () => {
6363
.catch(done);
6464
});
6565

66+
it('should fail to get random number because of wrong token', (done) => {
67+
request(app)
68+
.get('/api/auth/random-number')
69+
.set('Authorization', 'Bearer inValidToken')
70+
.expect(httpStatus.UNAUTHORIZED)
71+
.then((res) => {
72+
expect(res.body.message).to.equal('Unauthorized');
73+
done();
74+
})
75+
.catch(done);
76+
});
77+
6678
it('should get a random number', (done) => {
6779
request(app)
6880
.get('/api/auth/random-number')

0 commit comments

Comments
 (0)