fleet/frontend/components/StatusIndicator/StatusIndicator.tests.tsx
jacobshandling bb4e3c632e
UI - Fix another (less) flakey frontend test (#24110)
- [x] Added/updated tests

test-js (ubuntu-latest) SuccessCount / RunCount:
3/3

Co-authored-by: Jacob Shandling <jacob@fleetdm.com>
2024-11-25 10:28:58 -08:00

23 lines
708 B
TypeScript

import React from "react";
import { render, screen, fireEvent } from "@testing-library/react";
import StatusIndicator from "./StatusIndicator";
describe("Status indicator", () => {
it("renders status as capitalized", () => {
render(<StatusIndicator value="paused" />);
expect(screen.getByText("Paused")).toBeInTheDocument();
});
it("renders optional tooltip on hover", async () => {
const TOOLTIP_TEXT = "Online hosts will respond to a live query.";
render(
<StatusIndicator value="online" tooltip={{ tooltipText: TOOLTIP_TEXT }} />
);
await fireEvent.mouseEnter(screen.getByText("Online"));
expect(screen.getByText(TOOLTIP_TEXT)).toBeInTheDocument();
});
});