fix(planner): exclude current recipe from swap suggestions
Adds excludeRecipeId prop to SwapSuggestionList so the meal being replaced is not offered as a swap candidate. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit was merged in pull request #45.
This commit is contained in:
@@ -74,6 +74,20 @@ describe('SwapSuggestionList', () => {
|
||||
expect(screen.getByTestId('swap-empty-state')).toBeTruthy();
|
||||
});
|
||||
|
||||
it('excludes the recipe being replaced when excludeRecipeId is provided', () => {
|
||||
render(SwapSuggestionList, { props: { ...baseProps, excludeRecipeId: 'r2' } });
|
||||
expect(screen.queryByText('Chicken stir-fry')).toBeNull();
|
||||
expect(screen.getByText('Quick carbonara')).toBeTruthy();
|
||||
expect(screen.getByText('Mushroom risotto')).toBeTruthy();
|
||||
});
|
||||
|
||||
it('shows all recipes when excludeRecipeId is not provided', () => {
|
||||
render(SwapSuggestionList, { props: baseProps });
|
||||
expect(screen.getByText('Quick carbonara')).toBeTruthy();
|
||||
expect(screen.getByText('Chicken stir-fry')).toBeTruthy();
|
||||
expect(screen.getByText('Mushroom risotto')).toBeTruthy();
|
||||
});
|
||||
|
||||
it('disables all Wählen buttons when isLoading is true', () => {
|
||||
render(SwapSuggestionList, { props: { ...baseProps, isLoading: true } });
|
||||
const buttons = screen.getAllByRole('button', { name: /Wählen/i });
|
||||
|
||||
Reference in New Issue
Block a user