mirror of
https://github.com/Comfy-Org/ComfyUI_frontend.git
synced 2026-03-07 22:20:03 +00:00
[Test] Add unit tests - complex floating links & nodes (#796)
This commit is contained in:
@@ -5,6 +5,7 @@ import { test as baseTest } from "vitest"
|
||||
import { LGraph } from "@/LGraph"
|
||||
import { LiteGraph } from "@/litegraph"
|
||||
|
||||
import floatingBranch from "./assets/floatingBranch.json"
|
||||
import floatingLink from "./assets/floatingLink.json"
|
||||
import linkedNodes from "./assets/linkedNodes.json"
|
||||
import { basicSerialisableGraph, minimalSerialisableGraph, oldSchemaGraph } from "./assets/testGraphs"
|
||||
@@ -15,6 +16,8 @@ interface LitegraphFixtures {
|
||||
oldSchemaGraph: ISerialisedGraph
|
||||
floatingLinkGraph: ISerialisedGraph
|
||||
linkedNodesGraph: ISerialisedGraph
|
||||
floatingBranchSerialisedGraph: ISerialisedGraph
|
||||
floatingBranchGraph: LGraph
|
||||
}
|
||||
|
||||
/** These fixtures alter global state, and are difficult to reset. Relies on a single test per-file to reset state. */
|
||||
@@ -35,6 +38,12 @@ export const test = baseTest.extend<LitegraphFixtures>({
|
||||
oldSchemaGraph: structuredClone(oldSchemaGraph),
|
||||
floatingLinkGraph: structuredClone(floatingLink as unknown as ISerialisedGraph),
|
||||
linkedNodesGraph: structuredClone(linkedNodes as unknown as ISerialisedGraph),
|
||||
floatingBranchSerialisedGraph: structuredClone(floatingBranch as unknown as ISerialisedGraph),
|
||||
floatingBranchGraph: async ({ floatingBranchSerialisedGraph }, use) => {
|
||||
const cloned = structuredClone(floatingBranchSerialisedGraph)
|
||||
const graph = new LGraph(cloned)
|
||||
await use(graph)
|
||||
},
|
||||
})
|
||||
|
||||
/** Test that use {@link DirtyFixtures}. One test per file. */
|
||||
|
||||
Reference in New Issue
Block a user