Skip to content

Commit 585d504

Browse files
committed
Add initial test files
1 parent ecee115 commit 585d504

File tree

2 files changed

+20
-8
lines changed

2 files changed

+20
-8
lines changed

src/__tests__/App.test.js

-8
This file was deleted.

src/__tests__/Banner.test.js

+20
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
import { render, screen } from '@testing-library/react';
2+
import AppBanner from '../components/shared/AppBanner';
3+
import userEvent from '@testing-library/user-event';
4+
5+
// This runs before each test. This is good instead of having the component render in each test case
6+
const setup = () => render(<AppBanner />);
7+
8+
// Get user event
9+
function setupUserEvent(jsx) {
10+
return {
11+
user: userEvent.setup(),
12+
...render(jsx),
13+
};
14+
}
15+
16+
test('it shows the name in banner', () => {
17+
setup();
18+
const titleElement = screen.getByText(/Hi, Iam Stoman/i);
19+
expect(titleElement).toBeInTheDocument();
20+
});

0 commit comments

Comments
 (0)