You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

19 lines
701 B

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