-
Notifications
You must be signed in to change notification settings - Fork 54
/
Copy pathapp.test.tsx
36 lines (31 loc) · 919 Bytes
/
app.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
36
import { renderRoot, screen, render, within } from "./utils";
test("renders user's full name", () => {
renderRoot();
const userNameElement = screen.getByText(/Oluwatobi Akindunjoye/i);
expect(userNameElement).toBeInTheDocument();
});
test("renders sidebar links", () => {
renderRoot();
const sidebarLinks = [
"Wallets",
"Prices",
"Peer2Peer",
"Activity",
"Settings",
];
sidebarLinks.forEach((link) => {
const linkElement = screen.getByText(RegExp(link, "i"));
expect(linkElement).toBeInTheDocument();
});
});
test.skip("smoke test within shit", () => {
render(
<div data-testid="logo">
<img src="logo.svg" alt="logo" /> <h2>Logo</h2>
</div>
);
const logoContainer = screen.getByTestId(/Logo/i);
const logoImg = within(logoContainer).getByRole("img");
expect(logoImg).toBeInTheDocument();
expect(logoImg).toHaveAttribute("src", "logo.svg");
});