Skip to content

Commit 8a30935

Browse files
tests: update after refactoring to use new form elements
1 parent ce1bc78 commit 8a30935

2 files changed

Lines changed: 9 additions & 12 deletions

File tree

frontend/src/__tests__/componentTests/Browse.test.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,8 +49,8 @@ describe('Browse - WelcomeTutorialCard visibility', () => {
4949
});
5050

5151
const user = userEvent.setup();
52-
const checkbox = screen.getByRole('checkbox', { name: /hide this card/i });
53-
expect(checkbox).not.toBeChecked();
52+
const checkbox = screen.getByRole('checkbox', { name: /show this card/i });
53+
expect(checkbox).toBeChecked();
5454
await user.click(checkbox);
5555

5656
await waitFor(() => {

frontend/src/__tests__/componentTests/WelcomeTutorialCard.test.tsx

Lines changed: 7 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -28,33 +28,30 @@ describe('WelcomeTutorialCard', () => {
2828
});
2929
});
3030

31-
it('displays checkbox with correct label and helper text', async () => {
31+
it('displays checkbox with correct label', async () => {
3232
render(<WelcomeTutorialCard />, { initialEntries: ['/browse'] });
3333

3434
await waitFor(() => {
3535
expect(
36-
screen.getByLabelText(/hide this card.*help page/i)
37-
).toBeInTheDocument();
38-
expect(
39-
screen.getByText(/you can always access tutorials from the help page/i)
36+
screen.getByLabelText(/show this card on startup/i)
4037
).toBeInTheDocument();
4138
});
4239
});
4340

4441
it('checkbox reflects showTutorial preference state', async () => {
4542
render(<WelcomeTutorialCard />, { initialEntries: ['/browse'] });
4643

47-
const checkbox = await screen.findByLabelText(/hide this card.*help page/i);
44+
const checkbox = await screen.findByLabelText(/show this card on startup/i);
4845

49-
// showTutorial is true by default, so checkbox should be unchecked (inverse)
50-
expect(checkbox).not.toBeChecked();
46+
// showTutorial is true by default, so checkbox should be checked
47+
expect(checkbox).toBeChecked();
5148
});
5249

5350
it('toggles preference when checkbox is clicked and shows success toast', async () => {
5451
render(<WelcomeTutorialCard />, { initialEntries: ['/browse'] });
5552

5653
const user = userEvent.setup();
57-
const checkbox = await screen.findByLabelText(/hide this card.*help page/i);
54+
const checkbox = await screen.findByLabelText(/show this card on startup/i);
5855

5956
await user.click(checkbox);
6057

@@ -78,7 +75,7 @@ describe('WelcomeTutorialCard', () => {
7875
render(<WelcomeTutorialCard />, { initialEntries: ['/browse'] });
7976

8077
const user = userEvent.setup();
81-
const checkbox = await screen.findByLabelText(/hide this card.*help page/i);
78+
const checkbox = await screen.findByLabelText(/show this card on startup/i);
8279

8380
await user.click(checkbox);
8481

0 commit comments

Comments
 (0)