From 2035632e5c109b90ebf6e065192a143a7169d2c6 Mon Sep 17 00:00:00 2001 From: Mike Heneghan Date: Mon, 26 Feb 2024 15:12:26 +0000 Subject: [PATCH] refactor: move from fireEvent to user - As per: https://github.com/theopensystemslab/planx-new/pull/2815#discussion_r1502661458 --- .../Feedback/FeedbackPhaseBanner.test.tsx | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) diff --git a/editor.planx.uk/src/components/Feedback/FeedbackPhaseBanner.test.tsx b/editor.planx.uk/src/components/Feedback/FeedbackPhaseBanner.test.tsx index f2e6a825af..fd4d20216a 100644 --- a/editor.planx.uk/src/components/Feedback/FeedbackPhaseBanner.test.tsx +++ b/editor.planx.uk/src/components/Feedback/FeedbackPhaseBanner.test.tsx @@ -1,6 +1,3 @@ -import "@testing-library/jest-dom/extend-expect"; - -import { fireEvent } from "@testing-library/react"; import React from "react"; import { axe, setup } from "testUtils"; @@ -27,27 +24,27 @@ describe("FeedbackPhaseBanner presentation and functionality", () => { expect(getByText("feedback")).toBeInTheDocument(); }); - test("clicking on feedback link calls handleFeedbackClick", () => { - const { getByText } = setup( + test("clicking on feedback link calls handleFeedbackClick", async () => { + const { getByText, user } = setup( , ); - fireEvent.click(getByText("feedback")); + await user.click(getByText("feedback")); expect(handleFeedbackClick).toHaveBeenCalledTimes(1); }); - test("clicking on 'Report an issue with this page' button calls handleReportAnIssueClick", () => { - const { getByText } = setup( + test("clicking on 'Report an issue with this page' button calls handleReportAnIssueClick", async () => { + const { getByText, user } = setup( , ); - fireEvent.click(getByText("Report an issue with this page")); + await user.click(getByText("Report an issue with this page")); expect(handleReportAnIssueClick).toHaveBeenCalledTimes(1); }); });