forked from Cambly/syntax
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Card.test.tsx
35 lines (33 loc) · 799 Bytes
/
Card.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
32
33
34
35
import { screen, render } from "@testing-library/react";
import Card from "./Card";
import Box from "../Box/Box";
describe("card", () => {
it("should render children successfully", () => {
render(
<Card>
<>
<h1>title</h1>
<p>text</p>
</>
</Card>,
);
expect(screen.getByText(/title/)).toBeInTheDocument();
expect(screen.getByText(/text/)).toBeInTheDocument();
});
it("should stretch to the width of the container", () => {
render(
<Box width={1000}>
<Card data-testid="card">
<>
<h1>title</h1>
<p>text</p>
</>
</Card>
</Box>,
);
expect(screen.getByTestId("card")).toHaveStyle({
width: "100%",
maxWidth: undefined,
});
});
});