ai-chatbot/tests/routes/video-mark-prompt.test.ts

21 lines
859 B
TypeScript

import { expect, test } from "@playwright/test";
import { composeVideoMarkGenerationPrompt } from "../../lib/video-canvas/video-marks";
test.describe("video canvas mark generation prompt", () => {
test("injects deduplicated selected labels into the configured template", () => {
expect(
composeVideoMarkGenerationPrompt({
labels: ["人物", "黑色半身裙", "人物"],
template: "锁定:{{labels}};纯文本:{{plainLabels}}",
}),
).toBe("锁定:@人物、@黑色半身裙;纯文本:人物、黑色半身裙");
});
test("supports disabling generation injection with an empty template", () => {
expect(
composeVideoMarkGenerationPrompt({ labels: ["人物"], template: "" }),
).toBe("");
expect(composeVideoMarkGenerationPrompt({ labels: [], template: undefined })).toBe("");
});
});