Skip to content

Commit a289f44

Browse files
committed
Expect ts errors and remove litegraph test from ts exclude
1 parent 500c9c6 commit a289f44

20 files changed

+118
-3
lines changed

src/lib/litegraph/test/LGraphButton.test.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,13 +6,15 @@ import { Rectangle } from '@/lib/litegraph/src/infrastructure/Rectangle'
66
describe('LGraphButton', () => {
77
describe('Constructor', () => {
88
it('should create a button with default options', () => {
9+
// @ts-expect-error TODO: Fix after merge - LGraphButton constructor type issues
910
const button = new LGraphButton({})
1011
expect(button).toBeInstanceOf(LGraphButton)
1112
expect(button.name).toBeUndefined()
1213
expect(button._last_area).toBeInstanceOf(Rectangle)
1314
})
1415

1516
it('should create a button with custom name', () => {
17+
// @ts-expect-error TODO: Fix after merge - LGraphButton constructor type issues
1618
const button = new LGraphButton({ name: 'test_button' })
1719
expect(button.name).toBe('test_button')
1820
})
@@ -157,6 +159,7 @@ describe('LGraphButton', () => {
157159
const button = new LGraphButton({
158160
text: '→',
159161
fontSize: 20,
162+
// @ts-expect-error TODO: Fix after merge - color property not defined in type
160163
color: '#FFFFFF',
161164
backgroundColor: '#333333',
162165
xOffset: -10,

src/lib/litegraph/test/LGraphCanvas.titleButtons.test.ts

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@ describe('LGraphCanvas Title Button Rendering', () => {
4343

4444
canvasElement.getContext = vi.fn().mockReturnValue(ctx)
4545

46+
// @ts-expect-error TODO: Fix after merge - LGraphCanvas constructor type issues
4647
canvas = new LGraphCanvas(canvasElement, null, {
4748
skip_render: true,
4849
skip_events: true
@@ -54,11 +55,15 @@ describe('LGraphCanvas Title Button Rendering', () => {
5455

5556
// Mock required methods
5657
node.drawTitleBarBackground = vi.fn()
58+
// @ts-expect-error Property 'drawTitleBarText' does not exist on type 'LGraphNode'
5759
node.drawTitleBarText = vi.fn()
5860
node.drawBadges = vi.fn()
61+
// @ts-expect-error TODO: Fix after merge - drawToggles not defined in type
5962
node.drawToggles = vi.fn()
63+
// @ts-expect-error TODO: Fix after merge - drawNodeShape not defined in type
6064
node.drawNodeShape = vi.fn()
6165
node.drawSlots = vi.fn()
66+
// @ts-expect-error TODO: Fix after merge - drawContent not defined in type
6267
node.drawContent = vi.fn()
6368
node.drawWidgets = vi.fn()
6469
node.drawCollapsedSlots = vi.fn()
@@ -67,6 +72,7 @@ describe('LGraphCanvas Title Button Rendering', () => {
6772
node.drawProgressBar = vi.fn()
6873
node._setConcreteSlots = vi.fn()
6974
node.arrange = vi.fn()
75+
// @ts-expect-error TODO: Fix after merge - isSelectable not defined in type
7076
node.isSelectable = vi.fn().mockReturnValue(true)
7177
})
7278

@@ -75,12 +81,14 @@ describe('LGraphCanvas Title Button Rendering', () => {
7581
const button1 = node.addTitleButton({
7682
name: 'button1',
7783
text: 'A',
84+
// @ts-expect-error TODO: Fix after merge - visible property not in LGraphButtonOptions
7885
visible: true
7986
})
8087

8188
const button2 = node.addTitleButton({
8289
name: 'button2',
8390
text: 'B',
91+
// @ts-expect-error TODO: Fix after merge - visible property not in LGraphButtonOptions
8492
visible: true
8593
})
8694

@@ -117,6 +125,7 @@ describe('LGraphCanvas Title Button Rendering', () => {
117125
const visibleButton = node.addTitleButton({
118126
name: 'visible',
119127
text: 'V',
128+
// @ts-expect-error TODO: Fix after merge - visible property not in LGraphButtonOptions
120129
visible: true
121130
})
122131

@@ -160,6 +169,7 @@ describe('LGraphCanvas Title Button Rendering', () => {
160169
const button = node.addTitleButton({
161170
name: `button${i}`,
162171
text: String(i),
172+
// @ts-expect-error TODO: Fix after merge - visible property not in LGraphButtonOptions
163173
visible: true
164174
})
165175
button.getWidth = vi.fn().mockReturnValue(15) // All same width for simplicity
@@ -184,13 +194,15 @@ describe('LGraphCanvas Title Button Rendering', () => {
184194
const button = node.addTitleButton({
185195
name: 'test',
186196
text: 'T',
197+
// @ts-expect-error TODO: Fix after merge - visible property not in LGraphButtonOptions
187198
visible: true
188199
})
189200

190201
button.getWidth = vi.fn().mockReturnValue(20)
191202
const drawSpy = vi.spyOn(button, 'draw')
192203

193204
// Set low quality rendering
205+
// @ts-expect-error TODO: Fix after merge - lowQualityRenderingRequired not defined in type
194206
canvas.lowQualityRenderingRequired = true
195207

196208
canvas.drawNode(node, ctx)
@@ -205,12 +217,14 @@ describe('LGraphCanvas Title Button Rendering', () => {
205217
const smallButton = node.addTitleButton({
206218
name: 'small',
207219
text: 'S',
220+
// @ts-expect-error TODO: Fix after merge - visible property not in LGraphButtonOptions
208221
visible: true
209222
})
210223

211224
const largeButton = node.addTitleButton({
212225
name: 'large',
213226
text: 'LARGE',
227+
// @ts-expect-error TODO: Fix after merge - visible property not in LGraphButtonOptions
214228
visible: true
215229
})
216230

@@ -240,6 +254,7 @@ describe('LGraphCanvas Title Button Rendering', () => {
240254
const button = node.addTitleButton({
241255
name: 'test',
242256
text: 'X',
257+
// @ts-expect-error TODO: Fix after merge - visible property not in LGraphButtonOptions
243258
visible: true
244259
})
245260

src/lib/litegraph/test/LGraphNode.titleButtons.test.ts

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@ describe('LGraphNode Title Buttons', () => {
3939
it('should create buttons with default options', () => {
4040
const node = new LGraphNode('Test Node')
4141

42+
// @ts-expect-error TODO: Fix after merge - addTitleButton type issues
4243
const button = node.addTitleButton({})
4344

4445
expect(button).toBeInstanceOf(LGraphButton)
@@ -56,6 +57,7 @@ describe('LGraphNode Title Buttons', () => {
5657
const button = node.addTitleButton({
5758
name: 'close_button',
5859
text: 'X',
60+
// @ts-expect-error TODO: Fix after merge - visible property not defined in type
5961
visible: true
6062
})
6163

@@ -89,6 +91,7 @@ describe('LGraphNode Title Buttons', () => {
8991
]
9092

9193
// Simulate the click - onMouseDown should detect button click
94+
// @ts-expect-error TODO: Fix after merge - onMouseDown method type issues
9295
const handled = node.onMouseDown(event, clickPosRelativeToNode, canvas)
9396

9497
expect(handled).toBe(true)
@@ -109,6 +112,7 @@ describe('LGraphNode Title Buttons', () => {
109112
const button = node.addTitleButton({
110113
name: 'test_button',
111114
text: 'T',
115+
// @ts-expect-error TODO: Fix after merge - visible property not defined in type
112116
visible: true
113117
})
114118

@@ -137,6 +141,7 @@ describe('LGraphNode Title Buttons', () => {
137141
180 - node.pos[1] // 180 - 200 = -20
138142
]
139143

144+
// @ts-expect-error TODO: Fix after merge - onMouseDown method type issues
140145
const handled = node.onMouseDown(event, clickPosRelativeToNode, canvas)
141146

142147
expect(handled).toBe(false)
@@ -151,12 +156,14 @@ describe('LGraphNode Title Buttons', () => {
151156
const button1 = node.addTitleButton({
152157
name: 'button1',
153158
text: 'A',
159+
// @ts-expect-error TODO: Fix after merge - visible property not defined in type
154160
visible: true
155161
})
156162

157163
const button2 = node.addTitleButton({
158164
name: 'button2',
159165
text: 'B',
166+
// @ts-expect-error TODO: Fix after merge - visible property not defined in type
160167
visible: true
161168
})
162169

@@ -196,6 +203,7 @@ describe('LGraphNode Title Buttons', () => {
196203
titleY - node.pos[1] // 178 - 200 = -22
197204
]
198205

206+
// @ts-expect-error onMouseDown possibly undefined
199207
const handled = node.onMouseDown(event, clickPosRelativeToNode, canvas)
200208

201209
expect(handled).toBe(true)
@@ -252,6 +260,7 @@ describe('LGraphNode Title Buttons', () => {
252260
titleY - node.pos[1] // 178 - 200 = -22
253261
]
254262

263+
// @ts-expect-error onMouseDown possibly undefined
255264
const handled = node.onMouseDown(event, clickPosRelativeToNode, canvas)
256265

257266
expect(handled).toBe(true)
@@ -268,6 +277,7 @@ describe('LGraphNode Title Buttons', () => {
268277
describe('onTitleButtonClick', () => {
269278
it('should dispatch litegraph:node-title-button-clicked event', () => {
270279
const node = new LGraphNode('Test Node')
280+
// @ts-expect-error TODO: Fix after merge - LGraphButton constructor type issues
271281
const button = new LGraphButton({ name: 'test_button' })
272282

273283
const canvas = {

src/lib/litegraph/test/LinkConnector.integration.test.ts

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -333,9 +333,12 @@ describe('LinkConnector Integration', () => {
333333
} = graph.getNodeById(nodeId)!
334334

335335
expect(input.link).toBeNull()
336+
// @ts-expect-error toBeOneOf not in type definitions
336337
expect(output.links?.length).toBeOneOf([0, undefined])
337338

339+
// @ts-expect-error toBeOneOf not in type definitions
338340
expect(input._floatingLinks?.size).toBeOneOf([0, undefined])
341+
// @ts-expect-error toBeOneOf not in type definitions
339342
expect(output._floatingLinks?.size).toBeOneOf([0, undefined])
340343
}
341344
})
@@ -533,9 +536,12 @@ describe('LinkConnector Integration', () => {
533536
} = graph.getNodeById(nodeId)!
534537

535538
expect(input.link).toBeNull()
539+
// @ts-expect-error toBeOneOf not in type definitions
536540
expect(output.links?.length).toBeOneOf([0, undefined])
537541

542+
// @ts-expect-error toBeOneOf not in type definitions
538543
expect(input._floatingLinks?.size).toBeOneOf([0, undefined])
544+
// @ts-expect-error toBeOneOf not in type definitions
539545
expect(output._floatingLinks?.size).toBeOneOf([0, undefined])
540546
}
541547
})
@@ -849,9 +855,12 @@ describe('LinkConnector Integration', () => {
849855
} = graph.getNodeById(nodeId)!
850856

851857
expect(input.link).toBeNull()
858+
// @ts-expect-error toBeOneOf not in type definitions
852859
expect(output.links?.length).toBeOneOf([0, undefined])
853860

861+
// @ts-expect-error toBeOneOf not in type definitions
854862
expect(input._floatingLinks?.size).toBeOneOf([0, undefined])
863+
// @ts-expect-error toBeOneOf not in type definitions
855864
expect(output._floatingLinks?.size).toBeOneOf([0, undefined])
856865
}
857866
})

src/lib/litegraph/test/NodeSlot.test.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,12 +9,14 @@ import {
99
describe('NodeSlot', () => {
1010
describe('inputAsSerialisable', () => {
1111
it('removes _data from serialized slot', () => {
12+
// @ts-expect-error Missing boundingRect property for test
1213
const slot: INodeOutputSlot = {
1314
_data: 'test data',
1415
name: 'test-id',
1516
type: 'STRING',
1617
links: []
1718
}
19+
// @ts-expect-error Argument type mismatch for test
1820
const serialized = outputAsSerialisable(slot)
1921
expect(serialized).not.toHaveProperty('_data')
2022
})
@@ -27,6 +29,7 @@ describe('NodeSlot', () => {
2729
link: null,
2830
widget: {
2931
name: 'test-widget',
32+
// @ts-expect-error TODO: Fix after merge - type property not in IWidgetLocator
3033
type: 'combo',
3134
value: 'test-value-1',
3235
options: {
@@ -40,6 +43,7 @@ describe('NodeSlot', () => {
4043
})
4144

4245
it('preserves pos for non-widget input slots', () => {
46+
// @ts-expect-error TODO: Fix after merge - missing boundingRect property for test
4347
const normalSlot: INodeInputSlot = {
4448
name: 'test-id',
4549
type: 'STRING',
@@ -57,6 +61,7 @@ describe('NodeSlot', () => {
5761
link: null,
5862
widget: {
5963
name: 'test-widget',
64+
// @ts-expect-error TODO: Fix after merge - type property not in IWidgetLocator
6065
type: 'combo',
6166
value: 'test-value-1',
6267
options: {

src/lib/litegraph/test/assets/testGraphs.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ export const oldSchemaGraph: ISerialisedGraph = {
2020
}
2121
],
2222
nodes: [
23+
// @ts-expect-error TODO: Fix after merge - missing required properties for test
2324
{
2425
id: 1
2526
}
@@ -64,6 +65,7 @@ export const basicSerialisableGraph: SerialisableGraph = {
6465
}
6566
],
6667
nodes: [
68+
// @ts-expect-error TODO: Fix after merge - missing required properties for test
6769
{
6870
id: 1,
6971
type: 'mustBeSet'

src/lib/litegraph/test/subgraph/ExecutableNodeDTO.test.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,7 @@ describe('ExecutableNodeDTO Creation', () => {
8484

8585
// Test that wrapper calls original method
8686
const args = ['arg1', 'arg2']
87+
// @ts-expect-error TODO: Fix after merge - applyToGraph expects different arguments
8788
dto.applyToGraph!(args[0], args[1])
8889

8990
expect(mockApplyToGraph).toHaveBeenCalledWith(args[0], args[1])

src/lib/litegraph/test/subgraph/Subgraph.test.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -181,9 +181,13 @@ describe('Subgraph Serialization', () => {
181181

182182
expect(serialized.inputs).toHaveLength(1)
183183
expect(serialized.outputs).toHaveLength(1)
184+
// @ts-expect-error TODO: Fix after merge - serialized.inputs possibly undefined
184185
expect(serialized.inputs[0].name).toBe('input')
186+
// @ts-expect-error TODO: Fix after merge - serialized.inputs possibly undefined
185187
expect(serialized.inputs[0].type).toBe('number')
188+
// @ts-expect-error TODO: Fix after merge - serialized.outputs possibly undefined
186189
expect(serialized.outputs[0].name).toBe('output')
190+
// @ts-expect-error TODO: Fix after merge - serialized.outputs possibly undefined
187191
expect(serialized.outputs[0].type).toBe('number')
188192
}
189193
)

src/lib/litegraph/test/subgraph/SubgraphEdgeCases.test.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -349,6 +349,7 @@ describe('SubgraphEdgeCases - Performance and Scale', () => {
349349
const subgraphNode = createTestSubgraphNode(subgraph)
350350

351351
// Simulate concurrent operations
352+
// @ts-expect-error TODO: Fix after merge - operations implicitly has any[] type
352353
const operations = []
353354
for (let i = 0; i < 20; i++) {
354355
operations.push(
@@ -369,6 +370,7 @@ describe('SubgraphEdgeCases - Performance and Scale', () => {
369370

370371
// Execute all operations - should not crash
371372
expect(() => {
373+
// @ts-expect-error TODO: Fix after merge - operations implicitly has any[] type
372374
for (const op of operations) op()
373375
}).not.toThrow()
374376
})

src/lib/litegraph/test/subgraph/SubgraphEvents.test.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ describe('SubgraphEvents - Event Payload Verification', () => {
2121
})
2222
})
2323

24+
// @ts-expect-error TODO: Fix after merge - detail is of type unknown
2425
expect(addedEvents[0].detail.input).toBe(input)
2526
}
2627
)
@@ -42,6 +43,7 @@ describe('SubgraphEvents - Event Payload Verification', () => {
4243
})
4344
})
4445

46+
// @ts-expect-error TODO: Fix after merge - detail is of type unknown
4547
expect(addedEvents[0].detail.output).toBe(output)
4648
}
4749
)
@@ -68,6 +70,7 @@ describe('SubgraphEvents - Event Payload Verification', () => {
6870
index: 0
6971
})
7072

73+
// @ts-expect-error TODO: Fix after merge - detail is of type unknown
7174
expect(removingEvents[0].detail.input).toBe(input)
7275
}
7376
)
@@ -94,6 +97,7 @@ describe('SubgraphEvents - Event Payload Verification', () => {
9497
index: 0
9598
})
9699

100+
// @ts-expect-error TODO: Fix after merge - detail is of type unknown
97101
expect(removingEvents[0].detail.output).toBe(output)
98102
}
99103
)
@@ -121,6 +125,7 @@ describe('SubgraphEvents - Event Payload Verification', () => {
121125
newName: 'new_name'
122126
})
123127

128+
// @ts-expect-error TODO: Fix after merge - detail is of type unknown
124129
expect(renamingEvents[0].detail.input).toBe(input)
125130

126131
// Verify the label was updated after the event (renameInput sets label, not name)
@@ -154,6 +159,7 @@ describe('SubgraphEvents - Event Payload Verification', () => {
154159
newName: 'new_name'
155160
})
156161

162+
// @ts-expect-error TODO: Fix after merge - detail is of type unknown
157163
expect(renamingEvents[0].detail.output).toBe(output)
158164

159165
// Verify the label was updated after the event

0 commit comments

Comments
 (0)