diff --git a/public/pages/Aliases/containers/AliasActions/AliasActions.test.tsx b/public/pages/Aliases/containers/AliasActions/AliasActions.test.tsx index 984bdf7ba..4ae8cc4ae 100644 --- a/public/pages/Aliases/containers/AliasActions/AliasActions.test.tsx +++ b/public/pages/Aliases/containers/AliasActions/AliasActions.test.tsx @@ -6,7 +6,6 @@ import React from "react"; import "@testing-library/jest-dom/extend-expect"; import { render, waitFor } from "@testing-library/react"; -// @ts-ignore import userEvent from "@testing-library/user-event"; import { browserServicesMock, coreServicesMock } from "../../../../../test/mocks"; import AliasesActions, { AliasesActionsProps } from "./index"; @@ -14,7 +13,6 @@ import { ModalProvider } from "../../../../components/Modal"; import { ServicesContext } from "../../../../services"; import { CoreServicesContext } from "../../../../components/core_services"; import { buildMockApiCallerForFlush, selectedAliases } from "../../../../containers/FlushIndexModal/FlushIndexModalTestHelper"; -import { act } from "react-dom/test-utils"; import { IAlias } from "../../interface"; function renderWithRouter(props: Omit) { @@ -359,7 +357,7 @@ describe(" spec", () => { it("renders flush component", async () => { browserServicesMock.commonService.apiCaller = buildMockApiCallerForFlush(); - const { getByTestId, getByText } = render( + const { getByTestId, getByText, queryByTestId } = render( @@ -370,9 +368,11 @@ describe(" spec", () => { ); userEvent.click(document.querySelector('[data-test-subj="moreAction"] button') as Element); userEvent.click(getByTestId("Flush Action")); - await act(async () => {}); - expect(getByText("The following aliases will be flushed:")).toBeInTheDocument(); - expect(document.body.children).toMatchSnapshot(); + await waitFor(() => { + expect(queryByTestId("Flush Action")).toBeNull(); + expect(getByText("The following aliases will be flushed:")).toBeInTheDocument(); + expect(document.body.children).toMatchSnapshot(); + }); }); it("flush all aliases disabled", async () => { diff --git a/public/pages/Aliases/containers/AliasActions/__snapshots__/AliasActions.test.tsx.snap b/public/pages/Aliases/containers/AliasActions/__snapshots__/AliasActions.test.tsx.snap index 2874e21ba..0db264c08 100644 --- a/public/pages/Aliases/containers/AliasActions/__snapshots__/AliasActions.test.tsx.snap +++ b/public/pages/Aliases/containers/AliasActions/__snapshots__/AliasActions.test.tsx.snap @@ -466,178 +466,6 @@ HTMLCollection [ , -