test(journey-item-row): add red test — note remove must restore on patch failure
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -66,6 +66,26 @@ describe('JourneyItemRow — note error state', () => {
|
||||
});
|
||||
});
|
||||
|
||||
describe('JourneyItemRow — note remove error state', () => {
|
||||
it('restores note and shows error when onNotePatch rejects during remove', async () => {
|
||||
const onNotePatch = vi.fn().mockRejectedValue(new Error('server error'));
|
||||
render(JourneyItemRow, {
|
||||
item: docItem({ note: 'keep me' }),
|
||||
...defaultProps({ onNotePatch })
|
||||
});
|
||||
|
||||
await userEvent.click(page.getByText('Notiz entfernen'));
|
||||
await new Promise((r) => setTimeout(r, 50));
|
||||
|
||||
// textarea should be visible again (showNote restored)
|
||||
await expect
|
||||
.element(page.getByRole('textbox', { name: /Kuratoren-Notiz/ }))
|
||||
.toBeInTheDocument();
|
||||
// error alert should be shown
|
||||
await expect.element(page.getByRole('alert')).toBeInTheDocument();
|
||||
});
|
||||
});
|
||||
|
||||
describe('JourneyItemRow — interlude rules', () => {
|
||||
it('does not show "Notiz entfernen" for interlude items', async () => {
|
||||
render(JourneyItemRow, { item: interludeItem(), ...defaultProps() });
|
||||
|
||||
Reference in New Issue
Block a user