7f1c20f553
- Add missing 'src' property to OpeningMetadata test fixtures - Add missing 'id' and 'description' properties to Personality test fixtures - Add missing 'isPlayerWhite' property to EvaluationBar test cases All tests now pass TypeScript validation. No changes to production code.
31 lines
1.1 KiB
TypeScript
31 lines
1.1 KiB
TypeScript
import { render, screen } from "@testing-library/react";
|
|
import { EvaluationBar } from "./EvaluationBar";
|
|
import "@testing-library/jest-dom";
|
|
|
|
describe("EvaluationBar", () => {
|
|
it("renders 0.0 for initial state", () => {
|
|
render(<EvaluationBar score={0} isPlayerWhite={true} />);
|
|
expect(screen.getByText("0.0")).toBeInTheDocument();
|
|
});
|
|
|
|
it("renders positive score for white advantage", () => {
|
|
render(<EvaluationBar score={150} isPlayerWhite={true} />);
|
|
expect(screen.getByText("+1.5")).toBeInTheDocument();
|
|
});
|
|
|
|
it("renders negative score for black advantage", () => {
|
|
render(<EvaluationBar score={-230} isPlayerWhite={true} />);
|
|
expect(screen.getByText("-2.3")).toBeInTheDocument();
|
|
});
|
|
|
|
it("renders mate score", () => {
|
|
render(<EvaluationBar mate={3} isPlayerWhite={true} />);
|
|
expect(screen.getByText("M3")).toBeInTheDocument();
|
|
});
|
|
|
|
it("renders negative mate score", () => {
|
|
render(<EvaluationBar mate={-5} isPlayerWhite={true} />);
|
|
expect(screen.getByText("M5")).toBeInTheDocument();
|
|
});
|
|
});
|