forked from Lilly-Protocol/lily-frontend
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathempty-state.test.tsx
More file actions
44 lines (39 loc) · 1.36 KB
/
Copy pathempty-state.test.tsx
File metadata and controls
44 lines (39 loc) · 1.36 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
import { render, screen } from "@testing-library/react";
import { EmptyState } from "./empty-state";
describe("EmptyState", () => {
it("renders its icon, title, and description without an action", () => {
render(
<EmptyState
icon={<span data-testid="empty-state-icon">Icon</span>}
title="No activity yet"
description="Completed activity will appear here."
/>,
);
expect(screen.getByTestId("empty-state-icon")).toBeInTheDocument();
const heading = screen.getByRole("heading", {
level: 2,
name: "No activity yet",
});
expect(heading).toBeInTheDocument();
expect(heading.closest("section")).toHaveClass("surface");
expect(
screen.getByText("Completed activity will appear here."),
).toBeInTheDocument();
expect(screen.queryByRole("button")).not.toBeInTheDocument();
});
it("renders optional eyebrow and call-to-action content", () => {
render(
<EmptyState
icon={<span aria-hidden="true">+</span>}
eyebrow="Wallets"
title="No wallets yet"
description="Create a wallet to start receiving payments."
action={<button type="button">Create wallet</button>}
/>,
);
expect(screen.getByText("Wallets")).toHaveClass("eyebrow");
expect(
screen.getByRole("button", { name: "Create wallet" }),
).toBeInTheDocument();
});
});