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:
Maurice
2026-05-31 23:02:31 +02:00
parent 959d6c3714
commit 86b476f011
@@ -260,7 +260,9 @@ describe('TripFormModal', () => {
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 });
});