mirror of
https://github.com/Comfy-Org/ComfyUI_frontend.git
synced 2026-04-27 09:45:13 +00:00
Replace test framework: jest -> vitest (#281)
* Replace test framework: jest -> vitest * nit - remove deprecated npm scripts * Add vitest config * Add a few basic tests * Update actions with vitest params * Add correct expectations * Remove jest config
This commit is contained in:
56
test/lgTest.ts
Normal file
56
test/lgTest.ts
Normal file
@@ -0,0 +1,56 @@
|
||||
import { test } from "vitest"
|
||||
import type { ISerialisedGraph } from "../src/types/serialisation"
|
||||
import { LGraph } from "@/LGraph"
|
||||
|
||||
const minimalSerialisableGraph: ISerialisedGraph = {
|
||||
version: 1,
|
||||
config: {},
|
||||
last_node_id: 0,
|
||||
last_link_id: 0,
|
||||
nodes: [],
|
||||
links: [],
|
||||
groups: [],
|
||||
}
|
||||
|
||||
const basicSerialisableGraph: ISerialisedGraph = {
|
||||
version: 1,
|
||||
config: {},
|
||||
last_node_id: 0,
|
||||
last_link_id: 0,
|
||||
groups: [
|
||||
{
|
||||
id: 123,
|
||||
bounding: [20, 20, 1, 3],
|
||||
color: "#6029aa",
|
||||
font_size: 14,
|
||||
title: "A group to test with",
|
||||
},
|
||||
],
|
||||
nodes: [
|
||||
{
|
||||
id: 1,
|
||||
},
|
||||
],
|
||||
links: [],
|
||||
}
|
||||
|
||||
interface LitegraphFixtures {
|
||||
minimalGraph: LGraph
|
||||
minimalSerialisableGraph: ISerialisedGraph
|
||||
basicSerialisableGraph: ISerialisedGraph
|
||||
}
|
||||
|
||||
export const lgTest = test.extend<LitegraphFixtures>({
|
||||
minimalGraph: async ({}, use) => {
|
||||
// Before each test function
|
||||
const serialisable = structuredClone(minimalSerialisableGraph)
|
||||
const lGraph = new LGraph(serialisable)
|
||||
|
||||
// use the fixture value
|
||||
await use(lGraph)
|
||||
|
||||
// After each test function
|
||||
},
|
||||
basicSerialisableGraph: structuredClone(basicSerialisableGraph),
|
||||
minimalSerialisableGraph: structuredClone(minimalSerialisableGraph),
|
||||
})
|
||||
Reference in New Issue
Block a user