mirror of
https://github.com/mauriceboe/TREK.git
synced 2026-06-22 06:41:46 +00:00
Await the async cover normalization in the TripFormModal paste test (#1085)
handleCoverSelect now normalizes the pasted file before previewing it, so URL.createObjectURL is called a microtask later. The assertion moves into waitFor; a non-HEIC file still passes through unchanged.
This commit is contained in:
@@ -260,7 +260,9 @@ describe('TripFormModal', () => {
|
|||||||
items: [{ type: 'image/png', getAsFile: () => file }],
|
items: [{ type: 'image/png', getAsFile: () => file }],
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
expect(mockCreateObjectURL).toHaveBeenCalledWith(file);
|
// Cover selection now normalizes the file (HEIC -> JPEG) before previewing, so the
|
||||||
|
// createObjectURL call lands a microtask later; a non-HEIC file passes through unchanged.
|
||||||
|
await waitFor(() => expect(mockCreateObjectURL).toHaveBeenCalledWith(file));
|
||||||
|
|
||||||
Object.defineProperty(URL, 'createObjectURL', { writable: true, configurable: true, value: original });
|
Object.defineProperty(URL, 'createObjectURL', { writable: true, configurable: true, value: original });
|
||||||
});
|
});
|
||||||
|
|||||||
Reference in New Issue
Block a user