Skip to content

Commit af2ff53

Browse files
committed
test(desktop): fix test typing and remove unused symbols blocking build
1 parent f04307b commit af2ff53

7 files changed

Lines changed: 15 additions & 15 deletions

File tree

.agents/tasks/prd.json

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -541,11 +541,13 @@
541541
"All tests pass with `npm --workspace apps/desktop run test`"
542542
],
543543
"attempts": 1,
544-
"status": "in_progress",
545-
"passes": false,
544+
"status": "done",
545+
"passes": true,
546546
"startedAt": "2026-02-22T14:56:12.699520+00:00",
547-
"completedAt": null,
548-
"updatedAt": "2026-02-22T14:56:12.699542+00:00"
547+
"completedAt": "2026-02-22T15:04:34.879903+00:00",
548+
"updatedAt": "2026-02-22T15:04:34.879903+00:00",
549+
"skipped": false,
550+
"notes": "Completion + verification gate passed."
549551
}
550552
]
551553
}

apps/desktop/src/__tests__/theme.test.ts

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { describe, it, expect, vi, beforeEach, afterEach } from 'vitest'
1+
import { describe, it, expect, vi, beforeEach, afterEach, type MockInstance } from 'vitest'
22
import { renderHook, act } from '@testing-library/react'
33
import { useTheme } from '../hooks/useTheme'
44

@@ -27,7 +27,7 @@ function createMatchMediaMock(prefersDark: boolean) {
2727
// ── Tests ────────────────────────────────────────────────────────────────────
2828

2929
describe('useTheme', () => {
30-
let matchMediaSpy: ReturnType<typeof vi.spyOn>
30+
let matchMediaSpy: MockInstance<Window['matchMedia']>
3131
let matchMediaMock: ReturnType<typeof createMatchMediaMock>
3232

3333
beforeEach(() => {
@@ -37,7 +37,7 @@ describe('useTheme', () => {
3737

3838
// Default: system prefers light
3939
matchMediaMock = createMatchMediaMock(false)
40-
matchMediaSpy = vi.spyOn(window, 'matchMedia').mockReturnValue(matchMediaMock.mql as any)
40+
matchMediaSpy = vi.spyOn(window, 'matchMedia').mockReturnValue(matchMediaMock.mql as unknown as MediaQueryList)
4141
})
4242

4343
afterEach(() => {
@@ -57,7 +57,7 @@ describe('useTheme', () => {
5757

5858
it('defaults to dark when system prefers dark', () => {
5959
matchMediaMock = createMatchMediaMock(true)
60-
matchMediaSpy.mockReturnValue(matchMediaMock.mql as any)
60+
matchMediaSpy.mockReturnValue(matchMediaMock.mql as unknown as MediaQueryList)
6161

6262
const { result } = renderHook(() => useTheme())
6363

@@ -126,7 +126,7 @@ describe('useTheme', () => {
126126
it('falls back to system preference when localStorage has no theme', () => {
127127
// Start with system-dark and no saved preference
128128
matchMediaMock = createMatchMediaMock(true)
129-
matchMediaSpy.mockReturnValue(matchMediaMock.mql as any)
129+
matchMediaSpy.mockReturnValue(matchMediaMock.mql as unknown as MediaQueryList)
130130

131131
const { result } = renderHook(() => useTheme())
132132

@@ -158,7 +158,7 @@ describe('useTheme', () => {
158158

159159
// System prefers dark
160160
matchMediaMock = createMatchMediaMock(true)
161-
matchMediaSpy.mockReturnValue(matchMediaMock.mql as any)
161+
matchMediaSpy.mockReturnValue(matchMediaMock.mql as unknown as MediaQueryList)
162162

163163
const { result } = renderHook(() => useTheme())
164164

apps/desktop/src/__tests__/workspaceLifecycle.test.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@ import {
1313
setActiveWorkspace,
1414
upsertWorkspace,
1515
updateWorkspaceSession,
16-
WORKSPACE_STORE_KEY,
1716
type WorkspaceSessionSnapshotInput,
1817
type WorkspaceStore,
1918
} from '../utils/workspaceStore'

apps/desktop/src/components/ErrorBanner.test.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { describe, it, expect, vi, beforeEach, afterEach } from 'vitest'
2-
import { render, screen, act, waitFor } from '@testing-library/react'
2+
import { render, screen, act } from '@testing-library/react'
33
import userEvent from '@testing-library/user-event'
44
import { useState, useEffect, useCallback } from 'react'
55
import { ErrorBanner } from './ErrorBanner'

apps/desktop/src/components/SelectedFilesPanel.test.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { describe, it, expect, vi, beforeEach } from 'vitest'
2-
import { render, screen, within } from '@testing-library/react'
2+
import { render, screen } from '@testing-library/react'
33
import userEvent from '@testing-library/user-event'
44
import { SelectedFilesPanel } from './SelectedFilesPanel'
55
import type { FileDiffStatus } from '@gitcontext/core'

apps/desktop/src/hooks/useFileTree.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -303,7 +303,7 @@ describe('useFileTree race condition prevention', () => {
303303
// Second (fresh) request — resolves immediately
304304
return Promise.resolve({ files: [{ path: 'fresh.ts', type: 'add' }] })
305305
}),
306-
listFiles: vi.fn().mockImplementation((ref: string) => {
306+
listFiles: vi.fn().mockImplementation((_ref: string) => {
307307
// For the second (fresh) request these resolve instantly.
308308
// For the first (stale) request, getDiff hasn't resolved yet so
309309
// listFiles will only be reached if getDiff resolves, and by then

apps/desktop/src/utils/diff.test.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,6 @@ describe('createUnifiedDiffForPath', () => {
8888
expect(result).toContain('+X')
8989
// With 0 context, surrounding unchanged lines should not appear as context
9090
const lines = result.split('\n')
91-
const contextLines = lines.filter((l) => l.startsWith(' ') && l.trim().length > 0)
9291
// The only space-prefixed lines should be from the patch header, not content context
9392
// Filter out the header area
9493
const afterHunk = lines.slice(lines.findIndex((l) => l.startsWith('@@')))

0 commit comments

Comments
 (0)