test: tighten vydra video assertions

This commit is contained in:
Peter Steinberger
2026-05-09 21:47:38 +01:00
parent 0bc1e5e1cd
commit 0456672aaf

View File

@@ -41,19 +41,15 @@ describe("vydra video-generation provider", () => {
cfg: {},
});
expect(fetchMock).toHaveBeenNthCalledWith(
1,
"https://www.vydra.ai/api/v1/models/veo3",
expect.objectContaining({
method: "POST",
body: JSON.stringify({ prompt: "tiny city at sunrise" }),
}),
);
expect(fetchMock).toHaveBeenNthCalledWith(
2,
"https://www.vydra.ai/api/v1/jobs/job-123",
expect.objectContaining({ method: "GET" }),
);
const createCall = fetchMock.mock.calls[0];
expect(createCall?.[0]).toBe("https://www.vydra.ai/api/v1/models/veo3");
const createInit = createCall?.[1] as { method?: string; body?: unknown } | undefined;
expect(createInit?.method).toBe("POST");
expect(createInit?.body).toBe(JSON.stringify({ prompt: "tiny city at sunrise" }));
const pollCall = fetchMock.mock.calls[1];
expect(pollCall?.[0]).toBe("https://www.vydra.ai/api/v1/jobs/job-123");
const pollInit = pollCall?.[1] as { method?: string } | undefined;
expect(pollInit?.method).toBe("GET");
expect(result.videos).toHaveLength(1);
const [video] = result.videos;
if (!video) {
@@ -105,16 +101,15 @@ describe("vydra video-generation provider", () => {
inputImages: [{ url: "https://example.com/reference.png" }],
});
expect(fetchMock).toHaveBeenNthCalledWith(
1,
"https://www.vydra.ai/api/v1/models/kling",
expect.objectContaining({
method: "POST",
body: JSON.stringify({
prompt: "animate this image",
image_url: "https://example.com/reference.png",
video_url: "https://example.com/reference.png",
}),
const createCall = fetchMock.mock.calls[0];
expect(createCall?.[0]).toBe("https://www.vydra.ai/api/v1/models/kling");
const createInit = createCall?.[1] as { method?: string; body?: unknown } | undefined;
expect(createInit?.method).toBe("POST");
expect(createInit?.body).toBe(
JSON.stringify({
prompt: "animate this image",
image_url: "https://example.com/reference.png",
video_url: "https://example.com/reference.png",
}),
);
expect(result.videos).toHaveLength(1);