diff --git a/extensions/comfy/test-helpers.ts b/extensions/comfy/test-helpers.ts index fe19507827d..284ec47c0ef 100644 --- a/extensions/comfy/test-helpers.ts +++ b/extensions/comfy/test-helpers.ts @@ -34,8 +34,12 @@ export function parseComfyJsonBody( call: number, ): Record { const request = fetchWithSsrFGuardMock.mock.calls[call - 1]?.[0] as FetchGuardRequest | undefined; - expect(request?.init?.body).toBeTruthy(); - return JSON.parse(String(request.init.body)) as Record; + const body = request?.init?.body; + expect(body).toBeTruthy(); + if (typeof body !== "string") { + throw new Error(`Missing Comfy request body for fetch call ${call}`); + } + return JSON.parse(body) as Record; } export function mockComfyProviderApiKey(apiKey = "comfy-test-key") {