Completes the front-end shell with footer, status pages and SEO
Adds the footer, back-to-top button, skip link, placeholder routes, 404 and error pages inside the shell, plus per-page SEO from a single page registry (canonical URLs, Open Graph image, JSON-LD, generated sitemap.xml and robots.txt). Theme tokens and recipes replace repeated styling, the hero loads only the active and neighbouring slides, and the e-mail address is joined in the browser to keep it out of the HTML and bundle. Adds Vitest with property-based (fast-check) and axe tests, ESLint, security headers for dev and preview, Lighthouse CI and a `pnpm check` script that runs all quality gates. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -0,0 +1,49 @@
|
||||
import fc from 'fast-check';
|
||||
import type { EmailAddress, SocialLink } from '../content/types';
|
||||
|
||||
// Gedeelde generators voor de property-based tests (fast-check)
|
||||
|
||||
const platform = fc.constantFrom('facebook' as const, 'instagram' as const);
|
||||
|
||||
// Een padsegment zoals in een route: kleine letters, cijfers en streepjes
|
||||
export const pathSegment = fc.stringMatching(/^[a-z0-9-]{1,12}$/);
|
||||
|
||||
export const routePath = fc
|
||||
.array(pathSegment, { maxLength: 4 })
|
||||
.map((segments) => '/' + segments.join('/'));
|
||||
|
||||
export const httpsUrl = fc.webUrl({ validSchemes: ['https'] });
|
||||
|
||||
// Mix van geldige en ongeldige href's zoals het CMS ze zou kunnen leveren
|
||||
export const anyHref = fc.oneof(
|
||||
httpsUrl,
|
||||
fc.webUrl({ validSchemes: ['http'] }),
|
||||
fc.constantFrom(
|
||||
'',
|
||||
'javascript:alert(1)',
|
||||
'/relatief',
|
||||
'geen url',
|
||||
'https://',
|
||||
),
|
||||
fc.string(),
|
||||
);
|
||||
|
||||
export const socialLink: fc.Arbitrary<SocialLink> = fc.record({
|
||||
platform,
|
||||
href: anyHref,
|
||||
});
|
||||
|
||||
// Een geldig deel van een e-mailadres: geen spaties, geen @
|
||||
const emailPart = fc.stringMatching(/^[a-z0-9._-]{1,20}$/);
|
||||
|
||||
export const validEmail: fc.Arbitrary<EmailAddress> = fc.record({
|
||||
user: emailPart,
|
||||
domain: fc
|
||||
.tuple(emailPart, fc.stringMatching(/^[a-z]{2,6}$/))
|
||||
.map(([name, tld]) => `${name}.${tld}`),
|
||||
});
|
||||
|
||||
export const anyEmail: fc.Arbitrary<EmailAddress> = fc.oneof(
|
||||
validEmail,
|
||||
fc.record({ user: fc.string(), domain: fc.string() }),
|
||||
);
|
||||
Reference in New Issue
Block a user