mirror of
https://github.com/Comfy-Org/ComfyUI_frontend.git
synced 2026-02-06 08:00:05 +00:00
test: replace MockEvents with Partial<CustomEventTarget> in ToOutputRenderLink.test.ts
Remove the bespoke MockEvents interface and use typed Partial of the real CustomEventTarget<LinkConnectorEventMap> for event mocks to ensure alignment with the actual type contract.
This commit is contained in:
@@ -13,13 +13,6 @@ import {
|
||||
createMockNodeOutputSlot
|
||||
} from '@/utils/__tests__/litegraphTestUtils'
|
||||
|
||||
interface MockEvents {
|
||||
addEventListener: ReturnType<typeof vi.fn>
|
||||
removeEventListener: ReturnType<typeof vi.fn>
|
||||
dispatchEvent: ReturnType<typeof vi.fn>
|
||||
dispatch: ReturnType<typeof vi.fn>
|
||||
}
|
||||
|
||||
describe('ToOutputRenderLink', () => {
|
||||
describe('connectToOutput', () => {
|
||||
it('should return early if inputNode is null', () => {
|
||||
@@ -47,7 +40,7 @@ describe('ToOutputRenderLink', () => {
|
||||
const mockTargetNode = createMockLGraphNode({
|
||||
connectSlots: vi.fn()
|
||||
})
|
||||
const mockEvents: MockEvents = {
|
||||
const mockEvents: Partial<CustomEventTarget<LinkConnectorEventMap>> = {
|
||||
addEventListener: vi.fn(),
|
||||
removeEventListener: vi.fn(),
|
||||
dispatchEvent: vi.fn(),
|
||||
@@ -87,7 +80,7 @@ describe('ToOutputRenderLink', () => {
|
||||
const mockTargetNode = createMockLGraphNode({
|
||||
connectSlots: vi.fn().mockReturnValue(mockNewLink)
|
||||
})
|
||||
const mockEvents: MockEvents = {
|
||||
const mockEvents: Partial<CustomEventTarget<LinkConnectorEventMap>> = {
|
||||
addEventListener: vi.fn(),
|
||||
removeEventListener: vi.fn(),
|
||||
dispatchEvent: vi.fn(),
|
||||
|
||||
Reference in New Issue
Block a user