thoughts/node_modules/jsonwebtoken/test/undefined_secretOrPublickey.tests.js
node_modules/jsonwebtoken/test/undefined_secretOrPublickey.tests.jsRaw
1var fs = require('fs');
2var jwt = require('../index');
3var JsonWebTokenError = require('../lib/JsonWebTokenError');
4var expect = require('chai').expect;
5
6var TOKEN = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.e30.t-IDcSemACt8x4iTMCda8Yhe3iZaWbvV5XKSTbuAn0M';
7
8describe('verifying without specified secret or public key', function () {
9 it('should not verify null', function () {
10 expect(function () {
11 jwt.verify(TOKEN, null);
12 }).to.throw(JsonWebTokenError, /secret or public key must be provided/);
13 });
14
15 it('should not verify undefined', function () {
16 expect(function () {
17 jwt.verify(TOKEN);
18 }).to.throw(JsonWebTokenError, /secret or public key must be provided/);
19 });
20});