Skip to content

Commit

Permalink
fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
xerosanyam committed Aug 20, 2024
1 parent 95d8cc6 commit 93779a3
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions src/routes/(protected)/revise/CardReview.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ describe('CardReview', () => {
it('renders correctly with cards', async () => {
render(CardReview, { cards: mockCards });

expect(screen.getByText('cards reviewed: 0/2')).toBeInTheDocument();
expect(screen.getByText('Reviewed: 0/2')).toBeInTheDocument();
expect(screen.getByText('Question 1')).toBeInTheDocument();
expect(screen.getByText('Question 2')).toBeInTheDocument();
});
Expand Down Expand Up @@ -57,12 +57,12 @@ describe('CardReview', () => {
const easyButton = screen.getAllByText('super easy')[0];
await fireEvent.click(easyButton);

expect(screen.getByText('cards reviewed: 1/2')).toBeInTheDocument();
expect(screen.getByText('Reviewed: 1/2')).toBeInTheDocument();
expect(screen.queryByText('Question 1')).not.toBeInTheDocument();
expect(screen.getByText('Question 2')).toBeInTheDocument();
});

it('shows break message after reviewing 5 cards', async () => {
it('shows correct message after reviewing 5 cards', async () => {
const manyCards = Array(6).fill(null).map((_, i) => ({
id: String(i),
front: `Question ${i}`,
Expand All @@ -79,7 +79,7 @@ describe('CardReview', () => {
await tick();
}

expect(screen.getByText(/Hurray. You revised 5 cards. Take a break or keep going./)).toBeInTheDocument();
expect(screen.getByText('Reviewed: 5/6')).toBeInTheDocument();
});
})

Expand All @@ -93,7 +93,7 @@ describe('CardReview', () => {
await fireEvent.click(deleteButton);

// Assertions for UI updates after deletion
expect(screen.getByText('cards reviewed: 1/2')).toBeInTheDocument();
expect(screen.getByText('Reviewed: 1/2')).toBeInTheDocument();
expect(screen.queryByText('Question 1')).not.toBeInTheDocument();
expect(screen.getByText('Question 2')).toBeInTheDocument();
});
Expand Down

0 comments on commit 93779a3

Please sign in to comment.