mirror of
https://github.com/Comfy-Org/ComfyUI_frontend.git
synced 2026-02-20 23:04:06 +00:00
Expect ts errors and remove litegraph test from ts exclude
This commit is contained in:
@@ -6,6 +6,7 @@ import { Rectangle } from '@/lib/litegraph/src/infrastructure/Rectangle'
|
||||
describe('LGraphButton', () => {
|
||||
describe('Constructor', () => {
|
||||
it('should create a button with default options', () => {
|
||||
// @ts-expect-error TODO: Fix after merge - LGraphButton constructor type issues
|
||||
const button = new LGraphButton({})
|
||||
expect(button).toBeInstanceOf(LGraphButton)
|
||||
expect(button.name).toBeUndefined()
|
||||
@@ -13,6 +14,7 @@ describe('LGraphButton', () => {
|
||||
})
|
||||
|
||||
it('should create a button with custom name', () => {
|
||||
// @ts-expect-error TODO: Fix after merge - LGraphButton constructor type issues
|
||||
const button = new LGraphButton({ name: 'test_button' })
|
||||
expect(button.name).toBe('test_button')
|
||||
})
|
||||
@@ -157,6 +159,7 @@ describe('LGraphButton', () => {
|
||||
const button = new LGraphButton({
|
||||
text: '→',
|
||||
fontSize: 20,
|
||||
// @ts-expect-error TODO: Fix after merge - color property not defined in type
|
||||
color: '#FFFFFF',
|
||||
backgroundColor: '#333333',
|
||||
xOffset: -10,
|
||||
|
||||
@@ -43,6 +43,7 @@ describe('LGraphCanvas Title Button Rendering', () => {
|
||||
|
||||
canvasElement.getContext = vi.fn().mockReturnValue(ctx)
|
||||
|
||||
// @ts-expect-error TODO: Fix after merge - LGraphCanvas constructor type issues
|
||||
canvas = new LGraphCanvas(canvasElement, null, {
|
||||
skip_render: true,
|
||||
skip_events: true
|
||||
@@ -54,11 +55,15 @@ describe('LGraphCanvas Title Button Rendering', () => {
|
||||
|
||||
// Mock required methods
|
||||
node.drawTitleBarBackground = vi.fn()
|
||||
// @ts-expect-error Property 'drawTitleBarText' does not exist on type 'LGraphNode'
|
||||
node.drawTitleBarText = vi.fn()
|
||||
node.drawBadges = vi.fn()
|
||||
// @ts-expect-error TODO: Fix after merge - drawToggles not defined in type
|
||||
node.drawToggles = vi.fn()
|
||||
// @ts-expect-error TODO: Fix after merge - drawNodeShape not defined in type
|
||||
node.drawNodeShape = vi.fn()
|
||||
node.drawSlots = vi.fn()
|
||||
// @ts-expect-error TODO: Fix after merge - drawContent not defined in type
|
||||
node.drawContent = vi.fn()
|
||||
node.drawWidgets = vi.fn()
|
||||
node.drawCollapsedSlots = vi.fn()
|
||||
@@ -67,6 +72,7 @@ describe('LGraphCanvas Title Button Rendering', () => {
|
||||
node.drawProgressBar = vi.fn()
|
||||
node._setConcreteSlots = vi.fn()
|
||||
node.arrange = vi.fn()
|
||||
// @ts-expect-error TODO: Fix after merge - isSelectable not defined in type
|
||||
node.isSelectable = vi.fn().mockReturnValue(true)
|
||||
})
|
||||
|
||||
@@ -75,12 +81,14 @@ describe('LGraphCanvas Title Button Rendering', () => {
|
||||
const button1 = node.addTitleButton({
|
||||
name: 'button1',
|
||||
text: 'A',
|
||||
// @ts-expect-error TODO: Fix after merge - visible property not in LGraphButtonOptions
|
||||
visible: true
|
||||
})
|
||||
|
||||
const button2 = node.addTitleButton({
|
||||
name: 'button2',
|
||||
text: 'B',
|
||||
// @ts-expect-error TODO: Fix after merge - visible property not in LGraphButtonOptions
|
||||
visible: true
|
||||
})
|
||||
|
||||
@@ -117,6 +125,7 @@ describe('LGraphCanvas Title Button Rendering', () => {
|
||||
const visibleButton = node.addTitleButton({
|
||||
name: 'visible',
|
||||
text: 'V',
|
||||
// @ts-expect-error TODO: Fix after merge - visible property not in LGraphButtonOptions
|
||||
visible: true
|
||||
})
|
||||
|
||||
@@ -160,6 +169,7 @@ describe('LGraphCanvas Title Button Rendering', () => {
|
||||
const button = node.addTitleButton({
|
||||
name: `button${i}`,
|
||||
text: String(i),
|
||||
// @ts-expect-error TODO: Fix after merge - visible property not in LGraphButtonOptions
|
||||
visible: true
|
||||
})
|
||||
button.getWidth = vi.fn().mockReturnValue(15) // All same width for simplicity
|
||||
@@ -184,6 +194,7 @@ describe('LGraphCanvas Title Button Rendering', () => {
|
||||
const button = node.addTitleButton({
|
||||
name: 'test',
|
||||
text: 'T',
|
||||
// @ts-expect-error TODO: Fix after merge - visible property not in LGraphButtonOptions
|
||||
visible: true
|
||||
})
|
||||
|
||||
@@ -191,6 +202,7 @@ describe('LGraphCanvas Title Button Rendering', () => {
|
||||
const drawSpy = vi.spyOn(button, 'draw')
|
||||
|
||||
// Set low quality rendering
|
||||
// @ts-expect-error TODO: Fix after merge - lowQualityRenderingRequired not defined in type
|
||||
canvas.lowQualityRenderingRequired = true
|
||||
|
||||
canvas.drawNode(node, ctx)
|
||||
@@ -205,12 +217,14 @@ describe('LGraphCanvas Title Button Rendering', () => {
|
||||
const smallButton = node.addTitleButton({
|
||||
name: 'small',
|
||||
text: 'S',
|
||||
// @ts-expect-error TODO: Fix after merge - visible property not in LGraphButtonOptions
|
||||
visible: true
|
||||
})
|
||||
|
||||
const largeButton = node.addTitleButton({
|
||||
name: 'large',
|
||||
text: 'LARGE',
|
||||
// @ts-expect-error TODO: Fix after merge - visible property not in LGraphButtonOptions
|
||||
visible: true
|
||||
})
|
||||
|
||||
@@ -240,6 +254,7 @@ describe('LGraphCanvas Title Button Rendering', () => {
|
||||
const button = node.addTitleButton({
|
||||
name: 'test',
|
||||
text: 'X',
|
||||
// @ts-expect-error TODO: Fix after merge - visible property not in LGraphButtonOptions
|
||||
visible: true
|
||||
})
|
||||
|
||||
|
||||
@@ -39,6 +39,7 @@ describe('LGraphNode Title Buttons', () => {
|
||||
it('should create buttons with default options', () => {
|
||||
const node = new LGraphNode('Test Node')
|
||||
|
||||
// @ts-expect-error TODO: Fix after merge - addTitleButton type issues
|
||||
const button = node.addTitleButton({})
|
||||
|
||||
expect(button).toBeInstanceOf(LGraphButton)
|
||||
@@ -56,6 +57,7 @@ describe('LGraphNode Title Buttons', () => {
|
||||
const button = node.addTitleButton({
|
||||
name: 'close_button',
|
||||
text: 'X',
|
||||
// @ts-expect-error TODO: Fix after merge - visible property not defined in type
|
||||
visible: true
|
||||
})
|
||||
|
||||
@@ -89,6 +91,7 @@ describe('LGraphNode Title Buttons', () => {
|
||||
]
|
||||
|
||||
// Simulate the click - onMouseDown should detect button click
|
||||
// @ts-expect-error TODO: Fix after merge - onMouseDown method type issues
|
||||
const handled = node.onMouseDown(event, clickPosRelativeToNode, canvas)
|
||||
|
||||
expect(handled).toBe(true)
|
||||
@@ -109,6 +112,7 @@ describe('LGraphNode Title Buttons', () => {
|
||||
const button = node.addTitleButton({
|
||||
name: 'test_button',
|
||||
text: 'T',
|
||||
// @ts-expect-error TODO: Fix after merge - visible property not defined in type
|
||||
visible: true
|
||||
})
|
||||
|
||||
@@ -137,6 +141,7 @@ describe('LGraphNode Title Buttons', () => {
|
||||
180 - node.pos[1] // 180 - 200 = -20
|
||||
]
|
||||
|
||||
// @ts-expect-error TODO: Fix after merge - onMouseDown method type issues
|
||||
const handled = node.onMouseDown(event, clickPosRelativeToNode, canvas)
|
||||
|
||||
expect(handled).toBe(false)
|
||||
@@ -151,12 +156,14 @@ describe('LGraphNode Title Buttons', () => {
|
||||
const button1 = node.addTitleButton({
|
||||
name: 'button1',
|
||||
text: 'A',
|
||||
// @ts-expect-error TODO: Fix after merge - visible property not defined in type
|
||||
visible: true
|
||||
})
|
||||
|
||||
const button2 = node.addTitleButton({
|
||||
name: 'button2',
|
||||
text: 'B',
|
||||
// @ts-expect-error TODO: Fix after merge - visible property not defined in type
|
||||
visible: true
|
||||
})
|
||||
|
||||
@@ -196,6 +203,7 @@ describe('LGraphNode Title Buttons', () => {
|
||||
titleY - node.pos[1] // 178 - 200 = -22
|
||||
]
|
||||
|
||||
// @ts-expect-error onMouseDown possibly undefined
|
||||
const handled = node.onMouseDown(event, clickPosRelativeToNode, canvas)
|
||||
|
||||
expect(handled).toBe(true)
|
||||
@@ -252,6 +260,7 @@ describe('LGraphNode Title Buttons', () => {
|
||||
titleY - node.pos[1] // 178 - 200 = -22
|
||||
]
|
||||
|
||||
// @ts-expect-error onMouseDown possibly undefined
|
||||
const handled = node.onMouseDown(event, clickPosRelativeToNode, canvas)
|
||||
|
||||
expect(handled).toBe(true)
|
||||
@@ -268,6 +277,7 @@ describe('LGraphNode Title Buttons', () => {
|
||||
describe('onTitleButtonClick', () => {
|
||||
it('should dispatch litegraph:node-title-button-clicked event', () => {
|
||||
const node = new LGraphNode('Test Node')
|
||||
// @ts-expect-error TODO: Fix after merge - LGraphButton constructor type issues
|
||||
const button = new LGraphButton({ name: 'test_button' })
|
||||
|
||||
const canvas = {
|
||||
|
||||
@@ -333,9 +333,12 @@ describe('LinkConnector Integration', () => {
|
||||
} = graph.getNodeById(nodeId)!
|
||||
|
||||
expect(input.link).toBeNull()
|
||||
// @ts-expect-error toBeOneOf not in type definitions
|
||||
expect(output.links?.length).toBeOneOf([0, undefined])
|
||||
|
||||
// @ts-expect-error toBeOneOf not in type definitions
|
||||
expect(input._floatingLinks?.size).toBeOneOf([0, undefined])
|
||||
// @ts-expect-error toBeOneOf not in type definitions
|
||||
expect(output._floatingLinks?.size).toBeOneOf([0, undefined])
|
||||
}
|
||||
})
|
||||
@@ -533,9 +536,12 @@ describe('LinkConnector Integration', () => {
|
||||
} = graph.getNodeById(nodeId)!
|
||||
|
||||
expect(input.link).toBeNull()
|
||||
// @ts-expect-error toBeOneOf not in type definitions
|
||||
expect(output.links?.length).toBeOneOf([0, undefined])
|
||||
|
||||
// @ts-expect-error toBeOneOf not in type definitions
|
||||
expect(input._floatingLinks?.size).toBeOneOf([0, undefined])
|
||||
// @ts-expect-error toBeOneOf not in type definitions
|
||||
expect(output._floatingLinks?.size).toBeOneOf([0, undefined])
|
||||
}
|
||||
})
|
||||
@@ -849,9 +855,12 @@ describe('LinkConnector Integration', () => {
|
||||
} = graph.getNodeById(nodeId)!
|
||||
|
||||
expect(input.link).toBeNull()
|
||||
// @ts-expect-error toBeOneOf not in type definitions
|
||||
expect(output.links?.length).toBeOneOf([0, undefined])
|
||||
|
||||
// @ts-expect-error toBeOneOf not in type definitions
|
||||
expect(input._floatingLinks?.size).toBeOneOf([0, undefined])
|
||||
// @ts-expect-error toBeOneOf not in type definitions
|
||||
expect(output._floatingLinks?.size).toBeOneOf([0, undefined])
|
||||
}
|
||||
})
|
||||
|
||||
@@ -9,12 +9,14 @@ import {
|
||||
describe('NodeSlot', () => {
|
||||
describe('inputAsSerialisable', () => {
|
||||
it('removes _data from serialized slot', () => {
|
||||
// @ts-expect-error Missing boundingRect property for test
|
||||
const slot: INodeOutputSlot = {
|
||||
_data: 'test data',
|
||||
name: 'test-id',
|
||||
type: 'STRING',
|
||||
links: []
|
||||
}
|
||||
// @ts-expect-error Argument type mismatch for test
|
||||
const serialized = outputAsSerialisable(slot)
|
||||
expect(serialized).not.toHaveProperty('_data')
|
||||
})
|
||||
@@ -27,6 +29,7 @@ describe('NodeSlot', () => {
|
||||
link: null,
|
||||
widget: {
|
||||
name: 'test-widget',
|
||||
// @ts-expect-error TODO: Fix after merge - type property not in IWidgetLocator
|
||||
type: 'combo',
|
||||
value: 'test-value-1',
|
||||
options: {
|
||||
@@ -40,6 +43,7 @@ describe('NodeSlot', () => {
|
||||
})
|
||||
|
||||
it('preserves pos for non-widget input slots', () => {
|
||||
// @ts-expect-error TODO: Fix after merge - missing boundingRect property for test
|
||||
const normalSlot: INodeInputSlot = {
|
||||
name: 'test-id',
|
||||
type: 'STRING',
|
||||
@@ -57,6 +61,7 @@ describe('NodeSlot', () => {
|
||||
link: null,
|
||||
widget: {
|
||||
name: 'test-widget',
|
||||
// @ts-expect-error TODO: Fix after merge - type property not in IWidgetLocator
|
||||
type: 'combo',
|
||||
value: 'test-value-1',
|
||||
options: {
|
||||
|
||||
@@ -20,6 +20,7 @@ export const oldSchemaGraph: ISerialisedGraph = {
|
||||
}
|
||||
],
|
||||
nodes: [
|
||||
// @ts-expect-error TODO: Fix after merge - missing required properties for test
|
||||
{
|
||||
id: 1
|
||||
}
|
||||
@@ -64,6 +65,7 @@ export const basicSerialisableGraph: SerialisableGraph = {
|
||||
}
|
||||
],
|
||||
nodes: [
|
||||
// @ts-expect-error TODO: Fix after merge - missing required properties for test
|
||||
{
|
||||
id: 1,
|
||||
type: 'mustBeSet'
|
||||
|
||||
@@ -84,6 +84,7 @@ describe('ExecutableNodeDTO Creation', () => {
|
||||
|
||||
// Test that wrapper calls original method
|
||||
const args = ['arg1', 'arg2']
|
||||
// @ts-expect-error TODO: Fix after merge - applyToGraph expects different arguments
|
||||
dto.applyToGraph!(args[0], args[1])
|
||||
|
||||
expect(mockApplyToGraph).toHaveBeenCalledWith(args[0], args[1])
|
||||
|
||||
@@ -181,9 +181,13 @@ describe('Subgraph Serialization', () => {
|
||||
|
||||
expect(serialized.inputs).toHaveLength(1)
|
||||
expect(serialized.outputs).toHaveLength(1)
|
||||
// @ts-expect-error TODO: Fix after merge - serialized.inputs possibly undefined
|
||||
expect(serialized.inputs[0].name).toBe('input')
|
||||
// @ts-expect-error TODO: Fix after merge - serialized.inputs possibly undefined
|
||||
expect(serialized.inputs[0].type).toBe('number')
|
||||
// @ts-expect-error TODO: Fix after merge - serialized.outputs possibly undefined
|
||||
expect(serialized.outputs[0].name).toBe('output')
|
||||
// @ts-expect-error TODO: Fix after merge - serialized.outputs possibly undefined
|
||||
expect(serialized.outputs[0].type).toBe('number')
|
||||
}
|
||||
)
|
||||
|
||||
@@ -349,6 +349,7 @@ describe('SubgraphEdgeCases - Performance and Scale', () => {
|
||||
const subgraphNode = createTestSubgraphNode(subgraph)
|
||||
|
||||
// Simulate concurrent operations
|
||||
// @ts-expect-error TODO: Fix after merge - operations implicitly has any[] type
|
||||
const operations = []
|
||||
for (let i = 0; i < 20; i++) {
|
||||
operations.push(
|
||||
@@ -369,6 +370,7 @@ describe('SubgraphEdgeCases - Performance and Scale', () => {
|
||||
|
||||
// Execute all operations - should not crash
|
||||
expect(() => {
|
||||
// @ts-expect-error TODO: Fix after merge - operations implicitly has any[] type
|
||||
for (const op of operations) op()
|
||||
}).not.toThrow()
|
||||
})
|
||||
|
||||
@@ -21,6 +21,7 @@ describe('SubgraphEvents - Event Payload Verification', () => {
|
||||
})
|
||||
})
|
||||
|
||||
// @ts-expect-error TODO: Fix after merge - detail is of type unknown
|
||||
expect(addedEvents[0].detail.input).toBe(input)
|
||||
}
|
||||
)
|
||||
@@ -42,6 +43,7 @@ describe('SubgraphEvents - Event Payload Verification', () => {
|
||||
})
|
||||
})
|
||||
|
||||
// @ts-expect-error TODO: Fix after merge - detail is of type unknown
|
||||
expect(addedEvents[0].detail.output).toBe(output)
|
||||
}
|
||||
)
|
||||
@@ -68,6 +70,7 @@ describe('SubgraphEvents - Event Payload Verification', () => {
|
||||
index: 0
|
||||
})
|
||||
|
||||
// @ts-expect-error TODO: Fix after merge - detail is of type unknown
|
||||
expect(removingEvents[0].detail.input).toBe(input)
|
||||
}
|
||||
)
|
||||
@@ -94,6 +97,7 @@ describe('SubgraphEvents - Event Payload Verification', () => {
|
||||
index: 0
|
||||
})
|
||||
|
||||
// @ts-expect-error TODO: Fix after merge - detail is of type unknown
|
||||
expect(removingEvents[0].detail.output).toBe(output)
|
||||
}
|
||||
)
|
||||
@@ -121,6 +125,7 @@ describe('SubgraphEvents - Event Payload Verification', () => {
|
||||
newName: 'new_name'
|
||||
})
|
||||
|
||||
// @ts-expect-error TODO: Fix after merge - detail is of type unknown
|
||||
expect(renamingEvents[0].detail.input).toBe(input)
|
||||
|
||||
// Verify the label was updated after the event (renameInput sets label, not name)
|
||||
@@ -154,6 +159,7 @@ describe('SubgraphEvents - Event Payload Verification', () => {
|
||||
newName: 'new_name'
|
||||
})
|
||||
|
||||
// @ts-expect-error TODO: Fix after merge - detail is of type unknown
|
||||
expect(renamingEvents[0].detail.output).toBe(output)
|
||||
|
||||
// Verify the label was updated after the event
|
||||
|
||||
@@ -25,6 +25,7 @@ describe('SubgraphIO - Input Slot Dual-Nature Behavior', () => {
|
||||
}).not.toThrow()
|
||||
|
||||
expect(
|
||||
// @ts-expect-error TODO: Fix after merge - link can be null
|
||||
externalNode.outputs[0].links?.includes(subgraphNode.inputs[0].link)
|
||||
).toBe(true)
|
||||
expect(subgraphNode.inputs[0].link).not.toBe(null)
|
||||
@@ -44,7 +45,9 @@ describe('SubgraphIO - Input Slot Dual-Nature Behavior', () => {
|
||||
|
||||
// The empty slot should be configurable
|
||||
const emptyInput = simpleSubgraph.inputs.at(-1)
|
||||
// @ts-expect-error TODO: Fix after merge - emptyInput possibly undefined
|
||||
expect(emptyInput.name).toBe('')
|
||||
// @ts-expect-error TODO: Fix after merge - emptyInput possibly undefined
|
||||
expect(emptyInput.type).toBe('*')
|
||||
}
|
||||
)
|
||||
@@ -118,6 +121,7 @@ describe('SubgraphIO - Output Slot Dual-Nature Behavior', () => {
|
||||
}).not.toThrow()
|
||||
|
||||
expect(
|
||||
// @ts-expect-error TODO: Fix after merge - link can be null
|
||||
subgraphNode.outputs[0].links?.includes(externalNode.inputs[0].link)
|
||||
).toBe(true)
|
||||
expect(externalNode.inputs[0].link).not.toBe(null)
|
||||
@@ -137,7 +141,9 @@ describe('SubgraphIO - Output Slot Dual-Nature Behavior', () => {
|
||||
|
||||
// The empty slot should be configurable
|
||||
const emptyOutput = simpleSubgraph.outputs.at(-1)
|
||||
// @ts-expect-error TODO: Fix after merge - emptyOutput possibly undefined
|
||||
expect(emptyOutput.name).toBe('')
|
||||
// @ts-expect-error TODO: Fix after merge - emptyOutput possibly undefined
|
||||
expect(emptyOutput.type).toBe('*')
|
||||
}
|
||||
)
|
||||
@@ -422,9 +428,13 @@ describe('SubgraphIO - Empty Slot Connection', () => {
|
||||
expect(internalNode.inputs[0].link).not.toBe(null)
|
||||
const link = subgraph.links.get(internalNode.inputs[0].link!)
|
||||
expect(link).toBeDefined()
|
||||
// @ts-expect-error TODO: Fix after merge - link possibly undefined
|
||||
expect(link.target_id).toBe(internalNode.id)
|
||||
// @ts-expect-error TODO: Fix after merge - link possibly undefined
|
||||
expect(link.target_slot).toBe(0)
|
||||
// @ts-expect-error TODO: Fix after merge - link possibly undefined
|
||||
expect(link.origin_id).toBe(subgraph.inputNode.id)
|
||||
// @ts-expect-error TODO: Fix after merge - link possibly undefined
|
||||
expect(link.origin_slot).toBe(1) // Should be the second slot
|
||||
}
|
||||
)
|
||||
|
||||
@@ -71,6 +71,7 @@ describe('SubgraphNode Memory Management', () => {
|
||||
size: [200, 100],
|
||||
inputs: [],
|
||||
outputs: [],
|
||||
// @ts-expect-error TODO: Fix after merge - properties not in ExportedSubgraphInstance
|
||||
properties: {},
|
||||
flags: {},
|
||||
mode: 0
|
||||
@@ -108,8 +109,10 @@ describe('SubgraphNode Memory Management', () => {
|
||||
}
|
||||
|
||||
// Simulate widget promotion
|
||||
// @ts-expect-error TODO: Fix after merge - mockWidget type mismatch
|
||||
input._widget = mockWidget
|
||||
input.widget = { name: 'promoted_widget' }
|
||||
// @ts-expect-error TODO: Fix after merge - mockWidget type mismatch
|
||||
subgraphNode.widgets.push(mockWidget)
|
||||
|
||||
expect(input._widget).toBe(mockWidget)
|
||||
@@ -117,6 +120,7 @@ describe('SubgraphNode Memory Management', () => {
|
||||
expect(subgraphNode.widgets).toContain(mockWidget)
|
||||
|
||||
// Remove widget (this should clean up references)
|
||||
// @ts-expect-error TODO: Fix after merge - mockWidget type mismatch
|
||||
subgraphNode.removeWidget(mockWidget)
|
||||
|
||||
// Widget should be removed from array
|
||||
@@ -141,6 +145,7 @@ describe('SubgraphNode Memory Management', () => {
|
||||
size: [200, 100],
|
||||
inputs: [],
|
||||
outputs: [],
|
||||
// @ts-expect-error TODO: Fix after merge - properties not in ExportedSubgraphInstance
|
||||
properties: {},
|
||||
flags: {},
|
||||
mode: 0
|
||||
@@ -327,6 +332,7 @@ describe('SubgraphMemory - Widget Reference Management', () => {
|
||||
const widget2 = { type: 'string', value: 'test', name: 'widget2' }
|
||||
|
||||
if (subgraphNode.widgets) {
|
||||
// @ts-expect-error TODO: Fix after merge - widget type mismatch
|
||||
subgraphNode.widgets.push(widget1, widget2)
|
||||
expect(subgraphNode.widgets.length).toBe(initialWidgetCount + 2)
|
||||
}
|
||||
|
||||
@@ -209,6 +209,7 @@ describe('SubgraphNode Lifecycle', () => {
|
||||
size: [180, 100],
|
||||
inputs: [],
|
||||
outputs: [],
|
||||
// @ts-expect-error TODO: Fix after merge - properties not in ExportedSubgraphInstance
|
||||
properties: {},
|
||||
flags: {},
|
||||
mode: 0
|
||||
@@ -541,6 +542,7 @@ describe('SubgraphNode Cleanup', () => {
|
||||
const subgraph = createTestSubgraph()
|
||||
|
||||
// Add and remove nodes multiple times
|
||||
// @ts-expect-error TODO: Fix after merge - SubgraphNode should be Subgraph
|
||||
const removedNodes: SubgraphNode[] = []
|
||||
for (let i = 0; i < 3; i++) {
|
||||
const node = createTestSubgraphNode(subgraph)
|
||||
|
||||
@@ -135,6 +135,7 @@ describe('SubgraphNode Title Button', () => {
|
||||
80 - subgraphNode.pos[1] // 80 - 100 = -20
|
||||
]
|
||||
|
||||
// @ts-expect-error onMouseDown possibly undefined
|
||||
const handled = subgraphNode.onMouseDown(
|
||||
event,
|
||||
clickPosRelativeToNode,
|
||||
@@ -171,6 +172,7 @@ describe('SubgraphNode Title Button', () => {
|
||||
150 - subgraphNode.pos[1] // 150 - 100 = 50
|
||||
]
|
||||
|
||||
// @ts-expect-error onMouseDown possibly undefined
|
||||
const handled = subgraphNode.onMouseDown(
|
||||
event,
|
||||
clickPosRelativeToNode,
|
||||
@@ -217,6 +219,7 @@ describe('SubgraphNode Title Button', () => {
|
||||
80 - subgraphNode.pos[1] // -20
|
||||
]
|
||||
|
||||
// @ts-expect-error onMouseDown possibly undefined
|
||||
const handled = subgraphNode.onMouseDown(
|
||||
event,
|
||||
clickPosRelativeToNode,
|
||||
|
||||
@@ -75,6 +75,7 @@ describe('SubgraphSerialization - Basic Serialization', () => {
|
||||
// Verify core properties
|
||||
expect(restored.id).toBe(original.id)
|
||||
expect(restored.name).toBe(original.name)
|
||||
// @ts-expect-error description property not in type definition
|
||||
expect(restored.description).toBe(original.description)
|
||||
|
||||
// Verify I/O structure
|
||||
@@ -250,6 +251,7 @@ describe('SubgraphSerialization - Version Compatibility', () => {
|
||||
}
|
||||
|
||||
expect(() => {
|
||||
// @ts-expect-error Type mismatch in ExportedSubgraph format
|
||||
const subgraph = new Subgraph(new LGraph(), modernFormat)
|
||||
expect(subgraph.name).toBe('Modern Subgraph')
|
||||
expect(subgraph.inputs.length).toBe(1)
|
||||
@@ -279,6 +281,7 @@ describe('SubgraphSerialization - Version Compatibility', () => {
|
||||
}
|
||||
|
||||
expect(() => {
|
||||
// @ts-expect-error Type mismatch in ExportedSubgraph format
|
||||
const subgraph = new Subgraph(new LGraph(), incompleteFormat)
|
||||
expect(subgraph.name).toBe('Incomplete Subgraph')
|
||||
// Should have default empty arrays
|
||||
@@ -313,6 +316,7 @@ describe('SubgraphSerialization - Version Compatibility', () => {
|
||||
|
||||
// Should handle future format gracefully
|
||||
expect(() => {
|
||||
// @ts-expect-error Type mismatch in ExportedSubgraph format
|
||||
const subgraph = new Subgraph(new LGraph(), futureFormat)
|
||||
expect(subgraph.name).toBe('Future Subgraph')
|
||||
}).not.toThrow()
|
||||
|
||||
@@ -23,6 +23,7 @@ function createNodeWithWidget(
|
||||
const input = node.addInput('value', slotType)
|
||||
node.addOutput('out', slotType)
|
||||
|
||||
// @ts-expect-error Abstract class instantiation
|
||||
const widget = new BaseWidget({
|
||||
name: 'widget',
|
||||
type: widgetType,
|
||||
@@ -130,7 +131,9 @@ describe('SubgraphWidgetPromotion', () => {
|
||||
// Check event was fired
|
||||
const promotedEvents = eventCapture.getEventsByType('widget-promoted')
|
||||
expect(promotedEvents).toHaveLength(1)
|
||||
// @ts-expect-error Object is of type 'unknown'
|
||||
expect(promotedEvents[0].detail.widget).toBeDefined()
|
||||
// @ts-expect-error Object is of type 'unknown'
|
||||
expect(promotedEvents[0].detail.subgraphNode).toBe(subgraphNode)
|
||||
|
||||
eventCapture.cleanup()
|
||||
@@ -155,7 +158,9 @@ describe('SubgraphWidgetPromotion', () => {
|
||||
// Check event was fired
|
||||
const demotedEvents = eventCapture.getEventsByType('widget-demoted')
|
||||
expect(demotedEvents).toHaveLength(1)
|
||||
// @ts-expect-error Object is of type 'unknown'
|
||||
expect(demotedEvents[0].detail.widget).toBeDefined()
|
||||
// @ts-expect-error Object is of type 'unknown'
|
||||
expect(demotedEvents[0].detail.subgraphNode).toBe(subgraphNode)
|
||||
|
||||
// Widget should be removed
|
||||
@@ -177,6 +182,7 @@ describe('SubgraphWidgetPromotion', () => {
|
||||
const numInput = multiWidgetNode.addInput('num', 'number')
|
||||
const strInput = multiWidgetNode.addInput('str', 'string')
|
||||
|
||||
// @ts-expect-error Abstract class instantiation
|
||||
const widget1 = new BaseWidget({
|
||||
name: 'widget1',
|
||||
type: 'number',
|
||||
@@ -186,6 +192,7 @@ describe('SubgraphWidgetPromotion', () => {
|
||||
node: multiWidgetNode
|
||||
})
|
||||
|
||||
// @ts-expect-error Abstract class instantiation
|
||||
const widget2 = new BaseWidget({
|
||||
name: 'widget2',
|
||||
type: 'string',
|
||||
@@ -325,6 +332,7 @@ describe('SubgraphWidgetPromotion', () => {
|
||||
const numInput = multiWidgetNode.addInput('num', 'number')
|
||||
const strInput = multiWidgetNode.addInput('str', 'string')
|
||||
|
||||
// @ts-expect-error Abstract class instantiation
|
||||
const widget1 = new BaseWidget({
|
||||
name: 'widget1',
|
||||
type: 'number',
|
||||
@@ -335,6 +343,7 @@ describe('SubgraphWidgetPromotion', () => {
|
||||
tooltip: 'Number widget tooltip'
|
||||
})
|
||||
|
||||
// @ts-expect-error Abstract class instantiation
|
||||
const widget2 = new BaseWidget({
|
||||
name: 'widget2',
|
||||
type: 'string',
|
||||
|
||||
@@ -162,6 +162,7 @@ export interface MemoryLeakTestOptions {
|
||||
* Useful for testing that event listeners and references are properly cleaned up
|
||||
*/
|
||||
export function createMemoryLeakTest<T>(
|
||||
// @ts-expect-error TODO: Fix after merge - T does not satisfy constraint 'object'
|
||||
setupFn: () => { ref: WeakRef<T>; cleanup: () => void },
|
||||
options: MemoryLeakTestOptions = {}
|
||||
) {
|
||||
@@ -173,10 +174,12 @@ export function createMemoryLeakTest<T>(
|
||||
} = options
|
||||
|
||||
return async () => {
|
||||
// @ts-expect-error Type 'T' does not satisfy the constraint 'object'
|
||||
const refs: WeakRef<T>[] = []
|
||||
const initialMemory = process.memoryUsage?.()?.heapUsed || 0
|
||||
|
||||
for (let cycle = 0; cycle < cycles; cycle++) {
|
||||
// @ts-expect-error Type 'T' does not satisfy the constraint 'object'
|
||||
const cycleRefs: WeakRef<T>[] = []
|
||||
|
||||
for (let instance = 0; instance < instancesPerCycle; instance++) {
|
||||
@@ -268,13 +271,16 @@ export function createEventPerformanceMonitor() {
|
||||
},
|
||||
|
||||
assertPerformance: (operation: string, maxDuration: number) => {
|
||||
// @ts-expect-error 'this' implicitly has type 'any'
|
||||
const measurements = this.getMeasurements()
|
||||
const relevantMeasurements = measurements.filter(
|
||||
// @ts-expect-error Parameter 'm' implicitly has an 'any' type
|
||||
(m) => m.operation === operation
|
||||
)
|
||||
if (relevantMeasurements.length === 0) return
|
||||
|
||||
const avgDuration =
|
||||
// @ts-expect-error Parameter 'sum' and 'm' implicitly have 'any' type
|
||||
relevantMeasurements.reduce((sum, m) => sum + m.duration, 0) /
|
||||
relevantMeasurements.length
|
||||
expect(avgDuration).toBeLessThan(maxDuration)
|
||||
|
||||
@@ -57,6 +57,7 @@ export interface SubgraphFixtures {
|
||||
* ```
|
||||
*/
|
||||
export const subgraphTest = test.extend<SubgraphFixtures>({
|
||||
// @ts-expect-error TODO: Fix after merge - fixture use parameter type
|
||||
emptySubgraph: async ({}, use: (value: unknown) => Promise<void>) => {
|
||||
const subgraph = createTestSubgraph({
|
||||
name: 'Empty Test Subgraph',
|
||||
@@ -68,6 +69,7 @@ export const subgraphTest = test.extend<SubgraphFixtures>({
|
||||
await use(subgraph)
|
||||
},
|
||||
|
||||
// @ts-expect-error TODO: Fix after merge - fixture use parameter type
|
||||
simpleSubgraph: async ({}, use: (value: unknown) => Promise<void>) => {
|
||||
const subgraph = createTestSubgraph({
|
||||
name: 'Simple Test Subgraph',
|
||||
@@ -79,6 +81,7 @@ export const subgraphTest = test.extend<SubgraphFixtures>({
|
||||
await use(subgraph)
|
||||
},
|
||||
|
||||
// @ts-expect-error TODO: Fix after merge - fixture use parameter type
|
||||
complexSubgraph: async ({}, use: (value: unknown) => Promise<void>) => {
|
||||
const subgraph = createTestSubgraph({
|
||||
name: 'Complex Test Subgraph',
|
||||
@@ -97,6 +100,7 @@ export const subgraphTest = test.extend<SubgraphFixtures>({
|
||||
await use(subgraph)
|
||||
},
|
||||
|
||||
// @ts-expect-error TODO: Fix after merge - fixture use parameter type
|
||||
nestedSubgraph: async ({}, use: (value: unknown) => Promise<void>) => {
|
||||
const nested = createNestedSubgraphs({
|
||||
depth: 3,
|
||||
@@ -108,6 +112,7 @@ export const subgraphTest = test.extend<SubgraphFixtures>({
|
||||
await use(nested)
|
||||
},
|
||||
|
||||
// @ts-expect-error TODO: Fix after merge - fixture use parameter type
|
||||
subgraphWithNode: async ({}, use: (value: unknown) => Promise<void>) => {
|
||||
// Create the subgraph definition
|
||||
const subgraph = createTestSubgraph({
|
||||
@@ -134,6 +139,7 @@ export const subgraphTest = test.extend<SubgraphFixtures>({
|
||||
})
|
||||
},
|
||||
|
||||
// @ts-expect-error TODO: Fix after merge - fixture use parameter type
|
||||
eventCapture: async ({}, use: (value: unknown) => Promise<void>) => {
|
||||
const subgraph = createTestSubgraph({
|
||||
name: 'Event Test Subgraph'
|
||||
@@ -184,6 +190,7 @@ export interface EdgeCaseFixtures {
|
||||
* These tests may intentionally create invalid states.
|
||||
*/
|
||||
export const edgeCaseTest = subgraphTest.extend<EdgeCaseFixtures>({
|
||||
// @ts-expect-error TODO: Fix after merge - fixture use parameter type
|
||||
circularSubgraph: async ({}, use: (value: unknown) => Promise<void>) => {
|
||||
const rootGraph = new LGraph()
|
||||
|
||||
@@ -217,6 +224,7 @@ export const edgeCaseTest = subgraphTest.extend<EdgeCaseFixtures>({
|
||||
})
|
||||
},
|
||||
|
||||
// @ts-expect-error TODO: Fix after merge - fixture use parameter type
|
||||
deeplyNestedSubgraph: async ({}, use: (value: unknown) => Promise<void>) => {
|
||||
// Create a very deep nesting structure (but not exceeding MAX_NESTED_SUBGRAPHS)
|
||||
const nested = createNestedSubgraphs({
|
||||
@@ -229,6 +237,7 @@ export const edgeCaseTest = subgraphTest.extend<EdgeCaseFixtures>({
|
||||
await use(nested)
|
||||
},
|
||||
|
||||
// @ts-expect-error TODO: Fix after merge - fixture use parameter type
|
||||
maxIOSubgraph: async ({}, use: (value: unknown) => Promise<void>) => {
|
||||
// Create a subgraph with many inputs and outputs
|
||||
const inputs = Array.from({ length: 20 }, (_, i) => ({
|
||||
|
||||
@@ -96,6 +96,7 @@ export function createTestSubgraph(
|
||||
// Basic graph properties
|
||||
version: 1,
|
||||
nodes: [],
|
||||
// @ts-expect-error TODO: Fix after merge - links type mismatch
|
||||
links: {},
|
||||
groups: [],
|
||||
config: {},
|
||||
@@ -129,6 +130,7 @@ export function createTestSubgraph(
|
||||
// Add requested inputs
|
||||
if (options.inputs) {
|
||||
for (const input of options.inputs) {
|
||||
// @ts-expect-error TODO: Fix after merge - addInput parameter types
|
||||
subgraph.addInput(input.name, input.type)
|
||||
}
|
||||
} else if (options.inputCount) {
|
||||
@@ -140,6 +142,7 @@ export function createTestSubgraph(
|
||||
// Add requested outputs
|
||||
if (options.outputs) {
|
||||
for (const output of options.outputs) {
|
||||
// @ts-expect-error TODO: Fix after merge - addOutput parameter types
|
||||
subgraph.addOutput(output.name, output.type)
|
||||
}
|
||||
} else if (options.outputCount) {
|
||||
@@ -190,6 +193,7 @@ export function createTestSubgraphNode(
|
||||
size: options.size || [200, 100],
|
||||
inputs: [],
|
||||
outputs: [],
|
||||
// @ts-expect-error TODO: Fix after merge - properties type mismatch
|
||||
properties: {},
|
||||
flags: {},
|
||||
mode: 0
|
||||
@@ -241,6 +245,7 @@ export function createNestedSubgraphs(options: NestedSubgraphOptions = {}) {
|
||||
if (currentParent instanceof LGraph) {
|
||||
currentParent.add(subgraphNode)
|
||||
} else {
|
||||
// @ts-expect-error TODO: Fix after merge - add method parameter types
|
||||
currentParent.add(subgraphNode)
|
||||
}
|
||||
|
||||
@@ -349,6 +354,7 @@ export function createTestSubgraphData(
|
||||
return {
|
||||
version: 1,
|
||||
nodes: [],
|
||||
// @ts-expect-error TODO: Fix after merge - links type mismatch
|
||||
links: {},
|
||||
groups: [],
|
||||
config: {},
|
||||
@@ -427,14 +433,20 @@ export function createComplexSubgraphData(
|
||||
}
|
||||
|
||||
return createTestSubgraphData({
|
||||
// @ts-expect-error TODO: Fix after merge - nodes parameter type
|
||||
nodes,
|
||||
// @ts-expect-error TODO: Fix after merge - links parameter type
|
||||
links,
|
||||
inputs: [
|
||||
// @ts-expect-error TODO: Fix after merge - input object type
|
||||
{ name: 'input1', type: 'number', pos: [0, 0] },
|
||||
// @ts-expect-error TODO: Fix after merge - input object type
|
||||
{ name: 'input2', type: 'string', pos: [0, 1] }
|
||||
],
|
||||
outputs: [
|
||||
// @ts-expect-error TODO: Fix after merge - output object type
|
||||
{ name: 'output1', type: 'number', pos: [0, 0] },
|
||||
// @ts-expect-error TODO: Fix after merge - output object type
|
||||
{ name: 'output2', type: 'string', pos: [0, 1] }
|
||||
]
|
||||
})
|
||||
|
||||
@@ -38,8 +38,5 @@
|
||||
"tests-ui/**/*",
|
||||
"global.d.ts",
|
||||
"vite.config.mts"
|
||||
],
|
||||
"exclude": [
|
||||
"src/lib/litegraph/test/**/*"
|
||||
]
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user