Files
AndreaSlopFotografie/web/src/navigation.test.ts
T
SluijsensandClaude Opus 5.5 7af2069959 Adds the shoot page layout and the shoot-type submenu
Shoot pages follow design E: breadcrumb, story blocks, process
timeline with icons, photo mosaic, FAQ, package block and booking
call to action, with per-shoot OG images. The navigation gets a
"Soorten fotoshoots" submenu (desktop panel, mobile group) built from
shootTypes, with exact current-page matching in menu, footer and
breadcrumb. A 404 under /soorten-fotoshoots/ also offers a link back
to the overview.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-30 14:43:43 +01:00

109 lines
3.3 KiB
TypeScript
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
import { describe, expect, it } from 'vitest';
import shootTypes from './content/shootTypes';
import {
SHOOT_TYPE_IDS,
SHOOT_TYPES_PATH,
shootIdFromPath,
shootPagePath,
} from './lib/shootPages';
import { footerNav, hasChildren, mainNav } from './navigation';
import sitePages from './sitePages';
describe('menu', () => {
it('hoofdmenu heeft de vaste volgorde', () => {
expect(mainNav.map((item) => item.label)).toEqual([
'Home',
'Over mij',
'Portfolio',
'Soorten fotoshoots',
'Contact',
]);
});
it('hoofdmenu begint met Home en bevat geen privacyverklaring', () => {
expect(mainNav[0].to).toBe('/');
expect(mainNav.map((item) => item.to)).not.toContain(
'/privacyverklaring',
);
});
it('footermenu volgt het design plus de privacyverklaring', () => {
expect(footerNav.map((item) => item.to)).toEqual([
'/portfolio',
'/soorten-fotoshoots',
'/contact',
'/privacyverklaring',
]);
});
it('geen dubbele routes binnen een menu', () => {
for (const menu of [mainNav, footerNav]) {
const paths = menu.map((item) => item.to);
expect(new Set(paths).size).toBe(paths.length);
}
});
});
describe('submenu Soorten fotoshoots', () => {
const parent = mainNav.find((item) => item.to === SHOOT_TYPES_PATH);
it('heeft de vijf shoots als kinderen, in de volgorde van de shoottypes', () => {
expect(parent?.children).toEqual(
shootTypes.map((shoot) => ({
to: shootPagePath(shoot.id),
label: shoot.name,
})),
);
expect(parent?.children?.map((child) => child.label)).toEqual([
'Newborn',
'Zwangerschap',
'Gezin',
'Loveshoot',
'Portretten',
]);
});
it('heeft een menu-item voor elk shoottype en niets extra', () => {
expect(
parent?.children
?.map((child) => shootIdFromPath(child.to))
.toSorted(),
).toEqual([...SHOOT_TYPE_IDS].toSorted());
});
it('geeft alleen het hoofditem kinderen, op één niveau', () => {
const others = [
...mainNav.filter((item) => item !== parent),
...footerNav,
];
for (const item of others) {
expect(item.children).toBeUndefined();
}
for (const child of parent?.children ?? []) {
expect(child.children).toBeUndefined();
}
});
it('hasChildren is alleen waar voor het hoofditem', () => {
expect(mainNav.filter(hasChildren)).toEqual([parent]);
expect(hasChildren({ to: '/', label: 'Home', children: [] })).toBe(
false,
);
expect(hasChildren({ to: '/', label: 'Home' })).toBe(false);
});
it('heeft geen dubbele routes in het hoofditem en zijn kinderen', () => {
const paths = [
parent?.to,
...(parent?.children ?? []).map((c) => c.to),
];
expect(new Set(paths).size).toBe(paths.length);
});
it('linkt alleen naar geregistreerde, geïndexeerde pagina’s', () => {
for (const child of parent?.children ?? []) {
expect(sitePages[child.to]?.indexed).toBe(true);
}
});
});