mirror of
https://github.com/chriswritescode-dev/opencode-manager.git
synced 2026-12-06 12:54:20 +01:00
chore: clean up test suite per audit recommendations (#299)
Executes recommendations from a comprehensive test suite audit. Removes dead, redundant, and trivial tests; rewrites SessionDetail polling test to exercise real gating; trims duplicated assertions; adds missing assertion in assistant-loading tests. 13 files changed, 233 insertions(+), 462 deletions(-)
This commit is contained in:
1 parent
a9b6f7ce46
commit
446d425e2e
13 files changed
+231
-460
No files matched your search
@@ -52,9 +52,6 @@ describe('useScheduleTarget', () => {
|
||||
})
|
||||
|
||||
expect(result.current.scheduleTarget?.kind).toBe('assistant')
|
||||
expect(result.current.scheduleTarget?.fullPath).toBe('/abs/assistant')
|
||||
expect(result.current.scheduleTarget?.repoId).toBe(0)
|
||||
expect(result.current.scheduleTarget?.backHref).toBe('/assistant')
|
||||
expect(result.current.isLoading).toBe(false)
|
||||
expect(result.current.isError).toBe(false)
|
||||
})
|
||||
@@ -98,9 +95,6 @@ describe('useScheduleTarget', () => {
|
||||
})
|
||||
|
||||
expect(result.current.scheduleTarget?.kind).toBe('repo')
|
||||
expect(result.current.scheduleTarget?.repoId).toBe(5)
|
||||
expect(result.current.scheduleTarget?.fullPath).toBe('/abs/repos/my-repo')
|
||||
expect(result.current.scheduleTarget?.backHref).toBe('/repos/5')
|
||||
})
|
||||
|
||||
it('does not call getAssistantModeStatus for repo', async () => {
|
||||
|
||||
@@ -137,52 +137,6 @@ describe('useLSPStatus', () => {
|
||||
expect(result.current.error).toBeTruthy()
|
||||
})
|
||||
|
||||
it('should have 30s refetch interval', async () => {
|
||||
mockGetLSPStatus.mockResolvedValue([])
|
||||
vi.mocked(useOpenCodeClient).mockReturnValue(mockClient)
|
||||
|
||||
const queryClient = new QueryClient({
|
||||
defaultOptions: { queries: { retry: false } }
|
||||
})
|
||||
const wrapper = ({ children }: { children: React.ReactNode }) => (
|
||||
<QueryClientProvider client={queryClient}>{children}</QueryClientProvider>
|
||||
)
|
||||
|
||||
const { result } = renderHook(() => useLSPStatus('http://localhost:5551', '/test'), {
|
||||
wrapper
|
||||
})
|
||||
|
||||
await waitFor(() => {
|
||||
expect(result.current.isSuccess).toBe(true)
|
||||
})
|
||||
|
||||
const observer = queryClient.getQueryCache().find({ queryKey: ['opencode', 'lsp', 'http://localhost:5551', '/test'] })
|
||||
expect((observer?.options as any).refetchInterval).toBe(30000)
|
||||
})
|
||||
|
||||
it('should have 10s stale time', async () => {
|
||||
mockGetLSPStatus.mockResolvedValue([])
|
||||
vi.mocked(useOpenCodeClient).mockReturnValue(mockClient)
|
||||
|
||||
const queryClient = new QueryClient({
|
||||
defaultOptions: { queries: { retry: false } }
|
||||
})
|
||||
const wrapper = ({ children }: { children: React.ReactNode }) => (
|
||||
<QueryClientProvider client={queryClient}>{children}</QueryClientProvider>
|
||||
)
|
||||
|
||||
const { result } = renderHook(() => useLSPStatus('http://localhost:5551', '/test'), {
|
||||
wrapper
|
||||
})
|
||||
|
||||
await waitFor(() => {
|
||||
expect(result.current.isSuccess).toBe(true)
|
||||
})
|
||||
|
||||
const observer = queryClient.getQueryCache().find({ queryKey: ['opencode', 'lsp', 'http://localhost:5551', '/test'] })
|
||||
expect((observer?.options as any).staleTime).toBe(10000)
|
||||
})
|
||||
|
||||
it('should refetch on window focus', async () => {
|
||||
mockGetLSPStatus.mockResolvedValue([])
|
||||
vi.mocked(useOpenCodeClient).mockReturnValue(mockClient)
|
||||
|
||||
Reference in new issue
Block a user