import { beforeEach, describe, expect, it, vi } from 'vitest'; import { fireEvent, render, screen } from '../../../setup/test-utils'; const COLLAPSED_STORAGE_KEY = 'cliproxy-status-widget-collapsed'; const mocks = vi.hoisted(() => ({ noopMutation: () => ({ mutate: vi.fn(), isPending: false }), })); vi.mock('@/hooks/use-cliproxy', () => ({ useProxyStatus: () => ({ data: { running: true, port: 8317, sessionCount: 1 }, isLoading: false, }), useCliproxyUpdateCheck: () => ({ data: { backendLabel: 'CLIProxy', currentVersion: '7.2.137' } }), useCliproxyVersions: () => ({ data: undefined, isLoading: false }), useCliproxyRoutingStrategy: () => ({ data: undefined, isLoading: false, error: null }), useCliproxySessionAffinity: () => ({ data: undefined, isLoading: false, error: null }), useUpdateCliproxyRoutingStrategy: mocks.noopMutation, useUpdateCliproxySessionAffinity: mocks.noopMutation, useStartProxy: mocks.noopMutation, useStopProxy: mocks.noopMutation, useRestartProxy: mocks.noopMutation, useInstallVersion: mocks.noopMutation, })); vi.mock('@/hooks/use-cliproxy-sync', () => ({ useSyncStatus: () => ({ data: { configured: true } }), useExecuteSync: () => ({ mutate: vi.fn(), isPending: false }), })); vi.mock('@/lib/api-client', () => ({ api: { cliproxyServer: { get: () => Promise.resolve({ remote: { enabled: false, host: '' } }), }, }, })); vi.mock('@/components/cliproxy/routing-guidance-card', () => ({ RoutingGuidanceCard: () =>
, })); import { ProxyStatusWidget } from '@/components/monitoring/proxy-status-widget'; describe('ProxyStatusWidget collapse', () => { beforeEach(() => { vi.mocked(window.localStorage.getItem).mockReturnValue(null); vi.mocked(window.localStorage.setItem).mockClear(); }); it('shows the routing and status detail by default', () => { render(