
























@@ -35,15 +35,14 @@ describe("vydra image-generation provider", () => {
3535cfg: {},
3636});
373738-expect(fetchMock).toHaveBeenNthCalledWith(
39-1,
40-"https://www.vydra.ai/api/v1/models/grok-imagine",
41-expect.objectContaining({
42-method: "POST",
43-body: JSON.stringify({
44-prompt: "draw a cat",
45-model: "text-to-image",
46-}),
38+const createCall = fetchMock.mock.calls[0];
39+expect(createCall?.[0]).toBe("https://www.vydra.ai/api/v1/models/grok-imagine");
40+const createInit = createCall?.[1] as { method?: string; body?: unknown } | undefined;
41+expect(createInit?.method).toBe("POST");
42+expect(createInit?.body).toBe(
43+JSON.stringify({
44+prompt: "draw a cat",
45+model: "text-to-image",
4746}),
4847);
4948const [, init] = fetchMock.mock.calls[0] as [string, RequestInit];
@@ -94,11 +93,10 @@ describe("vydra image-generation provider", () => {
9493ssrfPolicy: { allowRfc2544BenchmarkRange: true },
9594});
969597-expect(fetchMock).toHaveBeenNthCalledWith(
98-1,
99-"https://198.18.0.10/api/v1/models/grok-imagine",
100-expect.objectContaining({ method: "POST" }),
101-);
96+const createCall = fetchMock.mock.calls[0];
97+expect(createCall?.[0]).toBe("https://198.18.0.10/api/v1/models/grok-imagine");
98+const createInit = createCall?.[1] as { method?: string } | undefined;
99+expect(createInit?.method).toBe("POST");
102100});
103101104102it("polls jobs when the create response is not completed yet", async () => {
@@ -121,10 +119,9 @@ describe("vydra image-generation provider", () => {
121119cfg: {},
122120});
123121124-expect(fetchMock).toHaveBeenNthCalledWith(
125-2,
126-"https://www.vydra.ai/api/v1/jobs/job-456",
127-expect.objectContaining({ method: "GET" }),
128-);
122+const pollCall = fetchMock.mock.calls[1];
123+expect(pollCall?.[0]).toBe("https://www.vydra.ai/api/v1/jobs/job-456");
124+const pollInit = pollCall?.[1] as { method?: string } | undefined;
125+expect(pollInit?.method).toBe("GET");
129126});
130127});
此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。