Skip to content

Commit 2315e4f

Browse files
committed
✔️ fix: Update unit test for landing page
1 parent 1e9a8e0 commit 2315e4f

File tree

2 files changed

+7
-8
lines changed

2 files changed

+7
-8
lines changed

__tests__/pages/landing.test.tsx

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,11 @@ import '@testing-library/jest-dom';
22
import { render, screen } from '@testing-library/react';
33
import Home from '@/app/page';
44

5-
it('renders main page with the text "Get started by editing"', () => {
5+
it('renders 6 change logs', () => {
66
render(<Home />);
7-
const login = screen.getAllByText(/\bLogin\b/i).length;
8-
expect(login).toBe(2);
9-
10-
const register = screen.getAllByText(/\bRegister\b/i).length;
11-
expect(register).toBe(2);
7+
// Finds all p tags with date logs
8+
const numListItems = screen
9+
.getByTestId('changelog')
10+
.querySelectorAll('p').length;
11+
expect(numListItems).toBe(6);
1212
});

src/app/page.tsx

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,6 @@ export default function Home() {
2323
programming contest problems. Polygon supports the whole development
2424
cycle:
2525
</Typography>
26-
{/* The following has to have a list using Tailwind CSS */}
2726
<ul className='list-disc list-inside'>
2827
<li>problem statement writing</li>
2928
<li>test data preparing (generators supported)</li>
@@ -44,7 +43,7 @@ export default function Home() {
4443
Invokers waiting: {serviceSummary.numInvokers}
4544
</Typography>
4645
</Paper>
47-
<Paper sx={{ p: 2 }} elevation={3}>
46+
<Paper sx={{ p: 2 }} elevation={3} data-testid='changelog'>
4847
{changeLogs.map((log, index) => (
4948
<Typography key={index} variant='body2'>
5049
{log}

0 commit comments

Comments
 (0)