diff --git a/src/components/badge/badge.test.tsx b/src/components/badge/badge.test.tsx new file mode 100644 index 00000000..90ac4187 --- /dev/null +++ b/src/components/badge/badge.test.tsx @@ -0,0 +1,30 @@ +import { render, screen } from "@testing-library/react"; +import React from "react"; +import { describe, expect, it } from "vitest"; +import { Badge } from "./badge"; + +describe("Badge", () => { + it("renders a badge with default appearance and passed string", () => { + const text = "Default Badge"; + // ARRANGE + render({text}); + + // ASSERT + const badge = screen.getByText(text); + expect(badge).toBeInTheDocument(); + expect(badge).toHaveAttribute("role", "button"); + expect(badge).toHaveClass("rounded"); + }); + + it("renders a badge with rounded appearance and passed string", () => { + const text = "Rounded Badge"; + // ARRANGE + render({text}); + + // ASSERT + const badge = screen.getByText(text); + expect(badge).toBeInTheDocument(); + expect(badge).toHaveAttribute("role", "button"); + expect(badge).toHaveClass("rounded-full"); + }); +});