Files
OmniRoute/tests/unit/sidebar-essentials-static.test.ts
ignamiranda 7cec8e32fd Beginner UX: Essentials sidebar preset (#11286)
Validated on a 3-PR combined board: sidebar-customization + sidebar-essentials-static 30/30 combined (across the board's 4 focused files), typecheck:core + dashboard-typecheck clean, gates within baseline. New Essentials sidebar preset gives first-time users a short beginner path while advanced tools stay reachable via Command Palette search. Thank you @ignamiranda!
2026-08-23 19:08:23 -03:00

46 lines
1.6 KiB
TypeScript

import test from "node:test";
import assert from "node:assert/strict";
import fs from "node:fs";
import path from "node:path";
import { fileURLToPath } from "node:url";
const repoRoot = path.resolve(path.dirname(fileURLToPath(import.meta.url)), "../..");
test("essentials preset is registered in sidebar visibility types and presets", () => {
const types = fs.readFileSync(
path.join(repoRoot, "src/shared/constants/sidebarVisibility/types.ts"),
"utf8"
);
const visibility = fs.readFileSync(
path.join(repoRoot, "src/shared/constants/sidebarVisibility.ts"),
"utf8"
);
const schema = fs.readFileSync(
path.join(repoRoot, "src/shared/validation/settingsSchemas.ts"),
"utf8"
);
assert.match(types, /"essentials"/);
assert.match(visibility, /id:\s*"essentials"/);
assert.match(visibility, /ESSENTIALS_ADVANCED_TOOL_IDS/);
assert.match(schema, /"essentials"/);
});
test("command palette keeps essentials advanced tools searchable", () => {
const source = fs.readFileSync(
path.join(repoRoot, "src/shared/components/CommandPalette.tsx"),
"utf8"
);
assert.match(source, /ESSENTIALS_ADVANCED_TOOL_IDS/);
assert.match(source, /activePreset === "essentials"/);
});
test("essentials i18n keys exist in en.json", () => {
const en = JSON.parse(
fs.readFileSync(path.join(repoRoot, "src/i18n/messages/en.json"), "utf8")
) as { settings: Record<string, string> };
assert.equal(en.settings.presetEssentials, "Essentials");
assert.match(en.settings.presetEssentialsDesc, /Beginner path/i);
assert.match(en.settings.presetEssentialsDesc, /searchable/i);
});