Spaces:
Paused
Paused
| 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); | |
| }); | |
| }); | |
| }); | |