test(redesign): establish preservation baseline
Map 57 capability groups before restructuring. Add behavioral regression coverage and a standalone TypeScript gate; retain the native SQLite package failure as separate baseline debt.
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
import React from 'react';
|
||||
import '@testing-library/jest-dom';
|
||||
import { fireEvent, render, screen } from '@testing-library/react';
|
||||
import { fireEvent, render, screen, waitFor } from '@testing-library/react';
|
||||
import { MemoryRouter } from 'react-router-dom';
|
||||
|
||||
import SettingsView from './components/SettingsView';
|
||||
@@ -136,3 +136,30 @@ test('AI privacy settings are server-backed and external processing is local-onl
|
||||
externalProcessingAllowed: false,
|
||||
});
|
||||
});
|
||||
|
||||
test('[PRES-S03] failed notification save preserves the draft for an explicit retry', async () => {
|
||||
mockedApi.put.mockRejectedValueOnce(new Error('offline'));
|
||||
renderView();
|
||||
fireEvent.click(screen.getByRole('tab', { name: /notifications/i }));
|
||||
const preference = await screen.findByLabelText(/email reminders for follow-ups/i);
|
||||
await waitFor(() => expect(preference).toBeChecked());
|
||||
fireEvent.click(preference);
|
||||
fireEvent.click(screen.getByRole('button', { name: /save notification settings/i }));
|
||||
expect(await screen.findByRole('alert')).toHaveTextContent(/could not|failed/i);
|
||||
expect(preference).not.toBeChecked();
|
||||
fireEvent.click(screen.getByRole('button', { name: /save notification settings/i }));
|
||||
await waitFor(() => expect(mockedApi.put).toHaveBeenCalledTimes(2));
|
||||
expect(mockedApi.put).toHaveBeenLastCalledWith('/notification-settings', { emailFollowUpRemindersEnabled: false });
|
||||
await waitFor(() => expect(screen.queryByRole('alert')).not.toBeInTheDocument());
|
||||
});
|
||||
|
||||
test('[PRES-S03 PRES-W11] saving one follow-up rule preserves the other scenarios', async () => {
|
||||
renderView();
|
||||
fireEvent.click(screen.getByRole('tab', { name: /follow-ups/i }));
|
||||
fireEvent.change(await screen.findByLabelText('Applied: follow-up days'), { target: { value: '5' } });
|
||||
fireEvent.click(screen.getByRole('button', { name: /save rules/i }));
|
||||
await waitFor(() => expect(mockedApi.put).toHaveBeenCalledWith('/rules', {
|
||||
id: 1, appliedFollowUpDays: 5, appliedGhostDays: 30,
|
||||
offerFollowUpDays: 7, offerGhostDays: 14, feedbackFollowUpDays: 7, feedbackGhostDays: 14,
|
||||
}));
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user