fleet/frontend/pages/hosts/details/MacSettingsModal/MacSettingsTable/MacSettingStatusCell/MacSettingStatusCell.tests.tsx
Jacob Shandling bbaa225c0e
Refactor macOS settings items (#10019)
# Implements

Encapsulates the specific logic for determining different UI elements
for displaying the status of mac settings in the HostSummary and
MacSettingsTable.

# Checklist for submitter
- [x] Added/updated tests

---------

Co-authored-by: Jacob Shandling <jacob@fleetdm.com>
2023-02-22 16:35:26 -08:00

38 lines
1.2 KiB
TypeScript

import React from "react";
import { render, screen } from "@testing-library/react";
import { createCustomRenderer } from "test/test-utils";
import {
MacMdmProfileOperationType,
MacMdmProfileStatus,
} from "interfaces/mdm";
import MacSettingStatusCell from "./MacSettingStatusCell";
describe("Mac setting status cell", () => {
it("Correctly displays the status text of a profile", () => {
const status: MacMdmProfileStatus = "success";
const operationType: MacMdmProfileOperationType = "install";
render(
<MacSettingStatusCell status={status} operationType={operationType} />
);
expect(screen.getByText("Applied")).toBeInTheDocument();
});
it("Correctly displays the tooltip text for a profile", async () => {
const status: MacMdmProfileStatus = "success";
const operationType: MacMdmProfileOperationType = "install";
const customRender = createCustomRenderer();
const { user } = customRender(
<MacSettingStatusCell status={status} operationType={operationType} />
);
const statusText = screen.getByText("Applied");
await user.hover(statusText);
expect(screen.getByText("Host applied the setting.")).toBeInTheDocument();
});
});