Skip to content

Commit 90ab044

Browse files
committed
fix: update desktop maintenance test mocks
1 parent 7aef8c6 commit 90ab044

3 files changed

Lines changed: 12 additions & 12 deletions

File tree

apps/desktop-ui/src/constants/desktopDialogs.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ describe('getDialog', () => {
2828
it('returns a deep clone — mutations do not affect the original', () => {
2929
const result = getDialog('reinstallVenv')
3030
const originalFirstLabel = DESKTOP_DIALOGS.reinstallVenv.buttons[0].label
31-
result.buttons[0].label = 'Mutated'
31+
;(result.buttons as Array<{ label: string }>)[0].label = 'Mutated'
3232
expect(DESKTOP_DIALOGS.reinstallVenv.buttons[0].label).toBe(
3333
originalFirstLabel
3434
)

apps/desktop-ui/src/constants/desktopMaintenanceTasks.test.ts

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,11 @@ import { beforeEach, describe, expect, it, vi } from 'vitest'
33
const { mockElectron } = vi.hoisted(() => ({
44
mockElectron: {
55
setBasePath: vi.fn(),
6-
reinstall: vi.fn<[], Promise<void>>().mockResolvedValue(undefined),
6+
reinstall: vi.fn<() => Promise<void>>().mockResolvedValue(undefined),
77
uv: {
8-
installRequirements: vi.fn<[], Promise<void>>(),
9-
clearCache: vi.fn<[], Promise<void>>().mockResolvedValue(undefined),
10-
resetVenv: vi.fn<[], Promise<void>>().mockResolvedValue(undefined)
8+
installRequirements: vi.fn<() => Promise<void>>(),
9+
clearCache: vi.fn<() => Promise<void>>().mockResolvedValue(undefined),
10+
resetVenv: vi.fn<() => Promise<void>>().mockResolvedValue(undefined)
1111
}
1212
}
1313
}))
@@ -48,24 +48,24 @@ describe('desktopMaintenanceTasks', () => {
4848
})
4949

5050
describe('URL-opening tasks', () => {
51-
it('git execute opens the git download page', () => {
52-
findTask('git').execute()
51+
it('git execute opens the git download page', async () => {
52+
expect(await findTask('git').execute()).toBe(true)
5353
expect(window.open).toHaveBeenCalledWith(
5454
'https://git-scm.com/downloads/',
5555
'_blank'
5656
)
5757
})
5858

59-
it('uv execute opens the uv installation page', () => {
60-
findTask('uv').execute()
59+
it('uv execute opens the uv installation page', async () => {
60+
expect(await findTask('uv').execute()).toBe(true)
6161
expect(window.open).toHaveBeenCalledWith(
6262
'https://docs.astral.sh/uv/getting-started/installation/',
6363
'_blank'
6464
)
6565
})
6666

67-
it('vcRedist execute opens the VC++ redistributable download', () => {
68-
findTask('vcRedist').execute()
67+
it('vcRedist execute opens the VC++ redistributable download', async () => {
68+
expect(await findTask('vcRedist').execute()).toBe(true)
6969
expect(window.open).toHaveBeenCalledWith(
7070
'https://aka.ms/vs/17/release/vc_redist.x64.exe',
7171
'_blank'

apps/desktop-ui/src/utils/electronMirrorCheck.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import { beforeEach, describe, expect, it, vi } from 'vitest'
33
const { mockElectron } = vi.hoisted(() => ({
44
mockElectron: {
55
NetWork: {
6-
canAccessUrl: vi.fn<[url: string], Promise<boolean>>()
6+
canAccessUrl: vi.fn<(url: string) => Promise<boolean>>()
77
}
88
}
99
}))

0 commit comments

Comments
 (0)