mirror of
https://github.com/fleetdm/fleet
synced 2026-04-21 13:37:30 +00:00
Implements patch policies #31914 - https://github.com/fleetdm/fleet/pull/40816 - https://github.com/fleetdm/fleet/pull/41248 - https://github.com/fleetdm/fleet/pull/41276 - https://github.com/fleetdm/fleet/pull/40948 - https://github.com/fleetdm/fleet/pull/40837 - https://github.com/fleetdm/fleet/pull/40956 - https://github.com/fleetdm/fleet/pull/41168 - https://github.com/fleetdm/fleet/pull/41171 - https://github.com/fleetdm/fleet/pull/40691 - https://github.com/fleetdm/fleet/pull/41524 - https://github.com/fleetdm/fleet/pull/41674 --------- Co-authored-by: Jonathan Katz <44128041+jkatz01@users.noreply.github.com> Co-authored-by: jkatz01 <yehonatankatz@gmail.com> Co-authored-by: RachelElysia <71795832+RachelElysia@users.noreply.github.com> Co-authored-by: Jahziel Villasana-Espinoza <jahziel@fleetdm.com>
57 lines
1.8 KiB
TypeScript
57 lines
1.8 KiB
TypeScript
import React from "react";
|
|
import { screen, render, waitFor } from "@testing-library/react";
|
|
import { renderWithSetup } from "test/test-utils";
|
|
import { ISoftwareInstallPolicyUI } from "interfaces/software";
|
|
import InstallerPoliciesTable from "./InstallerPoliciesTable";
|
|
|
|
describe("InstallerPoliciesTable", () => {
|
|
const policies: ISoftwareInstallPolicyUI[] = [
|
|
{ id: 1, name: "No Gatekeeper", type: new Set(["dynamic"]) },
|
|
{ id: 2, name: "Outdated Gatekeeper", type: new Set(["patch"]) },
|
|
];
|
|
it("renders policy names as links and footer info", () => {
|
|
render(<InstallerPoliciesTable teamId={42} policies={policies} />);
|
|
|
|
// There should be two cells, each with a link
|
|
const cells = screen.getAllByRole("cell");
|
|
expect(cells).toHaveLength(2);
|
|
|
|
// Each cell should contain a link with the policy name
|
|
expect(cells[0].querySelector("a.link-cell")).toHaveTextContent(
|
|
/No Gatekeeper/i
|
|
);
|
|
expect(cells[1].querySelector("a.link-cell")).toHaveTextContent(
|
|
/Outdated Gatekeeper/i
|
|
);
|
|
expect(screen.getByText(/2 policies/i)).toBeInTheDocument();
|
|
});
|
|
it("renders the badges for patch and dynamic policies", async () => {
|
|
const { user } = renderWithSetup(
|
|
<InstallerPoliciesTable teamId={42} policies={policies} />
|
|
);
|
|
|
|
await waitFor(() => {
|
|
waitFor(() => {
|
|
user.hover(screen.getByText(/patch/i));
|
|
});
|
|
|
|
expect(
|
|
screen.getByText(
|
|
"Hosts will fail this policy if they're running an older version."
|
|
)
|
|
).toBeInTheDocument();
|
|
});
|
|
|
|
await waitFor(() => {
|
|
waitFor(() => {
|
|
user.hover(screen.getByTestId("refresh-icon"));
|
|
});
|
|
|
|
expect(
|
|
screen.getByText(
|
|
"Software will be automatically installed when hosts fail this policy."
|
|
)
|
|
).toBeInTheDocument();
|
|
});
|
|
});
|
|
});
|