fix(test): make FormData content-type assertion type-safe

This commit is contained in:
Arthur Bassi 2026-07-21 10:49:16 -03:00
parent 3c42abea40
commit 9628fb8c88

View file

@ -49,10 +49,12 @@ describe("api.post FormData Content-Type", () => {
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
// In jsdom/fetch mock the runtime may leave it null or set multipart - both are OK
// as long as it is not forced JSON.
if (capturedContentType) {
expect(capturedContentType.toLowerCase()).toContain("multipart/form-data");
// Cast after expect(): Vitest assertion narrowing collapses string|null to never.
const contentType = capturedContentType as string | null;
if (contentType !== null) {
expect(contentType.toLowerCase()).toContain("multipart/form-data");
}
});
});