Skip to content

Commit

Permalink
Fix: made page.tsx testing that passes but has an error.
Browse files Browse the repository at this point in the history
  • Loading branch information
alexappleget committed Oct 16, 2024
1 parent 1559c7d commit 798ff07
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions app/(admin)/admin/leagues/page.test.tsx
Original file line number Diff line number Diff line change
@@ -1,12 +1,20 @@
import { render, screen, waitFor } from '@testing-library/react';
import AdminLeagues from './page';

jest.mock('@/store/dataStore', () => ({
useDataStore: jest.fn().mockReturnValue({
user: { leagues: ['league1', 'league2'] },
}),
}));

describe('AdminLeagues', () => {
beforeEach(() => {
render(<AdminLeagues />);
})
it('should render the League data table component', async () => {
const leagueTable = screen.getByTestId('data-table');
expect(leagueTable).toBe(1);
await waitFor(() => {
const leagueTable = screen.getByTestId('data-table');
expect(leagueTable).toBeInTheDocument(); // Verifies table is present
});
});
});

0 comments on commit 798ff07

Please sign in to comment.