fleet/frontend/pages/hosts/details/OSSettingsModal/OSSettingsTable/OSSettingStatusCell/OSSettingStatusCell.tests.tsx

44 lines
1.2 KiB
TypeScript
Raw Normal View History

import React from "react";
import { render, screen } from "@testing-library/react";
import { createCustomRenderer } from "test/test-utils";
2023-11-29 14:32:42 +00:00
import { ProfileOperationType } from "interfaces/mdm";
import OSSettingStatusCell from "./OSSettingStatusCell";
describe("OS setting status cell", () => {
it("Correctly displays the status text of a profile", () => {
const status = "verifying";
2023-11-29 14:32:42 +00:00
const operationType: ProfileOperationType = "install";
render(
<OSSettingStatusCell
profileName="Test Profile"
status={status}
operationType={operationType}
/>
);
expect(screen.getByText("Verifying")).toBeInTheDocument();
});
it("Correctly displays the tooltip text for a profile", async () => {
const status = "verifying";
2023-11-29 14:32:42 +00:00
const operationType: ProfileOperationType = "install";
const customRender = createCustomRenderer();
const { user } = customRender(
<OSSettingStatusCell
profileName="Test Profile"
status={status}
operationType={operationType}
/>
);
const statusText = screen.getByText("Verifying");
await user.hover(statusText);
expect(screen.getByText(/verifying/)).toBeInTheDocument();
});
});