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:
Johnpaul
2026-01-25 02:54:29 +01:00
parent c416cabd76
commit 97ecec0cb1

View File

@@ -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(),