fix(web): bound stalled mutations
This commit is contained in:
@@ -72,6 +72,18 @@ test('loads one full notification query on a direct notifications entry', async
|
||||
expect(mocks.alertNotificationsV2.mock.calls[0][0].toString()).toBe('limit=100');
|
||||
});
|
||||
|
||||
test('ends notification mutation feedback with a visible retryable error instead of a silent pending state', async () => {
|
||||
mocks.alertNotificationsV2.mockResolvedValue({ items: [{ id: 7, eventId: 'event-7', title: '车辆告警', content: '测试告警', severity: 'major', read: false, createdAt: '2026-07-16T04:00:00Z' }], total: 1, limit: 100, offset: 0 });
|
||||
mocks.readAlertNotificationsV2.mockRejectedValue(new Error('通知状态更新超时'));
|
||||
const client = new QueryClient({ defaultOptions: { queries: { retry: false }, mutations: { retry: false } } });
|
||||
render(<QueryClientProvider client={client}><MemoryRouter future={ROUTER_FUTURE} initialEntries={['/alerts?tab=notifications']}><AlertsPage /></MemoryRouter></QueryClientProvider>);
|
||||
|
||||
fireEvent.click(await screen.findByRole('button', { name: '标为已读' }));
|
||||
|
||||
expect(await screen.findByText('通知状态更新超时')).toBeInTheDocument();
|
||||
expect(screen.getByRole('button', { name: '标为已读' })).toBeEnabled();
|
||||
});
|
||||
|
||||
test('clears old alert rows and inspector evidence when the event scope changes', async () => {
|
||||
const oldEvent = alertEvent('old-event', 'OLDVIN', '旧告警车牌');
|
||||
const newEvent = alertEvent('new-event', 'NEWVIN', '新告警车牌');
|
||||
|
||||
Reference in New Issue
Block a user