import { expect, test } from "@playwright/test"; import { defaultVideoCanvasVideoHdConfig, formatVideoHdFrameRate, getVideoHdCost, normalizeVideoCanvasVideoHdConfig, } from "../../lib/video-canvas/video-hd"; test.describe("video canvas HD tools", () => { test("matches competitor resolution prices", () => { expect(getVideoHdCost(defaultVideoCanvasVideoHdConfig, "1080P", "none", 1)).toBe(24); expect(getVideoHdCost(defaultVideoCanvasVideoHdConfig, "2K", "none", 1)).toBe(42); expect(getVideoHdCost(defaultVideoCanvasVideoHdConfig, "4K", "none", 1)).toBe(90); }); test("matches interpolation and slow-motion pricing", () => { expect(getVideoHdCost(defaultVideoCanvasVideoHdConfig, "4K", "high-quality", 1)).toBe(138); expect(getVideoHdCost(defaultVideoCanvasVideoHdConfig, "4K", "high-quality", 2)).toBe(270); }); test("normalizes configurable model and option lists", () => { const normalized = normalizeVideoCanvasVideoHdConfig({ model: "Custom HD", frameRates: [60, 24, 60], slowMultipliers: [5, 1, 2], resolutions: { "2K": { width: 3000, baseCost: 50 } }, }); expect(normalized.model).toBe("Custom HD"); expect(normalized.frameRates).toEqual([24, 60]); expect(normalized.slowMultipliers).toEqual([1, 2, 5]); expect(normalized.resolutions["2K"].width).toBe(3000); expect(normalized.resolutions["2K"].height).toBe(1440); }); test("formats competitor frame-rate labels", () => { expect(formatVideoHdFrameRate(24)).toBe("标准(24fps)"); expect(formatVideoHdFrameRate(60)).toBe("流畅(60fps)"); expect(formatVideoHdFrameRate(120)).toBe("极致流畅(120fps)"); }); });