MCPcopy Create free account
hub / github.com/heygen-com/hyperframes / createMockTimeline

Function createMockTimeline

packages/core/src/runtime/player.test.ts:5–29  ·  view source on GitHub ↗
(opts?: { time?: number; duration?: number })

Source from the content-addressed store, hash-verified

3import type { RuntimeTimelineLike } from "./types";
4
5function createMockTimeline(opts?: { time?: number; duration?: number }): RuntimeTimelineLike {
6 const state = { time: opts?.time ?? 0, duration: opts?.duration ?? 10, paused: false };
7 return {
8 play: vi.fn(() => {
9 state.paused = false;
10 }),
11 pause: vi.fn(() => {
12 state.paused = true;
13 }),
14 seek: vi.fn((t: number) => {
15 state.time = t;
16 }),
17 totalTime: vi.fn((t: number) => {
18 state.time = t;
19 }),
20 time: vi.fn(() => state.time),
21 duration: vi.fn(() => state.duration),
22 add: vi.fn(),
23 paused: vi.fn((p?: boolean) => {
24 if (p !== undefined) state.paused = p;
25 }),
26 timeScale: vi.fn(),
27 set: vi.fn(),
28 };
29}
30
31function createMockDeps(timeline?: RuntimeTimelineLike | null) {
32 let isPlaying = false;

Callers 1

player.test.tsFile · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected