refine Semi UI alert workspace
This commit is contained in:
@@ -71,10 +71,10 @@ test('loads only event dependencies on the default alert tab', async () => {
|
||||
expect(mocks.alertRulesV2).toHaveBeenCalledTimes(1);
|
||||
expect(mocks.metricCatalog).not.toHaveBeenCalled();
|
||||
expect(mocks.alertNotificationsV2).toHaveBeenCalledTimes(1);
|
||||
expect(mocks.alertNotificationsV2.mock.calls[0][0].toString()).toBe('unreadOnly=true&limit=100');
|
||||
expect(mocks.alertNotificationsV2.mock.calls[0][0].toString()).toBe('unreadOnly=true&limit=1');
|
||||
});
|
||||
|
||||
test('loads one full notification query on a direct notifications entry', async () => {
|
||||
test('loads a paginated notification page and an independent unread total on direct entry', async () => {
|
||||
mocks.alertNotificationsV2.mockResolvedValue({ items: [], total: 0, limit: 100, offset: 0 });
|
||||
const client = new QueryClient({ defaultOptions: { queries: { retry: false } } });
|
||||
const view = render(<QueryClientProvider client={client}><MemoryRouter future={ROUTER_FUTURE} initialEntries={['/alerts?tab=notifications']}><AlertsPage /></MemoryRouter></QueryClientProvider>);
|
||||
@@ -84,12 +84,17 @@ test('loads one full notification query on a direct notifications entry', async
|
||||
expect(view.container.querySelector('.v2-alert-notifications')).toHaveClass('semi-card');
|
||||
expect(screen.getByRole('heading', { level: 5, name: '站内通知' })).toBeInTheDocument();
|
||||
expect(view.container.querySelector('.v2-alert-notification-empty.semi-empty')).toBeInTheDocument();
|
||||
expect(view.container.querySelector('.v2-alert-notification-pagination')).toBeInTheDocument();
|
||||
expect(screen.getByRole('combobox', { name: '每页通知数' })).toBeInTheDocument();
|
||||
expect(view.container.querySelector('.v2-alert-channel-card.semi-card')).toBeInTheDocument();
|
||||
expect(view.container.querySelector('.v2-alert-channel-descriptions.semi-descriptions')).toBeInTheDocument();
|
||||
expect(mocks.alertRulesV2).not.toHaveBeenCalled();
|
||||
expect(mocks.metricCatalog).not.toHaveBeenCalled();
|
||||
expect(mocks.alertNotificationsV2).toHaveBeenCalledTimes(1);
|
||||
expect(mocks.alertNotificationsV2.mock.calls[0][0].toString()).toBe('limit=100');
|
||||
expect(mocks.alertNotificationsV2).toHaveBeenCalledTimes(2);
|
||||
expect(mocks.alertNotificationsV2.mock.calls.map(([params]) => params.toString())).toEqual(expect.arrayContaining([
|
||||
'unreadOnly=true&limit=1',
|
||||
'limit=20&offset=0'
|
||||
]));
|
||||
});
|
||||
|
||||
test('ends notification mutation feedback with a visible retryable error instead of a silent pending state', async () => {
|
||||
|
||||
Reference in New Issue
Block a user