import { describe, expect, it } from "vitest"; import { saveMediaSettings } from "../media-settings.js"; const comfyui = (workflows: { imageWorkflow?: string; videoWorkflow?: string }) => ({ comfyui: { baseUrl: "http://127.0.0.1:8188", ...workflows }, transcription: null, }); describe("ComfyUI settings", () => { it("refuses custom workflows the provider could not fill", async () => { const deps = {} as Parameters[0]; await expect( saveMediaSettings( deps, comfyui({ imageWorkflow: '{"1": {"class_type": "X", "inputs": {}}}' }), ), ).rejects.toThrow("Image workflow: Workflow needs a {{prompt}} placeholder"); await expect( saveMediaSettings( deps, comfyui({ videoWorkflow: '{"1": {"class_type": "X", "inputs": {"t": "{{prompt}}", "c": "{{cfg}}"}}}', }), ), ).rejects.toThrow("Video workflow: Unknown workflow placeholders: {{cfg}}"); }); });