diff --git a/extensions/vydra/video-generation-provider.test.ts b/extensions/vydra/video-generation-provider.test.ts index 3e4813f81da..ded6c8d892c 100644 --- a/extensions/vydra/video-generation-provider.test.ts +++ b/extensions/vydra/video-generation-provider.test.ts @@ -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);