From 86b476f011a5a0a39457fb8d7e655d08f5cfb862 Mon Sep 17 00:00:00 2001 From: Maurice Date: Sun, 31 May 2026 23:02:31 +0200 Subject: [PATCH] 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. --- client/src/components/Trips/TripFormModal.test.tsx | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/client/src/components/Trips/TripFormModal.test.tsx b/client/src/components/Trips/TripFormModal.test.tsx index ed5bbac9..6ede18b7 100644 --- a/client/src/components/Trips/TripFormModal.test.tsx +++ b/client/src/components/Trips/TripFormModal.test.tsx @@ -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 }); });