Files
inbuxa-admin/src/help/settingsPages.test.ts
T
jcoffey-dev f1169e6e47
ci / build (pull_request) Successful in 1m27s
ci / publish (pull_request) Skipped
One-sentence intro at the top of every Settings page
2026-09-28 16:08:47 -07:00

31 lines
1.0 KiB
TypeScript

/*
* SPDX-FileCopyrightText: 2026 Coffey Labs
*
* SPDX-License-Identifier: AGPL-3.0-only
*/
import { describe, it, expect } from 'vitest';
import { SETTINGS_CATEGORIES } from '@/lib/settingsLayout';
import { PAGE_HELP, pageAbout } from './texts';
describe('settings page intros', () => {
it('every Settings page has one sentence of our own', () => {
const pages = SETTINGS_CATEGORIES.flatMap((c) => c.groups.flatMap((g) => g.pages.map((p) => p.viewName))).filter(
(v) => !v.startsWith('CustomComponent/'),
);
const missing = pages.filter((v) => !PAGE_HELP[v]?.about);
expect(missing).toEqual([]);
});
it('are short enough for a page heading', () => {
for (const [view, help] of Object.entries(PAGE_HELP)) {
expect(help.about.length, view).toBeLessThanOrEqual(130);
}
});
it('fall back to the schema where we have none', () => {
expect(pageAbout('x:SenderAuth', 'schema text')).not.toBe('schema text');
expect(pageAbout('x:Nothing', 'schema text')).toBe('schema text');
});
});