aboutsummaryrefslogtreecommitdiff
path: root/test/js/third_party/jsonwebtoken/noTimestamp.test.js
blob: 22a61b3ebdd048cba3e43f479983bf9b68a6543d (plain) (blame)
1
2
3
4
5
6
7
8
9
10
import jwt from "jsonwebtoken";
import { expect, describe, it } from "bun:test";

describe("noTimestamp", function () {
  it("should work with string", function () {
    var token = jwt.sign({ foo: 123 }, "123", { expiresIn: "5m", noTimestamp: true });
    var result = jwt.verify(token, "123");
    expect(result.exp).toBeCloseTo(Math.floor(Date.now() / 1000) + 5 * 60, 0.5);
  });
});