- FeedResponse claimed a required `limit`, but /api/search/youtube never returns it (only /api/feed does) and nothing in the app reads it. Drop the field so searchYoutube's Promise<FeedResponse> stops lying; documented for re-add if a consumer appears. - pageMeta's hand-written 13-case Page->title switch now derives from the ModuleDef registry via a new optional `titleKey` (the longer tab title, e.g. "Channel manager"; falls back to the short nav labelKey). A new page is one touch (add it to MODULES) instead of also editing a switch. A test pins all 13 title keys byte-identical to the old switch (suite 74).
31 lines
1.1 KiB
TypeScript
31 lines
1.1 KiB
TypeScript
import { describe, expect, it } from "vitest";
|
|
import { pageTitleKey } from "./pageMeta";
|
|
import type { Page } from "./urlState";
|
|
|
|
// pageTitleKey now derives from the ModuleDef registry (titleKey ?? labelKey). These are the exact
|
|
// browser-tab title keys the old hand-written switch produced — pin every page so a future labelKey
|
|
// rename (or a dropped titleKey) can't silently change a tab title.
|
|
const EXPECTED: Record<Page, string> = {
|
|
feed: "header.account.feed",
|
|
channels: "header.channelManager",
|
|
playlists: "header.account.playlists",
|
|
notifications: "inbox.navLabel",
|
|
messages: "messages.navLabel",
|
|
downloads: "downloads.navLabel",
|
|
stats: "header.usageStats",
|
|
plex: "plex.navLabel",
|
|
scheduler: "header.scheduler",
|
|
config: "header.configuration",
|
|
users: "header.users",
|
|
audit: "audit.title",
|
|
settings: "settings.title",
|
|
};
|
|
|
|
describe("pageTitleKey", () => {
|
|
it("returns the exact title key for every page (registry-derived)", () => {
|
|
for (const [page, key] of Object.entries(EXPECTED)) {
|
|
expect(pageTitleKey(page as Page)).toBe(key);
|
|
}
|
|
});
|
|
});
|