-
Notifications
You must be signed in to change notification settings - Fork 1
/
skeleton.test.tsx
31 lines (27 loc) · 1.12 KB
/
skeleton.test.tsx
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
import { render, screen } from "@testing-library/react";
import { describe, expect, it } from "vitest";
import { Skeleton } from "./skeleton";
describe("Skeleton", () => {
it("renders without crashing", () => {
render(<Skeleton />);
const skeletonElement = screen.getByRole("presentation");
expect(skeletonElement).toBeInTheDocument();
});
it("has correct default classes", () => {
render(<Skeleton />);
const skeletonElement = screen.getByRole("presentation");
expect(skeletonElement).toHaveClass("animate-pulse rounded-md bg-primary/10");
});
it("correctly applies additional classes", () => {
const additionalClass = "additional-class";
render(<Skeleton className={additionalClass} />);
const skeletonElement = screen.getByRole("presentation");
expect(skeletonElement).toHaveClass("animate-pulse rounded-md bg-primary/10", additionalClass);
});
it("correctly applies additional props", () => {
const testId = "skeleton";
render(<Skeleton data-testid={testId} />);
const skeletonElement = screen.getByTestId(testId);
expect(skeletonElement).toBeInTheDocument();
});
});