import React from "react"; import { render, screen } from "@testing-library/react"; import "@testing-library/jest-dom"; import { ChessPuzzle } from "../.."; import { Root } from "../Root"; import { Puzzle } from "../../../../utils"; describe("ChessPuzzle.Root", () => { const mockPuzzle: Puzzle = { fen: "rnbqkbnr/pppppppp/8/8/8/8/PPPPPPPP/RNBQKBNR w KQkq - 0 1", moves: ["e4", "e5"], }; it("should have correct displayName", () => { expect(Root.displayName).toBe("ChessPuzzle.Root"); }); it("should render children correctly", () => { render(
Child Component
, ); expect(screen.getByTestId("child")).toBeInTheDocument(); expect(screen.getByText("Child Component")).toBeInTheDocument(); }); it("should render multiple children", () => { render(
Child 1
Child 2
Child 3
, ); expect(screen.getByTestId("child-1")).toBeInTheDocument(); expect(screen.getByTestId("child-2")).toBeInTheDocument(); expect(screen.getByTestId("child-3")).toBeInTheDocument(); }); });