Skip to content

The open-source full-stack studio for Opus 5.5 motion video. Reverse engineering for any video. Code video with HTML: recreate, edit and render. BYOA + BYOK · Motion.md · Images, Video, Music & Voice.

871 B
Raw Blame
import { describe, expect, it, vi } from "vitest";
import { buildFrameCaptureFilename, buildFrameCaptureUrl } from "./frameCapture";

describe("frame capture utilities", () => {
  it("builds a PNG capture URL for the master composition", () => {
    vi.useFakeTimers();
    vi.setSystemTime(new Date("2026-04-29T12:00:00Z"));

    expect(
      buildFrameCaptureUrl({
        projectId: "demo project",
        compositionPath: null,
        currentTime: 1.23456,
        origin: "http://localhost:5194",
      }),
    ).toBe(
      "http://localhost:5194/api/projects/demo%20project/thumbnail/index.html?t=1.235&format=png&output=source&v=1777464000000",
    );

    vi.useRealTimers();
  });

  it("builds a safe filename from a nested composition path", () => {
    expect(buildFrameCaptureFilename("compositions/intro.html", 2.5)).toBe("intro-2-500s.png");
  });
});