38 lines
1.2 KiB
JavaScript
38 lines
1.2 KiB
JavaScript
import test from "node:test";
|
|
import assert from "node:assert/strict";
|
|
|
|
import { getOperatorLibrarySections } from "../../src/lib/operator-library.js";
|
|
|
|
test("operator library keeps every category returned by the api", () => {
|
|
const sections = getOperatorLibrarySections([
|
|
{ id: "1", name: "Scan", category: "IO" },
|
|
{ id: "2", name: "Filter", category: "DATA" },
|
|
{ id: "3", name: "Shell", category: "UTIL" },
|
|
{ id: "4", name: "Route", category: "LOGIC" },
|
|
{ id: "5", name: "Review", category: "HUMAN" },
|
|
]);
|
|
|
|
assert.deepEqual(
|
|
sections.map((section) => section.category),
|
|
["IO", "DATA", "UTIL", "LOGIC", "HUMAN"],
|
|
);
|
|
assert.equal(
|
|
sections.reduce((count, section) => count + section.operators.length, 0),
|
|
5,
|
|
);
|
|
});
|
|
|
|
test("operator library uses preferred ordering for known categories", () => {
|
|
const sections = getOperatorLibrarySections([
|
|
{ id: "1", name: "Logic", category: "LOGIC" },
|
|
{ id: "2", name: "AI", category: "AI" },
|
|
{ id: "3", name: "IO", category: "IO" },
|
|
{ id: "4", name: "Math", category: "MATH" },
|
|
]);
|
|
|
|
assert.deepEqual(
|
|
sections.map((section) => section.category),
|
|
["IO", "AI", "LOGIC", "MATH"],
|
|
);
|
|
});
|