mirror of
https://github.com/Comfy-Org/ComfyUI_frontend.git
synced 2026-04-29 18:52:19 +00:00
eslint disable next litegraph tests
This commit is contained in:
@@ -32,7 +32,7 @@ describe('LGraphNode', () => {
|
|||||||
|
|
||||||
beforeEach(() => {
|
beforeEach(() => {
|
||||||
origLiteGraph = Object.assign({}, LiteGraph)
|
origLiteGraph = Object.assign({}, LiteGraph)
|
||||||
// @ts-expect-error
|
// @ts-expect-error TODO: Fix after merge - Classes property not in type
|
||||||
delete origLiteGraph.Classes
|
delete origLiteGraph.Classes
|
||||||
|
|
||||||
Object.assign(LiteGraph, {
|
Object.assign(LiteGraph, {
|
||||||
|
|||||||
@@ -41,6 +41,7 @@ const test = baseTest.extend<TestContext>({
|
|||||||
await use(reroutesComplexGraph)
|
await use(reroutesComplexGraph)
|
||||||
},
|
},
|
||||||
setConnectingLinks: async (
|
setConnectingLinks: async (
|
||||||
|
// eslint-disable-next-line no-empty-pattern
|
||||||
{},
|
{},
|
||||||
use: (mock: ReturnType<typeof vi.fn>) => Promise<void>
|
use: (mock: ReturnType<typeof vi.fn>) => Promise<void>
|
||||||
) => {
|
) => {
|
||||||
|
|||||||
@@ -28,6 +28,7 @@ interface TestContext {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const test = baseTest.extend<TestContext>({
|
const test = baseTest.extend<TestContext>({
|
||||||
|
// eslint-disable-next-line no-empty-pattern
|
||||||
network: async ({}, use) => {
|
network: async ({}, use) => {
|
||||||
const graph = new LGraph()
|
const graph = new LGraph()
|
||||||
const floatingLinks = new Map<number, LLink>()
|
const floatingLinks = new Map<number, LLink>()
|
||||||
@@ -52,6 +53,7 @@ const test = baseTest.extend<TestContext>({
|
|||||||
},
|
},
|
||||||
|
|
||||||
setConnectingLinks: async (
|
setConnectingLinks: async (
|
||||||
|
// eslint-disable-next-line no-empty-pattern
|
||||||
{},
|
{},
|
||||||
use: (mock: ReturnType<typeof vi.fn>) => Promise<void>
|
use: (mock: ReturnType<typeof vi.fn>) => Promise<void>
|
||||||
) => {
|
) => {
|
||||||
|
|||||||
@@ -6,6 +6,7 @@ import type { Point, Size } from '@/lib/litegraph/src/interfaces'
|
|||||||
// TODO: If there's a common test context, use it here
|
// TODO: If there's a common test context, use it here
|
||||||
// For now, we'll define a simple context for Rectangle tests
|
// For now, we'll define a simple context for Rectangle tests
|
||||||
const test = baseTest.extend<{ rect: Rectangle }>({
|
const test = baseTest.extend<{ rect: Rectangle }>({
|
||||||
|
// eslint-disable-next-line no-empty-pattern
|
||||||
rect: async ({}, use) => {
|
rect: async ({}, use) => {
|
||||||
await use(new Rectangle())
|
await use(new Rectangle())
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -300,7 +300,9 @@ describe('ExecutableNodeDTO Memory Efficiency', () => {
|
|||||||
expect(dto.inputs).toHaveLength(2) // Copied input data only
|
expect(dto.inputs).toHaveLength(2) // Copied input data only
|
||||||
|
|
||||||
// Should not duplicate heavy node data
|
// Should not duplicate heavy node data
|
||||||
|
// eslint-disable-next-line no-prototype-builtins
|
||||||
expect(dto.hasOwnProperty('outputs')).toBe(false) // Outputs not copied
|
expect(dto.hasOwnProperty('outputs')).toBe(false) // Outputs not copied
|
||||||
|
// eslint-disable-next-line no-prototype-builtins
|
||||||
expect(dto.hasOwnProperty('widgets')).toBe(false) // Widgets not copied
|
expect(dto.hasOwnProperty('widgets')).toBe(false) // Widgets not copied
|
||||||
})
|
})
|
||||||
|
|
||||||
@@ -340,7 +342,9 @@ describe('ExecutableNodeDTO Memory Efficiency', () => {
|
|||||||
expect(dto.graph).toBe(innerNode.graph)
|
expect(dto.graph).toBe(innerNode.graph)
|
||||||
|
|
||||||
// Should not hold heavy references that prevent GC
|
// Should not hold heavy references that prevent GC
|
||||||
|
// eslint-disable-next-line no-prototype-builtins
|
||||||
expect(dto.hasOwnProperty('parentGraph')).toBe(false)
|
expect(dto.hasOwnProperty('parentGraph')).toBe(false)
|
||||||
|
// eslint-disable-next-line no-prototype-builtins
|
||||||
expect(dto.hasOwnProperty('rootGraph')).toBe(false)
|
expect(dto.hasOwnProperty('rootGraph')).toBe(false)
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|||||||
@@ -229,7 +229,6 @@ describe('Subgraph slot connections', () => {
|
|||||||
expect(isSubgraphInput(subgraphInput)).toBe(true)
|
expect(isSubgraphInput(subgraphInput)).toBe(true)
|
||||||
expect(isSubgraphInput(node.inputs[0])).toBe(false)
|
expect(isSubgraphInput(node.inputs[0])).toBe(false)
|
||||||
expect(isSubgraphInput(null)).toBe(false)
|
expect(isSubgraphInput(null)).toBe(false)
|
||||||
// eslint-disable-next-line unicorn/no-useless-undefined
|
|
||||||
expect(isSubgraphInput(undefined)).toBe(false)
|
expect(isSubgraphInput(undefined)).toBe(false)
|
||||||
expect(isSubgraphInput({})).toBe(false)
|
expect(isSubgraphInput({})).toBe(false)
|
||||||
})
|
})
|
||||||
@@ -243,7 +242,6 @@ describe('Subgraph slot connections', () => {
|
|||||||
expect(isSubgraphOutput(subgraphOutput)).toBe(true)
|
expect(isSubgraphOutput(subgraphOutput)).toBe(true)
|
||||||
expect(isSubgraphOutput(node.outputs[0])).toBe(false)
|
expect(isSubgraphOutput(node.outputs[0])).toBe(false)
|
||||||
expect(isSubgraphOutput(null)).toBe(false)
|
expect(isSubgraphOutput(null)).toBe(false)
|
||||||
// eslint-disable-next-line unicorn/no-useless-undefined
|
|
||||||
expect(isSubgraphOutput(undefined)).toBe(false)
|
expect(isSubgraphOutput(undefined)).toBe(false)
|
||||||
expect(isSubgraphOutput({})).toBe(false)
|
expect(isSubgraphOutput({})).toBe(false)
|
||||||
})
|
})
|
||||||
|
|||||||
@@ -58,6 +58,7 @@ export interface SubgraphFixtures {
|
|||||||
*/
|
*/
|
||||||
export const subgraphTest = test.extend<SubgraphFixtures>({
|
export const subgraphTest = test.extend<SubgraphFixtures>({
|
||||||
// @ts-expect-error TODO: Fix after merge - fixture use parameter type
|
// @ts-expect-error TODO: Fix after merge - fixture use parameter type
|
||||||
|
// eslint-disable-next-line no-empty-pattern
|
||||||
emptySubgraph: async ({}, use: (value: unknown) => Promise<void>) => {
|
emptySubgraph: async ({}, use: (value: unknown) => Promise<void>) => {
|
||||||
const subgraph = createTestSubgraph({
|
const subgraph = createTestSubgraph({
|
||||||
name: 'Empty Test Subgraph',
|
name: 'Empty Test Subgraph',
|
||||||
@@ -70,6 +71,7 @@ export const subgraphTest = test.extend<SubgraphFixtures>({
|
|||||||
},
|
},
|
||||||
|
|
||||||
// @ts-expect-error TODO: Fix after merge - fixture use parameter type
|
// @ts-expect-error TODO: Fix after merge - fixture use parameter type
|
||||||
|
// eslint-disable-next-line no-empty-pattern
|
||||||
simpleSubgraph: async ({}, use: (value: unknown) => Promise<void>) => {
|
simpleSubgraph: async ({}, use: (value: unknown) => Promise<void>) => {
|
||||||
const subgraph = createTestSubgraph({
|
const subgraph = createTestSubgraph({
|
||||||
name: 'Simple Test Subgraph',
|
name: 'Simple Test Subgraph',
|
||||||
@@ -82,6 +84,7 @@ export const subgraphTest = test.extend<SubgraphFixtures>({
|
|||||||
},
|
},
|
||||||
|
|
||||||
// @ts-expect-error TODO: Fix after merge - fixture use parameter type
|
// @ts-expect-error TODO: Fix after merge - fixture use parameter type
|
||||||
|
// eslint-disable-next-line no-empty-pattern
|
||||||
complexSubgraph: async ({}, use: (value: unknown) => Promise<void>) => {
|
complexSubgraph: async ({}, use: (value: unknown) => Promise<void>) => {
|
||||||
const subgraph = createTestSubgraph({
|
const subgraph = createTestSubgraph({
|
||||||
name: 'Complex Test Subgraph',
|
name: 'Complex Test Subgraph',
|
||||||
@@ -101,6 +104,7 @@ export const subgraphTest = test.extend<SubgraphFixtures>({
|
|||||||
},
|
},
|
||||||
|
|
||||||
// @ts-expect-error TODO: Fix after merge - fixture use parameter type
|
// @ts-expect-error TODO: Fix after merge - fixture use parameter type
|
||||||
|
// eslint-disable-next-line no-empty-pattern
|
||||||
nestedSubgraph: async ({}, use: (value: unknown) => Promise<void>) => {
|
nestedSubgraph: async ({}, use: (value: unknown) => Promise<void>) => {
|
||||||
const nested = createNestedSubgraphs({
|
const nested = createNestedSubgraphs({
|
||||||
depth: 3,
|
depth: 3,
|
||||||
@@ -113,6 +117,7 @@ export const subgraphTest = test.extend<SubgraphFixtures>({
|
|||||||
},
|
},
|
||||||
|
|
||||||
// @ts-expect-error TODO: Fix after merge - fixture use parameter type
|
// @ts-expect-error TODO: Fix after merge - fixture use parameter type
|
||||||
|
// eslint-disable-next-line no-empty-pattern
|
||||||
subgraphWithNode: async ({}, use: (value: unknown) => Promise<void>) => {
|
subgraphWithNode: async ({}, use: (value: unknown) => Promise<void>) => {
|
||||||
// Create the subgraph definition
|
// Create the subgraph definition
|
||||||
const subgraph = createTestSubgraph({
|
const subgraph = createTestSubgraph({
|
||||||
@@ -140,6 +145,7 @@ export const subgraphTest = test.extend<SubgraphFixtures>({
|
|||||||
},
|
},
|
||||||
|
|
||||||
// @ts-expect-error TODO: Fix after merge - fixture use parameter type
|
// @ts-expect-error TODO: Fix after merge - fixture use parameter type
|
||||||
|
// eslint-disable-next-line no-empty-pattern
|
||||||
eventCapture: async ({}, use: (value: unknown) => Promise<void>) => {
|
eventCapture: async ({}, use: (value: unknown) => Promise<void>) => {
|
||||||
const subgraph = createTestSubgraph({
|
const subgraph = createTestSubgraph({
|
||||||
name: 'Event Test Subgraph'
|
name: 'Event Test Subgraph'
|
||||||
@@ -191,6 +197,7 @@ export interface EdgeCaseFixtures {
|
|||||||
*/
|
*/
|
||||||
export const edgeCaseTest = subgraphTest.extend<EdgeCaseFixtures>({
|
export const edgeCaseTest = subgraphTest.extend<EdgeCaseFixtures>({
|
||||||
// @ts-expect-error TODO: Fix after merge - fixture use parameter type
|
// @ts-expect-error TODO: Fix after merge - fixture use parameter type
|
||||||
|
// eslint-disable-next-line no-empty-pattern
|
||||||
circularSubgraph: async ({}, use: (value: unknown) => Promise<void>) => {
|
circularSubgraph: async ({}, use: (value: unknown) => Promise<void>) => {
|
||||||
const rootGraph = new LGraph()
|
const rootGraph = new LGraph()
|
||||||
|
|
||||||
@@ -225,6 +232,7 @@ export const edgeCaseTest = subgraphTest.extend<EdgeCaseFixtures>({
|
|||||||
},
|
},
|
||||||
|
|
||||||
// @ts-expect-error TODO: Fix after merge - fixture use parameter type
|
// @ts-expect-error TODO: Fix after merge - fixture use parameter type
|
||||||
|
// eslint-disable-next-line no-empty-pattern
|
||||||
deeplyNestedSubgraph: async ({}, use: (value: unknown) => Promise<void>) => {
|
deeplyNestedSubgraph: async ({}, use: (value: unknown) => Promise<void>) => {
|
||||||
// Create a very deep nesting structure (but not exceeding MAX_NESTED_SUBGRAPHS)
|
// Create a very deep nesting structure (but not exceeding MAX_NESTED_SUBGRAPHS)
|
||||||
const nested = createNestedSubgraphs({
|
const nested = createNestedSubgraphs({
|
||||||
@@ -238,6 +246,7 @@ export const edgeCaseTest = subgraphTest.extend<EdgeCaseFixtures>({
|
|||||||
},
|
},
|
||||||
|
|
||||||
// @ts-expect-error TODO: Fix after merge - fixture use parameter type
|
// @ts-expect-error TODO: Fix after merge - fixture use parameter type
|
||||||
|
// eslint-disable-next-line no-empty-pattern
|
||||||
maxIOSubgraph: async ({}, use: (value: unknown) => Promise<void>) => {
|
maxIOSubgraph: async ({}, use: (value: unknown) => Promise<void>) => {
|
||||||
// Create a subgraph with many inputs and outputs
|
// Create a subgraph with many inputs and outputs
|
||||||
const inputs = Array.from({ length: 20 }, (_, i) => ({
|
const inputs = Array.from({ length: 20 }, (_, i) => ({
|
||||||
|
|||||||
@@ -33,6 +33,7 @@ interface DirtyFixtures {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export const test = baseTest.extend<LitegraphFixtures>({
|
export const test = baseTest.extend<LitegraphFixtures>({
|
||||||
|
// eslint-disable-next-line no-empty-pattern
|
||||||
minimalGraph: async ({}, use) => {
|
minimalGraph: async ({}, use) => {
|
||||||
// Before each test function
|
// Before each test function
|
||||||
const serialisable = structuredClone(minimalSerialisableGraph)
|
const serialisable = structuredClone(minimalSerialisableGraph)
|
||||||
@@ -47,6 +48,7 @@ export const test = baseTest.extend<LitegraphFixtures>({
|
|||||||
floatingLink as unknown as ISerialisedGraph
|
floatingLink as unknown as ISerialisedGraph
|
||||||
),
|
),
|
||||||
linkedNodesGraph: structuredClone(linkedNodes as unknown as ISerialisedGraph),
|
linkedNodesGraph: structuredClone(linkedNodes as unknown as ISerialisedGraph),
|
||||||
|
// eslint-disable-next-line no-empty-pattern
|
||||||
floatingBranchGraph: async ({}, use) => {
|
floatingBranchGraph: async ({}, use) => {
|
||||||
const cloned = structuredClone(
|
const cloned = structuredClone(
|
||||||
floatingBranch as unknown as ISerialisedGraph
|
floatingBranch as unknown as ISerialisedGraph
|
||||||
@@ -54,6 +56,7 @@ export const test = baseTest.extend<LitegraphFixtures>({
|
|||||||
const graph = new LGraph(cloned)
|
const graph = new LGraph(cloned)
|
||||||
await use(graph)
|
await use(graph)
|
||||||
},
|
},
|
||||||
|
// eslint-disable-next-line no-empty-pattern
|
||||||
reroutesComplexGraph: async ({}, use) => {
|
reroutesComplexGraph: async ({}, use) => {
|
||||||
const cloned = structuredClone(
|
const cloned = structuredClone(
|
||||||
reroutesComplex as unknown as ISerialisedGraph
|
reroutesComplex as unknown as ISerialisedGraph
|
||||||
@@ -65,6 +68,7 @@ export const test = baseTest.extend<LitegraphFixtures>({
|
|||||||
|
|
||||||
/** Test that use {@link DirtyFixtures}. One test per file. */
|
/** Test that use {@link DirtyFixtures}. One test per file. */
|
||||||
export const dirtyTest = test.extend<DirtyFixtures>({
|
export const dirtyTest = test.extend<DirtyFixtures>({
|
||||||
|
// eslint-disable-next-line no-empty-pattern
|
||||||
basicSerialisableGraph: async ({}, use) => {
|
basicSerialisableGraph: async ({}, use) => {
|
||||||
if (!basicSerialisableGraph.nodes) throw new Error('Invalid test object')
|
if (!basicSerialisableGraph.nodes) throw new Error('Invalid test object')
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user