import { describe, it, expect } from "vitest";
import { render } from "@testing-library/react";
import { LineSeriesChart } from "../LineSeriesChart";
import type { ChartSeries } from "../LineSeriesChart";

describe("LineSeriesChart", () => {
	it("renders without crashing with series data", () => {
		const series: ChartSeries[] = [
			{
				label: "cpu",
				points: [
					{ t: 1000, v: 0.5 },
					{ t: 2000, v: 0.8 },
				],
			},
		];
		const { container } = render(<LineSeriesChart series={series} />);
		// ResponsiveContainer renders a wrapper div even in jsdom
		expect(container.firstChild).not.toBeNull();
	});

	it("renders without crashing with empty series", () => {
		const { container } = render(<LineSeriesChart series={[]} />);
		expect(container.firstChild).not.toBeNull();
	});

	it("renders with custom height", () => {
		const series: ChartSeries[] = [{ label: "dl", points: [{ t: 1, v: 1 }] }];
		const { container } = render(
			<LineSeriesChart series={series} height={200} />,
		);
		expect(container.firstChild).not.toBeNull();
	});
});
