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

Fix unit test

Signed-off-by: Sebastian Malton <sebastian@malton.name>
This commit is contained in:
Sebastian Malton 2021-11-05 15:50:52 -04:00
parent a8409324d1
commit 7e21785153

View File

@ -22,17 +22,17 @@
import { render } from "@testing-library/react";
import userEvent from "@testing-library/user-event";
import React from "react";
import { rolesStore } from "../../+roles/store";
import { Role } from "../../../../../common/k8s-api/endpoints";
import { clusterRolesStore } from "../../+cluster-roles/store";
import { ClusterRole } from "../../../../../common/k8s-api/endpoints";
import { RoleBindingDialog } from "../dialog";
jest.mock("../../+roles/store");
jest.mock("../../+cluster-roles/store");
describe("RoleBindingDialog tests", () => {
beforeEach(() => {
(rolesStore as any).items = [new Role({
(clusterRolesStore as any).items = [new ClusterRole({
apiVersion: "rbac.authorization.k8s.io/v1",
kind: "Role",
kind: "ClusterRole",
metadata: {
name: "foobar",
resourceVersion: "1",
@ -56,7 +56,10 @@ describe("RoleBindingDialog tests", () => {
RoleBindingDialog.open();
const res = render(<RoleBindingDialog />);
userEvent.keyboard("a");
await res.findAllByText("foobar");
userEvent.click(await res.findByText("Select role", { exact: false }));
await res.findAllByText("foobar", {
exact: false,
});
});
});