mirror of
https://github.com/fleetdm/fleet
synced 2026-04-24 06:57:21 +00:00
38 lines
1.4 KiB
TypeScript
38 lines
1.4 KiB
TypeScript
import React from "react";
|
|
import { render, screen } from "@testing-library/react";
|
|
|
|
import { ScheduledQueryablePlatform } from "interfaces/platform";
|
|
import PlatformCell from "./PlatformCell";
|
|
|
|
const SCHEDULED_QUERYABLE_PLATFORMS: ScheduledQueryablePlatform[] = [
|
|
"windows",
|
|
"darwin",
|
|
"linux",
|
|
];
|
|
|
|
describe("Platform cell", () => {
|
|
it("renders platform icons in correct order", () => {
|
|
render(<PlatformCell platforms={SCHEDULED_QUERYABLE_PLATFORMS} />);
|
|
|
|
const icons = screen.queryByTestId("icons");
|
|
const appleIcon = screen.queryByTestId("darwin-icon");
|
|
const linuxIcon = screen.queryByTestId("linux-icon");
|
|
const windowsIcon = screen.queryByTestId("windows-icon");
|
|
|
|
expect(icons?.firstChild).toBe(appleIcon);
|
|
expect(icons?.firstChild?.nextSibling).toBe(windowsIcon);
|
|
expect(icons?.firstChild?.nextSibling?.nextSibling).toBe(linuxIcon);
|
|
});
|
|
it("renders all platforms targeted when no platforms passed in and scheduled", () => {
|
|
render(<PlatformCell platforms={[]} />);
|
|
|
|
const icons = screen.queryByTestId("icons");
|
|
const appleIcon = screen.queryByTestId("darwin-icon");
|
|
const linuxIcon = screen.queryByTestId("linux-icon");
|
|
const windowsIcon = screen.queryByTestId("windows-icon");
|
|
|
|
expect(icons?.firstChild).toBe(appleIcon);
|
|
expect(icons?.firstChild?.nextSibling).toBe(windowsIcon);
|
|
expect(icons?.firstChild?.nextSibling?.nextSibling).toBe(linuxIcon);
|
|
});
|
|
});
|