mirror of
https://github.com/heygen-com/hyperframes.git
synced 2026-09-03 04:38:33 +00:00
test(cli): type the guard test's mock so the full typecheck passes
This commit is contained in:
@@ -343,12 +343,12 @@ describe("runFfmpegOnce", () => {
|
||||
|
||||
describe("installPageFunctionGuard", () => {
|
||||
it("defines the keepNames __name shim in the page before any script runs", async () => {
|
||||
const evaluateOnNewDocument = vi.fn(async () => undefined);
|
||||
const evaluateOnNewDocument = vi.fn(async (_source: string) => undefined);
|
||||
|
||||
await installPageFunctionGuard({ evaluateOnNewDocument });
|
||||
|
||||
expect(evaluateOnNewDocument).toHaveBeenCalledOnce();
|
||||
const source = evaluateOnNewDocument.mock.calls[0]?.[0] as string;
|
||||
const source = evaluateOnNewDocument.mock.calls[0]?.[0] ?? "";
|
||||
expect(source).toContain("self.__name");
|
||||
// The shim must be a no-op passthrough so wrapped functions stay callable.
|
||||
const shim = new Function(`const self = {}; ${source}; return self.__name;`)() as (
|
||||
|
||||
Reference in New Issue
Block a user