page-catalog.spec.ts 1.1 KB

1234567891011121314151617181920212223242526
  1. import { routes } from '../app.routes';
  2. import { PAGE_CATALOG } from './page-catalog';
  3. describe('migration route catalog', () => {
  4. it('contains all 95 legacy routes exactly once', () => {
  5. expect(PAGE_CATALOG.length).toBe(95);
  6. expect(new Set(PAGE_CATALOG.map((page) => page.path)).size).toBe(95);
  7. });
  8. it('registers every catalog entry in Angular Router', () => {
  9. const children = routes.find((route) => route.children?.some((child) => child.path === 'pages/home/index'))?.children ?? [];
  10. const routePaths = new Set(children.map((route) => route.path));
  11. for (const page of PAGE_CATALOG) expect(routePaths.has(page.path)).withContext(page.path).toBeTrue();
  12. });
  13. it('keeps usable metadata on every route', () => {
  14. for (const page of PAGE_CATALOG) {
  15. expect(page.path).withContext('path').toMatch(/^(pages|components)\//);
  16. expect(page.title.length).withContext(page.path).toBeGreaterThan(0);
  17. if (page.kind === 'form') {
  18. expect(page.fields?.length).withContext(`${page.path} fields`).toBeGreaterThan(0);
  19. expect(page.saveAction).withContext(`${page.path} save action`).toBeTruthy();
  20. }
  21. }
  22. });
  23. });