Spaces:
Paused
Paused
File size: 1,318 Bytes
5a81b95 07d9d6b 5a81b95 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 | import { describe, it, expect } from 'vitest';
import { helpContent, navItems } from '../../config/navHelpData';
// Derive the help key from a nav path (e.g. /dashboard -> dashboard)
const helpKeyFromPath = (path: string) => (path === '/' ? 'home' : path.replace(/^\//, ''));
const requiredFields = [
'diagram',
'purpose',
'features',
'dataModel',
'integration',
'useCases',
'uiComponents',
'relatedPages',
'summary',
] as const;
describe('GlobalHeader help alignment', () => {
it('keeps nav items and helpContent in sync (excluding home)', () => {
const navKeys = navItems
.filter(item => item.path !== '/')
.map(item => helpKeyFromPath(item.path))
.sort();
const helpKeys = Object.keys(helpContent).sort();
expect(helpKeys).toEqual(navKeys);
});
it('ensures each help section has all required fields', () => {
Object.entries(helpContent).forEach(([key, content]) => {
requiredFields.forEach(field => {
expect((content as Record<string, unknown>)[field]).toBeDefined();
});
expect(Array.isArray(content.features)).toBe(true);
expect(Array.isArray(content.useCases)).toBe(true);
expect(Array.isArray(content.uiComponents)).toBe(true);
expect(Array.isArray(content.relatedPages)).toBe(true);
});
});
});
|