mirror of
https://github.com/hanzoai/node-jsonwebtoken.git
synced 2026-09-24 17:00:48 +00:00
* Add extension to ESLint config file The .eslintrc file without an extension was deprecated a few years ago, so this change renames the file to add the required extension. See: https://github.com/eslint/eslint/commit/c9a8883d450d63a8d044a9e66d275f5b1973a3ba * Add ESLint to package.json This change adds ESLint as a dev-dependency and adds a lint script that will run ESLint. * Complete switch from JSHint to ESLint Convert all the JSHint rules to the ESLint equivalents where possible. The no-undef rule in ESLint caught a few cases of undefined usages in the tests, so they were also fixed. * Add a .eslintignore file The HTML coverage report is currently being linted, which causes a lot if invalid linting errors. This change adds a ignore file to ensure these files are properly skipped during linting.
42 lines
1.0 KiB
JavaScript
42 lines
1.0 KiB
JavaScript
var jwt = require('../index');
|
|
var expect = require('chai').expect;
|
|
|
|
describe('issue 304 - verifying values other than strings', function() {
|
|
|
|
it('should fail with numbers', function (done) {
|
|
jwt.verify(123, 'foo', function (err) {
|
|
expect(err.name).to.equal('JsonWebTokenError');
|
|
done();
|
|
});
|
|
});
|
|
|
|
it('should fail with objects', function (done) {
|
|
jwt.verify({ foo: 'bar' }, 'biz', function (err) {
|
|
expect(err.name).to.equal('JsonWebTokenError');
|
|
done();
|
|
});
|
|
});
|
|
|
|
it('should fail with arrays', function (done) {
|
|
jwt.verify(['foo'], 'bar', function (err) {
|
|
expect(err.name).to.equal('JsonWebTokenError');
|
|
done();
|
|
});
|
|
});
|
|
|
|
it('should fail with functions', function (done) {
|
|
jwt.verify(function() {}, 'foo', function (err) {
|
|
expect(err.name).to.equal('JsonWebTokenError');
|
|
done();
|
|
});
|
|
});
|
|
|
|
it('should fail with booleans', function (done) {
|
|
jwt.verify(true, 'foo', function (err) {
|
|
expect(err.name).to.equal('JsonWebTokenError');
|
|
done();
|
|
});
|
|
});
|
|
|
|
});
|