Files
prowler/ui/components/shared/status-alert.test.tsx
Pablo Fernandez Guerra (PFE) 2293cab72c fix(ui): adaptive Attack Paths messages for waiting states (#11512)
Co-authored-by: Pablo F.G <pablo.fernandez@prowler.com>
Co-authored-by: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-18 10:03:35 +02:00

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");
});
});