import React from "react"; import { render, screen, waitFor } from "@testing-library/react"; import { createCustomRenderer } from "test/test-utils"; import { FLEET_ANDROID_CERTIFICATE_TEMPLATE_PROFILE_ID, 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"; const operationType: ProfileOperationType = "install"; render( ); expect(screen.getByText("Verifying")).toBeInTheDocument(); }); it("Correctly displays the tooltip text for a profile", async () => { const status = "verifying"; const operationType: ProfileOperationType = "install"; const customRender = createCustomRenderer(); const { user } = customRender( ); const statusText = screen.getByText("Verifying"); await user.hover(statusText); await waitFor(() => { expect(screen.getByText(/verifying/)).toBeInTheDocument(); }); }); // Android cert statuses it("Displays Pending UI for 'pending' status with optype 'install'", async () => { const customRender = createCustomRenderer(); const { user } = customRender( ); const statusText = screen.getByText("Enforcing"); expect(statusText).toBeInTheDocument(); await user.hover(statusText); await waitFor(() => { expect( screen.getByText(/The host is running the command/) ).toBeInTheDocument(); }); }); it("Displays Pending UI for 'delivering' status with optype 'install'", async () => { const customRender = createCustomRenderer(); const { user } = customRender( ); const statusText = screen.getByText("Enforcing"); expect(statusText).toBeInTheDocument(); await user.hover(statusText); await waitFor(() => { expect( screen.getByText(/The host is running the command/) ).toBeInTheDocument(); }); }); it("Displays Pending UI for 'delivered' status with optype 'install'", async () => { const customRender = createCustomRenderer(); const { user } = customRender( ); const statusText = screen.getByText("Enforcing"); expect(statusText).toBeInTheDocument(); await user.hover(statusText); await waitFor(() => { expect( screen.getByText(/The host is running the command/) ).toBeInTheDocument(); }); }); it("Displays Pending UI for 'delivering' status with optype 'remove'", async () => { const customRender = createCustomRenderer(); const { user } = customRender( ); const statusText = screen.getByText("Removing enforcement"); expect(statusText).toBeInTheDocument(); await user.hover(statusText); await waitFor(() => { expect( screen.getByText(/The host is running the command/) ).toBeInTheDocument(); }); }); it("Displays Pending UI for 'delivered' status with optype 'remove'", async () => { const customRender = createCustomRenderer(); const { user } = customRender( ); const statusText = screen.getByText("Removing enforcement"); expect(statusText).toBeInTheDocument(); await user.hover(statusText); await waitFor(() => { expect( screen.getByText(/The host is running the command/) ).toBeInTheDocument(); }); }); });