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>
45 lines
1.1 KiB
TypeScript
45 lines
1.1 KiB
TypeScript
import React from "react";
|
|
import { screen, waitFor } from "@testing-library/react";
|
|
|
|
import { noop } from "lodash";
|
|
|
|
import { createCustomRenderer } from "test/test-utils";
|
|
import AddPatchPolicyModal from "./AddPatchPolicyModal";
|
|
|
|
const renderModal = (props: { gitOpsModeEnabled?: boolean } = {}) => {
|
|
const customRender = createCustomRenderer({
|
|
context: {
|
|
app: {
|
|
config: {
|
|
gitops: {
|
|
gitops_mode_enabled: props.gitOpsModeEnabled ?? false,
|
|
},
|
|
},
|
|
},
|
|
},
|
|
});
|
|
|
|
return customRender(
|
|
<AddPatchPolicyModal
|
|
softwareId={1}
|
|
teamId={1}
|
|
onExit={noop}
|
|
onSuccess={noop}
|
|
{...props}
|
|
/>
|
|
);
|
|
};
|
|
|
|
describe("AddPatchPolicyModal", () => {
|
|
beforeEach(() => {
|
|
jest.resetAllMocks();
|
|
});
|
|
|
|
it("renders add button as disabled when gitOpsModeEnabled is true", async () => {
|
|
const { user } = renderModal({ gitOpsModeEnabled: true });
|
|
|
|
const addButton = screen.getByRole("button", { name: "Add" });
|
|
expect(addButton).toBeDisabled();
|
|
await user.hover(addButton);
|
|
});
|
|
});
|