Skip to content

Commit

Permalink
test: Add test for no add facility button when operation is SFO
Browse files Browse the repository at this point in the history
  • Loading branch information
gdalcengio committed Sep 23, 2024
1 parent 5e92f23 commit 762e296
Showing 1 changed file with 17 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { render, screen } from "@testing-library/react";
import FacilitiesPage from "apps/administration/app/components/facilities/FacilitiesPage";
import { getOperation } from "../operations/mocks";

const searchParams = { operations_title: "Operation 2" };
// mocking the child component until this issue is fixed: https://github.com/testing-library/react-testing-library/issues/1209#issuecomment-1673372612
Expand Down Expand Up @@ -44,4 +45,20 @@ describe("Facilities page", () => {
screen.queryByRole("button", { name: "Add Facility" }),
).not.toBeInTheDocument();
});
it("Not displaying `Add Facility` button for external users with an SFO operation", async () => {
getOperation.mockReturnValueOnce({
id: "8be4c7aa-6ab3-4aad-9206-0ef914fea063",
type: "Single Facility Operation",
});
render(
await FacilitiesPage({
operationId: "8be4c7aa-6ab3-4aad-9206-0ef914fea063",
searchParams: {},
isExternalUser: true,
}),
);
expect(
screen.queryByRole("button", { name: "Add Facility" }),
).not.toBeInTheDocument();
});
});

0 comments on commit 762e296

Please sign in to comment.