fix(uptime): implement initial uptime bootstrap logic and related tests

This commit is contained in:
GitHub Actions
2026-03-02 03:40:08 +00:00
parent 8cbd907d82
commit 10259146df
6 changed files with 333 additions and 12 deletions
@@ -139,6 +139,23 @@ describe('Uptime page', () => {
expect(screen.getByText('Loading monitors...')).toBeInTheDocument()
})
it('falls back to DOWN status when monitor status is unknown', async () => {
const { getMonitors, getMonitorHistory } = await import('../../api/uptime')
const monitor = {
id: 'm-unknown-status', name: 'UnknownStatusMonitor', url: 'http://example.com', type: 'http', interval: 60, enabled: true,
status: 'mystery', last_check: new Date().toISOString(), latency: 10, max_retries: 3,
}
vi.mocked(getMonitors).mockResolvedValue([monitor])
vi.mocked(getMonitorHistory).mockResolvedValue([])
renderWithQueryClient(<Uptime />)
await waitFor(() => expect(screen.getByText('UnknownStatusMonitor')).toBeInTheDocument())
const badge = screen.getByTestId('status-badge')
expect(badge).toHaveAttribute('data-status', 'down')
expect(badge).toHaveTextContent('DOWN')
})
it('renders empty state when no monitors exist', async () => {
const { getMonitors } = await import('../../api/uptime')
vi.mocked(getMonitors).mockResolvedValue([])