@pedwise/next-firebase-auth-edge
Version:
Next.js 13 Firebase Authentication for Edge and server runtimes. Dedicated for Next 13 server components. Compatible with Next.js middleware.
27 lines • 1.13 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
const decode_1 = require("./decode");
const fakeJWT = "eyJ0eXAiOiJKV1QiLCJhbGciOiJSUzI1NiJ9.eyJleHAiOjk0NjY4ODQwMH0.c2VjcmV0";
describe("decode", () => {
it("should return decoded payload", () => {
expect.assertions(1);
expect((0, decode_1.decode)(fakeJWT)).toStrictEqual({ exp: 946688400 });
});
describe("options.complete", () => {
it("should return object containing header, payload and signature when complete = true", () => {
expect.assertions(1);
expect((0, decode_1.decode)(fakeJWT, { complete: true })).toStrictEqual({
header: { typ: "JWT", alg: "RS256" },
payload: { exp: 946688400 },
signature: "c2VjcmV0",
});
});
it("should return payload only when complete = false", () => {
expect.assertions(1);
expect((0, decode_1.decode)(fakeJWT, { complete: false })).toStrictEqual({
exp: 946688400,
});
});
});
});
//# sourceMappingURL=decode.test.js.map