mirror of
https://github.com/empayre/fleet.git
synced 2024-11-07 01:15:22 +00:00
51 lines
1.4 KiB
TypeScript
51 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={["macOS", "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={["macOS"]}
|
|
error={{ name: "Error", message: "The resource was not found." }}
|
|
/>
|
|
);
|
|
|
|
const text = screen.getByText(/possible syntax error/i);
|
|
|
|
expect(text).toBeInTheDocument();
|
|
});
|
|
});
|