From e2687672e245905a61c47e00dd6cc4871a8d6265 Mon Sep 17 00:00:00 2001 From: Arthur Bassi Date: Wed, 22 Jul 2026 13:39:51 -0300 Subject: [PATCH] fix(api): unblock FormData Content-Type test typecheck Avoid CFA null narrowing on the fetch-mock capture so tsc -b passes on this tip. --- src/test/api/api-formdata-content-type.test.ts | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/src/test/api/api-formdata-content-type.test.ts b/src/test/api/api-formdata-content-type.test.ts index 4596309f..77e68126 100644 --- a/src/test/api/api-formdata-content-type.test.ts +++ b/src/test/api/api-formdata-content-type.test.ts @@ -47,13 +47,12 @@ describe("api.post FormData Content-Type", () => { await api.post("workorders/9/media", { body: form, throwHttpErrors: false }); - expect(capturedContentType).not.toBe("application/json"); - // Browser sets multipart/form-data; boundary=... when Content-Type was stripped. - // In jsdom/fetch mock the runtime may leave it null or set multipart — both are OK - // as long as it is not forced JSON. - const contentType: string | null = capturedContentType; - if (contentType !== null) { - expect(contentType.toLowerCase()).toContain("multipart/form-data"); + // Fetch mock assigns inside a nested callback; CFA may keep the outer binding as null. + // Contract under test: do not force JSON Content-Type for FormData bodies. + const observedContentType = capturedContentType as string | null; + expect(observedContentType).not.toBe("application/json"); + if (observedContentType) { + expect(observedContentType.toLowerCase()).toContain("multipart/form-data"); } }); });