2026-09-13 03:46:24 +03:00
|
|
|
/**
|
2026-09-23 15:37:34 +03:00
|
|
|
* Cluster presentation-rule tests. Wave 7 killed the semantic detection
|
|
|
|
|
* AND the LLM label matcher (birth-session clusters, session-name labels —
|
|
|
|
|
* core/session-clusters.ts has its own suite); what remains pinned here
|
|
|
|
|
* is the render threshold and the hull-color spread the UI leans on.
|
2026-09-13 03:46:24 +03:00
|
|
|
*/
|
|
|
|
|
import { strict as assert } from "node:assert";
|
|
|
|
|
import { describe, test } from "node:test";
|
2026-09-23 15:37:34 +03:00
|
|
|
import { MIN_CLUSTER_SIZE } from "../src/core/clusters.ts";
|
2026-09-13 09:17:05 +03:00
|
|
|
import { clusterHue } from "../components/cluster-geometry.ts";
|
2026-09-13 03:46:24 +03:00
|
|
|
|
2026-09-23 15:37:34 +03:00
|
|
|
describe("MIN_CLUSTER_SIZE", () => {
|
|
|
|
|
test("is 3 (the render threshold — below this, no hull)", () => {
|
2026-09-13 03:59:48 +03:00
|
|
|
assert.equal(MIN_CLUSTER_SIZE, 3);
|
|
|
|
|
});
|
|
|
|
|
});
|
|
|
|
|
|
2026-09-13 09:17:05 +03:00
|
|
|
describe("clusterHue", () => {
|
|
|
|
|
test("is stable per id and spreads", () => {
|
|
|
|
|
// Same id → same hue, always; different ids → usually different hues.
|
|
|
|
|
assert.equal(clusterHue("cluster-a"), clusterHue("cluster-a"));
|
|
|
|
|
const hues = new Set<number>();
|
|
|
|
|
for (let i = 0; i < 40; i++) hues.add(clusterHue(`cluster-${i}`));
|
|
|
|
|
assert.ok(hues.size > 20, `expected spread, got ${hues.size} distinct hues for 40 ids`);
|
|
|
|
|
for (const h of hues) assert.ok(h >= 0 && h < 360);
|
2026-09-13 04:23:32 +03:00
|
|
|
});
|
2026-09-23 15:37:34 +03:00
|
|
|
});
|