Files
ComfyUI_frontend/test/LGraph.test.ts
filtered edfa5e70f2 ES2022 Output & whitespace-only minification (#201)
* Change vite output to ES2022

* Add whitespace-only minify using default esbuild

Does not work for .es.js output - limitation of vite.
Workaround for .es.js involves adding terser & a plugin.

* Remove @ts-expect-error from tests

* Update vite.config.mts

---------

Co-authored-by: Chenlei Hu <huchenlei@proton.me>
2024-10-10 21:00:45 -04:00

27 lines
795 B
TypeScript

import {
LGraph,
LiteGraph,
} from "../dist/litegraph.es.js";
describe("LegacyLGraph Compatibility Layer", () => {
test("LGraph can be instantiated", () => {
const graph = new LGraph({extra: "TestGraph"});
expect(graph).toBeInstanceOf(LGraph);
expect(graph.extra).toBe("TestGraph");
});
test("LGraph can be extended via prototype", () => {
const graph = new LGraph();
// @ts-expect-error Should always be an error.
LGraph.prototype.newMethod = function () {
return "New method added via prototype";
};
// @ts-expect-error Should always be an error.
expect(graph.newMethod()).toBe("New method added via prototype");
});
test("LegacyLGraph is correctly assigned to LiteGraph", () => {
expect(LiteGraph.LGraph).toBe(LGraph);
});
});