mirror of
https://github.com/diegosouzapw/OmniRoute.git
synced 2026-08-03 13:52:09 +03:00
Two independent "code is right, bookkeeping lagged" base-reds: 1. #8233 made open-sse/executors/muse-spark-web.ts import sanitizeErrorMessage from utils/error.ts (a real Rule #12 fix), but left its KNOWN_MISSING_ERROR_HELPER allowlist entry in scripts/check/check-error-helper.mjs in place. The gate's own stale-allowlist enforcement (assertNoStale) correctly flagged the now -obsolete entry: `npm run check:error-helper` failed with "1 entrada(s) obsoleta(s)", and tests/unit/check-error-helper.test.ts's "the shipped allowlist freezes exactly the known current violators" test expected an empty Set. Removed the entry (kept the assertNoStale machinery and the general scope-header comments untouched). 2. #8064 added the "compression-exclusions" sidebar item right after "compression-studio" in COMPRESSION_CONTEXT_GROUP (deliberate, complete feature) but didn't update two order-snapshot tests written before that item existed: - tests/unit/sidebar-visibility.test.ts expected the "omni-proxy" section's flattened id list to end the compression block at "compression-studio". - tests/unit/ui/sidebar-engine-items.test.ts asserted "Studio must be last" in COMPRESSION_CONTEXT_GROUP. Updated both to the real, intentional order: Settings -> Combos -> engines -> Studio -> Exclusions (Studio now second-to-last, Exclusions last). Validation (red -> green): - check:error-helper gate: red ("1 entrada(s) obsoleta(s)") -> green ("OK (898 files scanned, 0 known-missing frozen)") - tests/unit/check-error-helper.test.ts: 31/32 -> 32/32 - tests/unit/sidebar-visibility.test.ts: 6/7 -> 7/7 - tests/unit/ui/sidebar-engine-items.test.ts: 13/14 -> 14/14 Refs #8233 Refs #8064
102 lines
3.8 KiB
TypeScript
102 lines
3.8 KiB
TypeScript
import { describe, it } from "node:test";
|
|
import assert from "node:assert/strict";
|
|
|
|
// Import the sidebar constants we need to verify
|
|
import {
|
|
HIDEABLE_SIDEBAR_ITEM_IDS,
|
|
COMPRESSION_CONTEXT_GROUP,
|
|
} from "../../../src/shared/constants/sidebarVisibility";
|
|
|
|
const ENGINE_IDS = [
|
|
"context-headroom",
|
|
"context-session-dedup",
|
|
"context-ccr",
|
|
"context-llmlingua",
|
|
] as const;
|
|
|
|
describe("HIDEABLE_SIDEBAR_ITEM_IDS includes all 4 engine items", () => {
|
|
for (const id of ENGINE_IDS) {
|
|
it(`includes "${id}"`, () => {
|
|
assert.ok(
|
|
(HIDEABLE_SIDEBAR_ITEM_IDS as readonly string[]).includes(id),
|
|
`Expected HIDEABLE_SIDEBAR_ITEM_IDS to include "${id}"`
|
|
);
|
|
});
|
|
}
|
|
});
|
|
|
|
describe("COMPRESSION_CONTEXT_GROUP contains all 4 engine items", () => {
|
|
const itemIds = COMPRESSION_CONTEXT_GROUP.items.map((item) => item.id);
|
|
const itemMap = new Map(COMPRESSION_CONTEXT_GROUP.items.map((item) => [item.id, item]));
|
|
|
|
for (const id of ENGINE_IDS) {
|
|
it(`contains item with id "${id}"`, () => {
|
|
assert.ok(itemIds.includes(id as (typeof itemIds)[number]), `Missing item "${id}"`);
|
|
});
|
|
}
|
|
|
|
it('headroom has href "/dashboard/context/headroom" and labelFallback "Headroom"', () => {
|
|
const item = itemMap.get("context-headroom");
|
|
assert.ok(item, "context-headroom item not found");
|
|
assert.equal(item.href, "/dashboard/context/headroom");
|
|
assert.equal(item.labelFallback, "Headroom");
|
|
});
|
|
|
|
it('session-dedup has href "/dashboard/context/session-dedup" and labelFallback "Session Dedup"', () => {
|
|
const item = itemMap.get("context-session-dedup");
|
|
assert.ok(item, "context-session-dedup item not found");
|
|
assert.equal(item.href, "/dashboard/context/session-dedup");
|
|
assert.equal(item.labelFallback, "Session Dedup");
|
|
});
|
|
|
|
it('ccr has href "/dashboard/context/ccr" and labelFallback "CCR"', () => {
|
|
const item = itemMap.get("context-ccr");
|
|
assert.ok(item, "context-ccr item not found");
|
|
assert.equal(item.href, "/dashboard/context/ccr");
|
|
assert.equal(item.labelFallback, "CCR");
|
|
});
|
|
|
|
it('llmlingua has href "/dashboard/context/llmlingua" and labelFallback "LLMLingua"', () => {
|
|
const item = itemMap.get("context-llmlingua");
|
|
assert.ok(item, "context-llmlingua item not found");
|
|
assert.equal(item.href, "/dashboard/context/llmlingua");
|
|
assert.equal(item.labelFallback, "LLMLingua");
|
|
});
|
|
|
|
it("4 engine items appear after context-rtk and before compression-studio", () => {
|
|
// Unified-panel order: Settings → Combos → per-engine pages → Studio.
|
|
const ids = itemIds as string[];
|
|
const rtkIdx = ids.indexOf("context-rtk");
|
|
const studioIdx = ids.indexOf("compression-studio");
|
|
assert.ok(rtkIdx !== -1, "context-rtk not found");
|
|
assert.ok(studioIdx !== -1, "compression-studio not found");
|
|
|
|
for (const id of ENGINE_IDS) {
|
|
const idx = ids.indexOf(id);
|
|
assert.ok(idx > rtkIdx, `${id} should appear after context-rtk`);
|
|
assert.ok(idx < studioIdx, `${id} should appear before compression-studio`);
|
|
}
|
|
});
|
|
|
|
it("group order is Settings → Combos → engines → Studio → Exclusions", () => {
|
|
const ids = itemIds as string[];
|
|
assert.equal(ids[0], "context-settings", "Settings must be first");
|
|
assert.equal(ids[1], "context-combos", "Combos must be second");
|
|
assert.equal(
|
|
ids[ids.length - 1],
|
|
"compression-exclusions",
|
|
"Exclusions must be last"
|
|
);
|
|
assert.equal(
|
|
ids[ids.length - 2],
|
|
"compression-studio",
|
|
"Studio must immediately precede Exclusions"
|
|
);
|
|
// Combos precedes every per-engine page.
|
|
const combosIdx = ids.indexOf("context-combos");
|
|
for (const id of ["context-caveman", "context-rtk", ...ENGINE_IDS]) {
|
|
assert.ok(ids.indexOf(id) > combosIdx, `${id} should appear after context-combos`);
|
|
}
|
|
});
|
|
});
|