refactor: remove any types from batch 17 test files (10 instances)

Fixed 10 'as any' instances across 3 files:
- ReleaseNotificationToast.test.ts: Used Record<string, unknown> for window electronAPI property
- versionUtil.test.ts: Used proper type casts for null test parameters
- PackVersionSelectorPopover.test.ts: Used Record<string, unknown> for component VM access
This commit is contained in:
Johnpaul
2026-01-22 22:43:18 +01:00
parent cbd5e7fed3
commit df0aba83a0
3 changed files with 11 additions and 11 deletions

View File

@@ -192,7 +192,7 @@ describe('ReleaseNotificationToast', () => {
value: mockWindowOpen,
writable: true
})
;(window as any).electronAPI = {}
;(window as unknown as Record<string, unknown>).electronAPI = {}
wrapper = mountComponent()
await wrapper.vm.handleUpdate()
@@ -203,7 +203,7 @@ describe('ReleaseNotificationToast', () => {
expect(mockWindowOpen).not.toHaveBeenCalled()
expect(toastErrorHandlerMock).not.toHaveBeenCalled()
delete (window as any).electronAPI
delete (window as unknown as Record<string, unknown>).electronAPI
})
it('shows an error toast if the desktop updater flow fails in Electron', async () => {
@@ -220,7 +220,7 @@ describe('ReleaseNotificationToast', () => {
value: mockWindowOpen,
writable: true
})
;(window as any).electronAPI = {}
;(window as unknown as Record<string, unknown>).electronAPI = {}
wrapper = mountComponent()
await wrapper.vm.handleUpdate()
@@ -228,7 +228,7 @@ describe('ReleaseNotificationToast', () => {
expect(toastErrorHandlerMock).toHaveBeenCalledWith(error)
expect(mockWindowOpen).not.toHaveBeenCalled()
delete (window as any).electronAPI
delete (window as unknown as Record<string, unknown>).electronAPI
})
it('calls handleShowChangelog when learn more link is clicked', async () => {

View File

@@ -477,8 +477,8 @@ describe('PackVersionSelectorPopover', () => {
mockCheckNodeCompatibility.mockClear()
// Trigger compatibility check by accessing getVersionCompatibility
const vm = wrapper.vm as any
vm.getVersionCompatibility('1.0.0')
const vm = wrapper.vm as unknown as Record<string, unknown>
;(vm.getVersionCompatibility as (version: string) => unknown)('1.0.0')
// Verify that checkNodeCompatibility was called with correct data
// Since 1.0.0 is the latest version, it should use latest_version data
@@ -565,13 +565,13 @@ describe('PackVersionSelectorPopover', () => {
})
await waitForPromises()
const vm = wrapper.vm as any
const vm = wrapper.vm as unknown as Record<string, unknown>
// Clear previous calls from component mounting/rendering
mockCheckNodeCompatibility.mockClear()
// Test latest version
vm.getVersionCompatibility('latest')
;(vm.getVersionCompatibility as (version: string) => unknown)('latest')
expect(mockCheckNodeCompatibility).toHaveBeenCalledWith({
supported_os: ['windows'],
supported_accelerators: ['CPU'],
@@ -587,7 +587,7 @@ describe('PackVersionSelectorPopover', () => {
mockCheckNodeCompatibility.mockClear()
// Test nightly version
vm.getVersionCompatibility('nightly')
;(vm.getVersionCompatibility as (version: string) => unknown)('nightly')
expect(mockCheckNodeCompatibility).toHaveBeenCalledWith({
id: 'test-pack',
name: 'Test Pack',

View File

@@ -26,7 +26,7 @@ describe('versionUtil', () => {
it('should return null when current version is null', () => {
const result = checkVersionCompatibility(
'comfyui_version',
null as any,
null as unknown as string | undefined,
'>=1.0.0'
)
expect(result).toBeNull()
@@ -50,7 +50,7 @@ describe('versionUtil', () => {
const result = checkVersionCompatibility(
'comfyui_version',
'1.0.0',
null as any
null as unknown as string | undefined
)
expect(result).toBeNull()
})