Files
ComfyUI_frontend/test/litegraph.test.ts
filtered f3b51a534e [Test] Standardise unit test infrastructure (#572)
* [Test] Revert custom name for test context

- Removes "lgTest", replaces with default "test"

* nit - Rename test extensions file

* Split test graphs out to separate file
2025-02-24 01:56:22 +00:00

22 lines
707 B
TypeScript

import { describe, expect } from "vitest"
import { clamp, LGraphCanvas, LiteGraph } from "@/litegraph"
import { LiteGraphGlobal } from "@/LiteGraphGlobal"
import { test } from "./testExtensions"
describe.concurrent("Litegraph module", () => {
test("contains a global export", ({ expect }) => {
expect(LiteGraph).toBeInstanceOf(LiteGraphGlobal)
expect(LiteGraph.LGraphCanvas).toBe(LGraphCanvas)
})
test("has the same structure", ({ expect }) => {
const lgGlobal = new LiteGraphGlobal()
expect(lgGlobal).toMatchSnapshot("minLGraph")
})
test("clamps values", () => {
expect(clamp(-1.124, 13, 24)).toStrictEqual(13)
expect(clamp(Infinity, 18, 29)).toStrictEqual(29)
})
})