Files
frames/packages/studio/vite.thumbnail.test.ts
zooqueenandHanzo Dev 70b41673a3 frames: rebrand the fork to Hanzo Frames
Forked from HyperFrames (Apache-2.0), full history preserved.

Hosts are mapped explicitly and BEFORE the identifier rename, because
hyperframes.heygen.com is not decoration: 175 of its occurrences are $schema
identifiers that a validator dereferences. A blind rename would have left them
naming a host that never serves them. The schema files are in this repo under
docs/schema, so the mapped host is one we can actually serve -- that is the
condition that makes the rewrite safe, and serving them is a deploy task, not
an edit. docs/schema/hyperframes.json is renamed to frames.json to match the
identifier it is now published under.

api.heygen.com and the CLI auth against heygen.com are left UNRENAMED on
purpose. They are a dependency on HeyGen's SaaS, not a name of ours to take,
and the right move is to remove that integration rather than rebrand it.

LICENSE and CREDITS.md are untouched; NOTICE records the lineage.

Co-authored-by: Hanzo Dev <[email protected]>
2026-07-28 23:42:24 -07:00

57 lines
1.9 KiB
TypeScript

import { describe, expect, it, vi } from "vitest";
import { seekThumbnailPreview } from "./vite.thumbnail";
describe("seekThumbnailPreview", () => {
it("prefers the Frames player seek path over raw timelines", async () => {
const evaluate = vi.fn(async (fn: (time: number) => string, time: number) => {
const playerSeek = vi.fn();
const timelinePause = vi.fn();
const previousWindow = globalThis.window;
vi.stubGlobal("window", {
__player: { seek: playerSeek },
__timelines: {
main: { pause: timelinePause },
nested: { pause: timelinePause },
},
});
try {
const result = fn(time);
expect(playerSeek).toHaveBeenCalledWith(10);
expect(timelinePause).not.toHaveBeenCalled();
return result;
} finally {
vi.stubGlobal("window", previousWindow);
}
});
await expect(seekThumbnailPreview({ evaluate }, 10)).resolves.toBe("player");
});
it("falls back to all registered timelines for standalone composition pages", async () => {
const evaluate = vi.fn(async (fn: (time: number) => string, time: number) => {
const firstPause = vi.fn();
const secondPause = vi.fn();
const tickerTick = vi.fn();
const previousWindow = globalThis.window;
vi.stubGlobal("window", {
__timelines: {
first: { pause: firstPause },
second: { pause: secondPause },
},
gsap: { ticker: { tick: tickerTick } },
});
try {
const result = fn(time);
expect(firstPause).toHaveBeenCalledWith(2.5);
expect(secondPause).toHaveBeenCalledWith(2.5);
expect(tickerTick).toHaveBeenCalled();
return result;
} finally {
vi.stubGlobal("window", previousWindow);
}
});
await expect(seekThumbnailPreview({ evaluate }, 2.5)).resolves.toBe("timelines");
});
});