Add first test

Why:

- Every journey starts with a first step

This change addresses the need by:

- Adding jest and a test
- Resolve ESLint warnings/errors in the tested function
This commit is contained in:
Moritz Ulmer
2023-03-20 16:08:50 +01:00
parent de997aca7e
commit 6366f9132b
5 changed files with 276 additions and 63 deletions

15
src/litegraph.test.js Normal file
View File

@@ -0,0 +1,15 @@
const lg = require("./litegraph");
test("Register a node type", () => {
function calc_sum(a, b) {
return a + b;
}
lg.LiteGraph.registerNodeType("math/sum", calc_sum);
let node = lg.LiteGraph.registered_node_types["math/sum"];
expect(node).toBeTruthy();
expect(node.type).toBe("math/sum");
expect(node.title).toBe("calc_sum")
expect(node.category).toBe("math");
expect(node.prototype.configure).toBe(lg.LGraphNode.prototype.configure);
});