mirror of
https://github.com/fleetdm/fleet
synced 2026-05-16 13:38:43 +00:00
25 lines
745 B
TypeScript
25 lines
745 B
TypeScript
import React from "react";
|
|
import { render, screen, fireEvent, act } 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 act(async () => {
|
|
fireEvent.mouseEnter(screen.getByText("Online"));
|
|
});
|
|
|
|
expect(screen.getByText(TOOLTIP_TEXT)).toBeInTheDocument();
|
|
});
|
|
});
|