From ee816a8c64d6f4b69dcfc2ea8a5df74872e32288 Mon Sep 17 00:00:00 2001 From: Mounir Dhahri Date: Fri, 9 Aug 2024 20:33:00 +0200 Subject: [PATCH] fix: unstable inquiry modal test (#10579) * fix: unstable inquiry modal test * Update src/app/Scenes/Artwork/Components/CommercialButtons/InquiryModal.tests.tsx Co-authored-by: Carlos --------- Co-authored-by: Carlos --- .../Components/CommercialButtons/InquiryModal.tests.tsx | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/app/Scenes/Artwork/Components/CommercialButtons/InquiryModal.tests.tsx b/src/app/Scenes/Artwork/Components/CommercialButtons/InquiryModal.tests.tsx index 73cad133277..e5a819964d7 100644 --- a/src/app/Scenes/Artwork/Components/CommercialButtons/InquiryModal.tests.tsx +++ b/src/app/Scenes/Artwork/Components/CommercialButtons/InquiryModal.tests.tsx @@ -14,6 +14,7 @@ import { InquiryQuestionIDs, } from "app/utils/ArtworkInquiry/ArtworkInquiryTypes" import { daysInCooldownPeriod } from "app/utils/collectorPromptHelpers" +import { flushPromiseQueue } from "app/utils/tests/flushPromiseQueue" import { mockTrackEvent } from "app/utils/tests/globallyMockedStuff" import { setupTestWrapper } from "app/utils/tests/setupTestWrapper" import { Reducer, useReducer } from "react" @@ -89,9 +90,10 @@ describe("inquiry modal", () => { fireEvent.press(screen.getByText("Cancel")) - await waitFor(() => { - expect(screen.queryByText("What information are you looking for?")).toBeNull() - }) + // Wait for the modal to close + await flushPromiseQueue() + + expect(screen.queryByText("What information are you looking for?")).not.toBeOnTheScreen() }) it("tracks an event when the inquiry modal is closed", async () => {