We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent ecee115 commit 585d504Copy full SHA for 585d504
src/__tests__/App.test.js
src/__tests__/Banner.test.js
@@ -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