import { expect, test } from "@playwright/test"; import { getVideoFrameExtractionCopy, getVideoFrameExtractionTarget, } from "../../lib/video-canvas/video-frame-extraction"; test.describe("video frame extraction tools", () => { test("selects deterministic first, last, and current frame timestamps", () => { expect(getVideoFrameExtractionTarget("first", 2.5, 5)).toBe(0); expect(getVideoFrameExtractionTarget("last", 0, 5)).toBeCloseTo(4.95); expect(getVideoFrameExtractionTarget("current", 2.5, 5)).toBe(2.5); expect(getVideoFrameExtractionTarget("current", 20, 5)).toBeCloseTo(4.95); expect(getVideoFrameExtractionTarget("last", 0, 0.02)).toBe(0); }); test("matches competitor frame result titles and image labels", () => { expect(getVideoFrameExtractionCopy("first")).toEqual({ alt: "视频首帧", title: "首帧" }); expect(getVideoFrameExtractionCopy("last")).toEqual({ alt: "视频尾帧", title: "尾帧" }); expect(getVideoFrameExtractionCopy("current")).toEqual({ alt: "视频截图", title: "截图" }); }); });