61 lines
2.0 KiB
TypeScript
61 lines
2.0 KiB
TypeScript
import { expect, test } from "@playwright/test";
|
|
import {
|
|
applyKreaAudioReferences,
|
|
getKreaModelPresetById,
|
|
} from "../../lib/ai/krea-models";
|
|
import { defaultVideoCanvasFunctionConfig } from "../../lib/video-canvas/config";
|
|
|
|
test.describe("video canvas audio references", () => {
|
|
test("declares audio-to-video support only for audio-capable Krea video models", () => {
|
|
expect(
|
|
getKreaModelPresetById("/generate/video/bytedance/seedance-2")?.capabilities
|
|
?.supportedModes,
|
|
).toContain("audio-to-video");
|
|
expect(
|
|
getKreaModelPresetById("/generate/video/alibaba/wan-2.5")?.capabilities
|
|
?.supportedModes,
|
|
).toContain("audio-to-video");
|
|
expect(
|
|
getKreaModelPresetById("/generate/video/bytedance/seedance-1.0-pro")?.capabilities
|
|
?.supportedModes,
|
|
).not.toContain("audio-to-video");
|
|
});
|
|
|
|
test("maps Seedance audio references to referenceAudios", () => {
|
|
const body = applyKreaAudioReferences(
|
|
{},
|
|
["prompt", "referenceAudios"],
|
|
["https://cdn.example.com/one.mp3", "https://cdn.example.com/two.wav"],
|
|
);
|
|
|
|
expect(body).toEqual({
|
|
referenceAudios: [
|
|
"https://cdn.example.com/one.mp3",
|
|
"https://cdn.example.com/two.wav",
|
|
],
|
|
});
|
|
});
|
|
|
|
test("maps Wan audio input to its singular audio_url field", () => {
|
|
expect(
|
|
applyKreaAudioReferences(
|
|
{},
|
|
["prompt", "audio_url"],
|
|
["https://cdn.example.com/voice.mp3", "https://cdn.example.com/ignored.mp3"],
|
|
),
|
|
).toEqual({ audio_url: "https://cdn.example.com/voice.mp3" });
|
|
});
|
|
|
|
test("keeps the audio generation prompt in administrator configuration", () => {
|
|
expect(defaultVideoCanvasFunctionConfig.functions["audio-to-video"]).toMatchObject({
|
|
enabled: true,
|
|
kind: "video",
|
|
route: "canvas-generate-video",
|
|
requiresBackend: true,
|
|
});
|
|
expect(defaultVideoCanvasFunctionConfig.functions["audio-to-video"]?.prompt).toContain(
|
|
"音频",
|
|
);
|
|
});
|
|
});
|