Skip to content

Commit 9ee894e

Browse files
committed
Add test to display numeric point value
1 parent 131e671 commit 9ee894e

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

src/App.test.js

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,3 +6,15 @@ test('displays title correctly', () => {
66
const titleElement = screen.getByText(/endless simple idle game/i);
77
expect(titleElement).toBeInTheDocument();
88
});
9+
test('displays points value', () => {
10+
render(<App />);
11+
const pointsElement = screen.getByText((content, element) => {
12+
const hasText = (node) => node.textContent.match(/points: \d+/i);
13+
const elementHasText = hasText(element);
14+
const childrenDontHaveText = Array.from(element.children).every(
15+
(child) => !hasText(child),
16+
);
17+
return elementHasText && childrenDontHaveText;
18+
});
19+
expect(pointsElement).toBeInTheDocument();
20+
});

0 commit comments

Comments
 (0)