


























@@ -41,19 +41,15 @@ describe("vydra video-generation provider", () => {
4141cfg: {},
4242});
434344-expect(fetchMock).toHaveBeenNthCalledWith(
45-1,
46-"https://www.vydra.ai/api/v1/models/veo3",
47-expect.objectContaining({
48-method: "POST",
49-body: JSON.stringify({ prompt: "tiny city at sunrise" }),
50-}),
51-);
52-expect(fetchMock).toHaveBeenNthCalledWith(
53-2,
54-"https://www.vydra.ai/api/v1/jobs/job-123",
55-expect.objectContaining({ method: "GET" }),
56-);
44+const createCall = fetchMock.mock.calls[0];
45+expect(createCall?.[0]).toBe("https://www.vydra.ai/api/v1/models/veo3");
46+const createInit = createCall?.[1] as { method?: string; body?: unknown } | undefined;
47+expect(createInit?.method).toBe("POST");
48+expect(createInit?.body).toBe(JSON.stringify({ prompt: "tiny city at sunrise" }));
49+const pollCall = fetchMock.mock.calls[1];
50+expect(pollCall?.[0]).toBe("https://www.vydra.ai/api/v1/jobs/job-123");
51+const pollInit = pollCall?.[1] as { method?: string } | undefined;
52+expect(pollInit?.method).toBe("GET");
5753expect(result.videos).toHaveLength(1);
5854const [video] = result.videos;
5955if (!video) {
@@ -105,16 +101,15 @@ describe("vydra video-generation provider", () => {
105101inputImages: [{ url: "https://example.com/reference.png" }],
106102});
107103108-expect(fetchMock).toHaveBeenNthCalledWith(
109-1,
110-"https://www.vydra.ai/api/v1/models/kling",
111-expect.objectContaining({
112-method: "POST",
113-body: JSON.stringify({
114-prompt: "animate this image",
115-image_url: "https://example.com/reference.png",
116-video_url: "https://example.com/reference.png",
117-}),
104+const createCall = fetchMock.mock.calls[0];
105+expect(createCall?.[0]).toBe("https://www.vydra.ai/api/v1/models/kling");
106+const createInit = createCall?.[1] as { method?: string; body?: unknown } | undefined;
107+expect(createInit?.method).toBe("POST");
108+expect(createInit?.body).toBe(
109+JSON.stringify({
110+prompt: "animate this image",
111+image_url: "https://example.com/reference.png",
112+video_url: "https://example.com/reference.png",
118113}),
119114);
120115expect(result.videos).toHaveLength(1);
此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。