fix: support video durations from 5 to 14 seconds
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
import test from "node:test";
|
||||
import assert from "node:assert/strict";
|
||||
import { readFileSync } from "node:fs";
|
||||
import {
|
||||
extractVideoTaskId,
|
||||
extractVideoUrl,
|
||||
@@ -24,3 +25,10 @@ test("兼容视频任务 id 和状态字段", () => {
|
||||
test("从常见响应位置提取视频地址", () => {
|
||||
assert.equal(extractVideoUrl({ output: { video_url: "https://example.com/demo.mp4" } }), "https://example.com/demo.mp4");
|
||||
});
|
||||
|
||||
test("生成时长提供 5 到 14 秒全部整数选项", () => {
|
||||
const html = readFileSync(new URL("../public/index.html", import.meta.url), "utf8");
|
||||
const durationSelect = html.match(/<select id="duration">([\s\S]*?)<\/select>/)?.[1] || "";
|
||||
const values = [...durationSelect.matchAll(/<option value="(\d+)">/g)].map((match) => Number(match[1]));
|
||||
assert.deepEqual(values, [5, 6, 7, 8, 9, 10, 11, 12, 13, 14]);
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user