mirror of
https://github.com/Sea-Haven-Industries/shoc-frontend-new.git
synced 2026-10-03 06:53:24 +00:00
fix(test): make FormData content-type assertion type-safe
This commit is contained in:
parent
3c42abea40
commit
9628fb8c88
1 changed files with 5 additions and 3 deletions
|
|
@ -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");
|
||||
}
|
||||
});
|
||||
});
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue