mirror of
https://github.com/Comfy-Org/ComfyUI_frontend.git
synced 2026-04-29 18:52:19 +00:00
test: remove any type from BaseThumbnail test component instance
- Replace `wrapper.vm as any` with properly typed ComponentInstance - Define ComponentInstance type with error property - Improve type safety for internal state access in tests Part of Phase 2 - Quick wins (1 instance removed)
This commit is contained in:
@@ -4,6 +4,10 @@ import { nextTick } from 'vue'
|
|||||||
|
|
||||||
import BaseThumbnail from '@/components/templates/thumbnails/BaseThumbnail.vue'
|
import BaseThumbnail from '@/components/templates/thumbnails/BaseThumbnail.vue'
|
||||||
|
|
||||||
|
type ComponentInstance = InstanceType<typeof BaseThumbnail> & {
|
||||||
|
error: boolean
|
||||||
|
}
|
||||||
|
|
||||||
vi.mock('@vueuse/core', () => ({
|
vi.mock('@vueuse/core', () => ({
|
||||||
useEventListener: vi.fn()
|
useEventListener: vi.fn()
|
||||||
}))
|
}))
|
||||||
@@ -45,7 +49,7 @@ describe('BaseThumbnail', () => {
|
|||||||
|
|
||||||
it('shows error state when image fails to load', async () => {
|
it('shows error state when image fails to load', async () => {
|
||||||
const wrapper = mountThumbnail()
|
const wrapper = mountThumbnail()
|
||||||
const vm = wrapper.vm as any
|
const vm = wrapper.vm as ComponentInstance
|
||||||
|
|
||||||
// Manually set error since useEventListener is mocked
|
// Manually set error since useEventListener is mocked
|
||||||
vm.error = true
|
vm.error = true
|
||||||
|
|||||||
Reference in New Issue
Block a user