import { render, screen } from "@solidjs/testing-library";
import { describe, expect, it } from "vitest";
import { Badge } from "../../../src/components/badge/index";

describe("Badge", () => {
	it("has role=status", () => {
		render(() => <Badge>New</Badge>);
		expect(screen.getByRole("status")).toBeTruthy();
	});
	it("renders children", () => {
		render(() => <Badge>5</Badge>);
		expect(screen.getByText("5")).toBeTruthy();
	});
	it("spreads props", () => {
		render(() => (
			<Badge data-testid="b" class="red">
				Hot
			</Badge>
		));
		expect(screen.getByTestId("b").getAttribute("class")).toBe("red");
	});
});
