aboutsummaryrefslogtreecommitdiff
path: root/test/js/third_party/jsonwebtoken/undefined_secretOrPublickey.test.js
blob: fb3f3b8d34b53051efc36bd94bbc0015f9c9b964 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
import jwt from "jsonwebtoken";
import { expect, describe, it } from "bun:test";

var TOKEN = "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.e30.t-IDcSemACt8x4iTMCda8Yhe3iZaWbvV5XKSTbuAn0M";

describe("verifying without specified secret or public key", function () {
  it("should not verify null", function () {
    expect(function () {
      jwt.verify(TOKEN, null);
    }).toThrow(/secret or public key must be provided/);
  });

  it("should not verify undefined", function () {
    expect(function () {
      jwt.verify(TOKEN);
    }).toThrow(/secret or public key must be provided/);
  });
});