70bf21e064
Deploy (to testing) and Test Playground Preview Worker / Deploy Playground Preview Worker (testing) (push) Has been skipped
Deploy Workers Shared Staging / Deploy Workers Shared Staging (push) Failing after 0s
Prerelease / build (push) Has been skipped
Handle Changesets / Handle Changesets (push) Has been cancelled
Semgrep OSS scan / semgrep-oss (push) Has been cancelled
15 lines
440 B
TypeScript
15 lines
440 B
TypeScript
import { jwtVerify, JWTVerifyResult } from "jose";
|
|
import { it, vi } from "vitest";
|
|
|
|
vi.mock("jose", () => {
|
|
const jwtVerify = async (): Promise<JWTVerifyResult<unknown>> => {
|
|
return { payload: { mock: true }, protectedHeader: { alg: "" } };
|
|
};
|
|
return { jwtVerify };
|
|
});
|
|
|
|
it("uses mocked module", async ({ expect }) => {
|
|
const result = await jwtVerify("", new Uint8Array());
|
|
expect(result.payload).toStrictEqual({ mock: true });
|
|
});
|