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

describe("issue 147 - signing with a sealed payload", function () {
  it("should put the expiration claim", function () {
    var token = jwt.sign(Object.seal({ foo: 123 }), "123", { expiresIn: 10 });
    var result = jwt.verify(token, "123");
    expect(result.exp).toBeCloseTo(Math.floor(Date.now() / 1000) + 10, 0.2);
  });
});