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>
76 lines
2.5 KiB
TypeScript
76 lines
2.5 KiB
TypeScript
import fc from 'fast-check';
|
|
import { describe, expect, it } from 'vitest';
|
|
import shootTypes from '../content/shootTypes';
|
|
import { uniqueShootTypes } from '../test/arbitraries';
|
|
import { shootNavItems } from './shootNavItems';
|
|
import { SHOOT_TYPES_PATH, shootIdFromPath, shootPagePath } from './shootPages';
|
|
|
|
describe('shootNavItems', () => {
|
|
it('gives one item per shoot (invariant)', () => {
|
|
fc.assert(
|
|
fc.property(uniqueShootTypes, (shoots) => {
|
|
expect(shootNavItems(shoots)).toHaveLength(shoots.length);
|
|
}),
|
|
);
|
|
});
|
|
|
|
it('keeps the order and uses the name as label (invariant)', () => {
|
|
fc.assert(
|
|
fc.property(uniqueShootTypes, (shoots) => {
|
|
const items = shootNavItems(shoots);
|
|
expect(items.map((item) => item.label)).toEqual(
|
|
shoots.map((shoot) => shoot.name),
|
|
);
|
|
}),
|
|
);
|
|
});
|
|
|
|
it('links to the page of the same shoot (round trip)', () => {
|
|
fc.assert(
|
|
fc.property(uniqueShootTypes, (shoots) => {
|
|
const items = shootNavItems(shoots);
|
|
items.forEach((item, index) => {
|
|
expect(shootIdFromPath(item.to)).toBe(shoots[index].id);
|
|
});
|
|
}),
|
|
);
|
|
});
|
|
|
|
it('links to a page below the overview (invariant)', () => {
|
|
fc.assert(
|
|
fc.property(uniqueShootTypes, (shoots) => {
|
|
shootNavItems(shoots).forEach((item, index) => {
|
|
expect(item.to).toBe(shootPagePath(shoots[index].id));
|
|
expect(item.to.startsWith(`${SHOOT_TYPES_PATH}/`)).toBe(
|
|
true,
|
|
);
|
|
});
|
|
}),
|
|
);
|
|
});
|
|
|
|
it('has no other fields than to and label (invariant)', () => {
|
|
fc.assert(
|
|
fc.property(uniqueShootTypes, (shoots) => {
|
|
for (const item of shootNavItems(shoots)) {
|
|
expect(Object.keys(item).sort()).toEqual(['label', 'to']);
|
|
}
|
|
}),
|
|
);
|
|
});
|
|
|
|
it('gives the five names of the real shoot types in order', () => {
|
|
expect(shootNavItems(shootTypes).map((item) => item.label)).toEqual([
|
|
'Newborn',
|
|
'Zwangerschap',
|
|
'Gezin',
|
|
'Loveshoot',
|
|
'Portretten',
|
|
]);
|
|
});
|
|
|
|
it('gives an empty list for no shoots', () => {
|
|
expect(shootNavItems([])).toEqual([]);
|
|
});
|
|
});
|