Adds the Soorten fotoshoots page
Replaces the placeholder with the five shoot types (Newborn, Zwangerschap, Gezin, Loveshoot, Portretten), each an article with its own anchor, photo, text and a link to the contact form that preselects the matching package. A portfolio link per shoot shows once the portfolio page is live. A closing call to action links to the prices and the contact form. The page is indexed with its own description and preview image, and describes the shoots as services of the business in structured data. That data is rendered in the page component, so the shoot texts stay out of the main bundle. The shoot photos are cropped at 848x1060, no longer upscaled. Photo pages get a mobile Lighthouse performance target of 0.85: their largest paint is a photo that the simulated slow connection only requests after the scripts have run. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -0,0 +1,97 @@
|
||||
import fc from 'fast-check';
|
||||
import { describe, expect, it } from 'vitest';
|
||||
import packages from '../content/packages';
|
||||
import shootTypes from '../content/shootTypes';
|
||||
import sitePages from '../sitePages';
|
||||
import { anyPackage, shootType } from '../test/arbitraries';
|
||||
import {
|
||||
isPortfolioLive,
|
||||
shootContactLink,
|
||||
shootPortfolioLink,
|
||||
} from './shootLinks';
|
||||
import { visiblePackages } from './visiblePackages';
|
||||
|
||||
const shoot = (id: string) => shootTypes.find((item) => item.id === id)!;
|
||||
|
||||
describe('shootContactLink', () => {
|
||||
it('preselects the package of a shoot that has one', () => {
|
||||
expect(shootContactLink(shoot('newborn'), packages)).toEqual({
|
||||
to: '/',
|
||||
search: { pakket: 'newborn' },
|
||||
hash: 'contact',
|
||||
});
|
||||
});
|
||||
|
||||
it('links without a package for a shoot that has none', () => {
|
||||
expect(shootContactLink(shoot('loveshoot'), packages)).toEqual({
|
||||
to: '/',
|
||||
hash: 'contact',
|
||||
});
|
||||
});
|
||||
|
||||
it('leaves out a package that is not shown', () => {
|
||||
expect(
|
||||
shootContactLink(
|
||||
shoot('gezin'),
|
||||
packages.filter((pkg) => pkg.id !== 'gezin'),
|
||||
),
|
||||
).toEqual({ to: '/', hash: 'contact' });
|
||||
});
|
||||
|
||||
it('always goes to the contact section (invariant)', () => {
|
||||
fc.assert(
|
||||
fc.property(shootType, fc.array(anyPackage), (item, list) => {
|
||||
const link = shootContactLink(item, list);
|
||||
return link.to === '/' && link.hash === 'contact';
|
||||
}),
|
||||
);
|
||||
});
|
||||
|
||||
it('only preselects a shown package, and then exactly that one (invariant)', () => {
|
||||
fc.assert(
|
||||
fc.property(shootType, fc.array(anyPackage), (item, list) => {
|
||||
const link = shootContactLink(item, list);
|
||||
const shownIds = visiblePackages(list).map((pkg) => pkg.id);
|
||||
const expected = shownIds.includes(item.packageId ?? '');
|
||||
expect(link.search !== undefined).toBe(expected);
|
||||
if (link.search !== undefined) {
|
||||
expect(link.search.pakket).toBe(item.packageId);
|
||||
expect(shownIds).toContain(link.search.pakket);
|
||||
}
|
||||
}),
|
||||
);
|
||||
});
|
||||
});
|
||||
|
||||
describe('shootPortfolioLink', () => {
|
||||
it('filters the portfolio on the shoot type (invariant)', () => {
|
||||
fc.assert(
|
||||
fc.property(shootType, (item) => {
|
||||
expect(shootPortfolioLink(item)).toEqual({
|
||||
to: '/portfolio',
|
||||
search: { shoot: item.id },
|
||||
});
|
||||
}),
|
||||
);
|
||||
});
|
||||
});
|
||||
|
||||
describe('isPortfolioLive', () => {
|
||||
it('follows whether the portfolio page is indexed', () => {
|
||||
expect(isPortfolioLive(sitePages)).toBe(
|
||||
sitePages['/portfolio'].indexed,
|
||||
);
|
||||
expect(
|
||||
isPortfolioLive({
|
||||
...sitePages,
|
||||
'/portfolio': { ...sitePages['/portfolio'], indexed: true },
|
||||
}),
|
||||
).toBe(true);
|
||||
expect(
|
||||
isPortfolioLive({
|
||||
...sitePages,
|
||||
'/portfolio': { ...sitePages['/portfolio'], indexed: false },
|
||||
}),
|
||||
).toBe(false);
|
||||
});
|
||||
});
|
||||
Reference in New Issue
Block a user