mirror of
https://github.com/prowler-cloud/prowler.git
synced 2026-07-04 19:21:51 +00:00
2293cab72c
Co-authored-by: Pablo F.G <pablo.fernandez@prowler.com> Co-authored-by: Claude Opus 4.8 <noreply@anthropic.com>
46 lines
1.3 KiB
TypeScript
46 lines
1.3 KiB
TypeScript
import { render, screen } from "@testing-library/react";
|
|
import { describe, expect, it } from "vitest";
|
|
|
|
import { StatusAlert } from "./status-alert";
|
|
|
|
describe("StatusAlert", () => {
|
|
it("renders the info variant with title and children", () => {
|
|
render(
|
|
<StatusAlert variant="info" title="Heads up">
|
|
<span>Something to know.</span>
|
|
</StatusAlert>,
|
|
);
|
|
|
|
expect(screen.getByText("Heads up")).toBeInTheDocument();
|
|
expect(screen.getByText("Something to know.")).toBeInTheDocument();
|
|
});
|
|
|
|
it("renders the error variant with title and children", () => {
|
|
render(
|
|
<StatusAlert variant="error" title="It broke">
|
|
<span>Try again.</span>
|
|
</StatusAlert>,
|
|
);
|
|
|
|
expect(screen.getByText("It broke")).toBeInTheDocument();
|
|
expect(screen.getByText("Try again.")).toBeInTheDocument();
|
|
});
|
|
|
|
it("applies descriptionClassName to the description element", () => {
|
|
render(
|
|
<StatusAlert
|
|
variant="info"
|
|
title="Styled"
|
|
descriptionClassName="w-full gap-3"
|
|
>
|
|
<span>Body</span>
|
|
</StatusAlert>,
|
|
);
|
|
|
|
const description = screen
|
|
.getByText("Body")
|
|
.closest("[data-slot='alert-description']");
|
|
expect(description).toHaveClass("w-full", "gap-3");
|
|
});
|
|
});
|