mirror of
https://github.com/oven-sh/bun
synced 2026-02-09 18:38:55 +00:00
17 lines
595 B
JavaScript
17 lines
595 B
JavaScript
import { describe, expect, it } from "bun:test";
|
|
import jwt from "jsonwebtoken";
|
|
|
|
describe("set header", function () {
|
|
it("should add the header", function () {
|
|
var token = jwt.sign({ foo: 123 }, "123", { header: { foo: "bar" } });
|
|
var decoded = jwt.decode(token, { complete: true });
|
|
expect(decoded.header.foo).toEqual("bar");
|
|
});
|
|
|
|
it("should allow overriding header", function () {
|
|
var token = jwt.sign({ foo: 123 }, "123", { header: { alg: "HS512" } });
|
|
var decoded = jwt.decode(token, { complete: true });
|
|
expect(decoded.header.alg).toEqual("HS512");
|
|
});
|
|
});
|