Files
bun.sh/test/js/third_party/jsonwebtoken/issue_147.test.js
Jarred Sumner d1c1c8fb5f Fix flaky test
2023-11-13 22:16:34 -08:00

11 lines
415 B
JavaScript

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: 1000 });
var result = jwt.verify(token, "123");
expect(result.exp).toBeCloseTo(Math.floor(Date.now() / 1000) + 1000, 0);
});
});