1
0
mirror of https://github.com/lensapp/lens.git synced 2025-05-20 05:10:56 +00:00

Fix act() wrapper console.error

Signed-off-by: Alex Andreev <alex.andreev.email@gmail.com>
This commit is contained in:
Alex Andreev 2022-05-18 14:38:30 +03:00
parent 4d0e841343
commit a378621e73
2 changed files with 5 additions and 4 deletions

View File

@ -3,7 +3,7 @@
* Licensed under MIT License. See LICENSE in root directory for more information.
*/
import { render } from "@testing-library/react";
import { render, act } from "@testing-library/react";
import React from "react";
import { UpdateButton } from "../update-button";
import "@testing-library/jest-dom/extend-expect";
@ -27,12 +27,12 @@ describe("<UpdateButton/>", () => {
expect(getByTestId("update-button")).toMatchSnapshot();
});
it("should open menu when clicked", () => {
it("should open menu when clicked", async () => {
const { getByTestId } = render(<UpdateButton update={update} warningLevel="light" />);
const button = getByTestId("update-button");
button.click();
act(() => button.click());
expect(getByTestId("update-lens-menu-item")).toBeInTheDocument();
});
@ -42,7 +42,7 @@ describe("<UpdateButton/>", () => {
const button = getByTestId("update-button");
button.click();
act(() => button.click());
const menuItem = getByTestId("update-lens-menu-item");

View File

@ -50,6 +50,7 @@ export function UpdateButton({ warningLevel, update, id }: UpdateButtonProps) {
isOpen={opened}
close={toggle}
open={toggle}
aria-expanded={opened}
>
<MenuItem
icon={menuIconProps}