fleet/frontend/components/PlatformCompatibility/PlatformCompatibility.tests.tsx
RachelElysia c9e66b221e
Frontend: Lint warning cleanup part 1 (#43411)
## Issue
- First batch of @iansltx 's work of cleaning up lint warnings #43387 

## Description
- Quick PR review and grabbed as many confirmed low-risk quick wins as I
could `git checkout lint-cleanup <file/path/1> <file/path/2>`

<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->
## Summary by CodeRabbit

## Release Notes

This release contains internal code improvements with one minor UI
tweak:

* **Style**
* Dropdown menu background color adjusted for clearer contrast in action
lists
* **Refactor**
* Improved type safety across the codebase with stricter TypeScript
annotations
  * Removed unused imports and constants to reduce code clutter
* Enhanced React hook dependency arrays for more consistent component
behavior
<!-- end of auto-generated comment: release notes by coderabbit.ai -->

---------

Co-authored-by: Rachel Perkins <rachel@Rachels-MacBook-Pro.local>
Co-authored-by: Ian Littman <iansltx@gmail.com>
2026-04-10 19:49:52 -05:00

50 lines
1.4 KiB
TypeScript

import React from "react";
import { render, screen } from "@testing-library/react";
import PlatformCompatibility from "./PlatformCompatibility";
describe("Platform compatibility", () => {
it("renders compatible platforms", () => {
render(
<PlatformCompatibility
compatiblePlatforms={["darwin", "windows"]}
error={null}
/>
);
const macCompatibility = screen.getByText("macOS").firstElementChild;
const windowsCompatibility = screen.getByText("Windows").firstElementChild;
const linuxCompatibility = screen.getByText("Linux").firstElementChild;
expect(macCompatibility).toHaveAttribute(
"class",
"icon compatible-platform"
);
expect(windowsCompatibility).toHaveAttribute(
"class",
"icon compatible-platform"
);
expect(linuxCompatibility).toHaveAttribute(
"class",
"icon incompatible-platform"
);
});
it("renders empty state", () => {
render(<PlatformCompatibility compatiblePlatforms={[]} error={null} />);
const text = screen.getByText(/No platforms/i);
expect(text).toBeInTheDocument();
});
it("renders error state", () => {
render(
<PlatformCompatibility
compatiblePlatforms={["darwin"]}
error={{ name: "Error", message: "The resource was not found." }}
/>
);
const text = screen.getByText(/possible syntax error/i);
expect(text).toBeInTheDocument();
});
});