import { describe, it, expect } from "vitest";
import { render, screen } from "@testing-library/react";
import { LibraryOverview } from "../LibraryOverview";
import type { LibraryCount } from "../../types";

const libraries: LibraryCount[] = [
	{
		library: "Films",
		type: "movies",
		movies: 100,
		series: 0,
		episodes: 0,
		total: 100,
	},
	{
		library: "Shows",
		type: "tvshows",
		movies: 0,
		series: 12,
		episodes: 240,
		total: 252,
	},
];

describe("LibraryOverview", () => {
	it("renders movie and TV library cards with their counts", () => {
		render(<LibraryOverview libraries={libraries} />);
		expect(screen.getByText("Movie libraries")).toBeInTheDocument();
		expect(screen.getByText("TV libraries")).toBeInTheDocument();
		expect(screen.getByText("Films")).toBeInTheDocument();
		expect(screen.getByText(/Total: 100 \| Movies: 100/)).toBeInTheDocument();
		expect(screen.getByText("Shows")).toBeInTheDocument();
		expect(screen.getByText(/Total: 252 \| Series: 12/)).toBeInTheDocument();
	});
});
