chore(monorepo): relocate client files

This commit is contained in:
Elian Doran
2025-04-18 01:37:55 +03:00
parent 4aad0552b3
commit de2cdd5e78
364 changed files with 0 additions and 0 deletions

View File

@@ -0,0 +1,36 @@
import { describe, expect, it } from "vitest";
import { byBookType, byNoteType } from "./help_button.js";
import fs from "fs";
import type { HiddenSubtreeItem } from "../../../../services/hidden_subtree.js";
describe("Help button", () => {
it("All help notes are accessible", () => {
function getNoteIds(item: HiddenSubtreeItem | HiddenSubtreeItem[]): string[] {
const items: (string | string[])[] = [];
if ("id" in item && item.id) {
items.push(item.id);
}
const subitems = (Array.isArray(item) ? item : item.children);
for (const child of subitems ?? []) {
items.push(getNoteIds(child as (HiddenSubtreeItem | HiddenSubtreeItem[])));
}
return items.flat();
}
const allHelpNotes = [
...Object.values(byNoteType),
...Object.values(byBookType)
].filter((noteId) => noteId) as string[];
const meta: HiddenSubtreeItem[] = JSON.parse(fs.readFileSync("src/public/app/doc_notes/en/User Guide/!!!meta.json", "utf-8"));
const allNoteIds = new Set(getNoteIds(meta));
for (const helpNote of allHelpNotes) {
if (!allNoteIds.has(`_help_${helpNote}`)) {
expect.fail(`Help note with ID ${helpNote} does not exist in the in-app help.`);
}
}
});
});