Files
node-jsonwebtoken/test/decoding.tests.js
T
Nicolas CognauxandEduardo Diaz e50764b070 Check payload is not null when decoded. (#444)
* Check payload is not null when decoded.
Fixed "Cannot read property 'nbf' of null"

* Condition on obj !== null for clarity

* Added test for decoding null token
2018-04-05 13:28:41 +02:00

13 lines
283 B
JavaScript

var jwt = require('../index');
var expect = require('chai').expect;
var atob = require('atob');
describe('decoding', function() {
it('should not crash when decoding a null token', function () {
var decoded = jwt.decode("null");
expect(decoded).to.equal(null);
});
});