Skip to content

Commit

Permalink
Merge branch 'nk-add-items-from-list-page'
Browse files Browse the repository at this point in the history
  • Loading branch information
kweeuhree committed Oct 17, 2024
2 parents 69c1c17 + 39e2433 commit 2375aa5
Showing 1 changed file with 14 additions and 14 deletions.
28 changes: 14 additions & 14 deletions tests/List.test.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,20 @@ describe('List Component', () => {
});
});

test('shows AddItems component with existing items', () => {
render(
<MemoryRouter>
<List data={mockShoppingListData} listPath={'/groceries'} />
</MemoryRouter>,
);

expect(screen.getByLabelText('Item Name:')).toBeInTheDocument();
expect(screen.getByLabelText('Soon')).toBeInTheDocument();
expect(screen.getByLabelText('Kind of soon')).toBeInTheDocument();
expect(screen.getByLabelText('Not soon')).toBeInTheDocument();
expect(screen.getByText('Submit')).toBeInTheDocument();
});

test('shows welcome message and AddItems component when no items are present', () => {
render(
<MemoryRouter>
Expand Down Expand Up @@ -108,18 +122,4 @@ describe('List Component', () => {
'It seems like you landed here without first creating a list or selecting an existing one. Please select or create a new list first. Redirecting to Home.',
);
});

test('shows AddItems component with existing items', () => {
render(
<MemoryRouter>
<List data={mockShoppingListData} listPath={'/groceries'} />
</MemoryRouter>,
);

expect(screen.getByLabelText('Item Name:')).toBeInTheDocument();
expect(screen.getByLabelText('Soon')).toBeInTheDocument();
expect(screen.getByLabelText('Kind of soon')).toBeInTheDocument();
expect(screen.getByLabelText('Not soon')).toBeInTheDocument();
expect(screen.getByText('Submit')).toBeInTheDocument();
});
});

0 comments on commit 2375aa5

Please sign in to comment.