mirror of
https://github.com/Sea-Haven-Industries/shoc-frontend-new.git
synced 2026-10-07 16:19:01 +00:00
fix(api): unblock FormData Content-Type test typecheck
Avoid CFA null narrowing on the fetch-mock capture so tsc -b passes on this tip.
This commit is contained in:
parent
fada679b5c
commit
e2687672e2
1 changed files with 6 additions and 7 deletions
|
|
@ -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");
|
||||
}
|
||||
});
|
||||
});
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue