Skip to content
This repository was archived by the owner on Jun 24, 2025. It is now read-only.

Commit 3c88e3c

Browse files
committed
fix(test): help buttons ID check after change in structure
1 parent 2cd69cc commit 3c88e3c

File tree

1 file changed

+10
-11
lines changed

1 file changed

+10
-11
lines changed

src/public/app/widgets/floating_buttons/help_button.spec.ts

Lines changed: 10 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,20 @@
11
import { describe, expect, it } from "vitest";
22
import { byBookType, byNoteType } from "./help_button.js";
33
import fs from "fs";
4-
import type { NoteMetaFile } from "../../../../services/meta/note_meta.js";
5-
import type NoteMeta from "../../../../services/meta/note_meta.js";
4+
import type { HiddenSubtreeItem } from "../../../../services/hidden_subtree.js";
65

76
describe("Help button", () => {
87
it("All help notes are accessible", () => {
9-
function getNoteIds(item: NoteMeta | NoteMetaFile): string[] {
10-
const items = [];
8+
function getNoteIds(item: HiddenSubtreeItem | HiddenSubtreeItem[]): string[] {
9+
const items: (string | string[])[] = [];
1110

12-
if ("noteId" in item && item.noteId) {
13-
items.push(item.noteId);
11+
if ("id" in item && item.id) {
12+
items.push(item.id);
1413
}
1514

16-
const children = "files" in item ? item.files : item.children;
17-
for (const child of children ?? []) {
18-
items.push(getNoteIds(child));
15+
const subitems = (Array.isArray(item) ? item : item.children);
16+
for (const child of subitems ?? []) {
17+
items.push(getNoteIds(child as (HiddenSubtreeItem | HiddenSubtreeItem[])));
1918
}
2019
return items.flat();
2120
}
@@ -25,11 +24,11 @@ describe("Help button", () => {
2524
...Object.values(byBookType)
2625
].filter((noteId) => noteId) as string[];
2726

28-
const meta: NoteMetaFile = JSON.parse(fs.readFileSync("src/public/app/doc_notes/en/User Guide/!!!meta.json", "utf-8"));
27+
const meta: HiddenSubtreeItem[] = JSON.parse(fs.readFileSync("src/public/app/doc_notes/en/User Guide/!!!meta.json", "utf-8"));
2928
const allNoteIds = new Set(getNoteIds(meta));
3029

3130
for (const helpNote of allHelpNotes) {
32-
if (!allNoteIds.has(helpNote)) {
31+
if (!allNoteIds.has(`_help_${helpNote}`)) {
3332
expect.fail(`Help note with ID ${helpNote} does not exist in the in-app help.`);
3433
}
3534
}

0 commit comments

Comments
 (0)