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>
36 lines
1.4 KiB
TypeScript
36 lines
1.4 KiB
TypeScript
import { describe, expect, it } from 'vitest';
|
|
import { contentSecurityPolicy, securityHeaders } from './securityHeaders';
|
|
|
|
const directive = (csp: string, name: string) =>
|
|
csp.split('; ').find((d) => d.startsWith(name + ' ')) ?? '';
|
|
|
|
describe('securityHeaders', () => {
|
|
it('productie-CSP heeft geen onveilige uitzonderingen voor scripts', () => {
|
|
const csp = contentSecurityPolicy('production');
|
|
expect(csp).not.toContain('unsafe-eval');
|
|
expect(directive(csp, 'script-src')).toBe("script-src 'self'");
|
|
expect(csp).not.toContain('ws:');
|
|
expect(directive(csp, 'frame-ancestors')).toBe(
|
|
"frame-ancestors 'none'",
|
|
);
|
|
});
|
|
|
|
it('dev-CSP voegt alleen toe wat Vite nodig heeft', () => {
|
|
const csp = contentSecurityPolicy('development');
|
|
expect(directive(csp, 'script-src')).toBe(
|
|
"script-src 'self' 'unsafe-inline'",
|
|
);
|
|
expect(directive(csp, 'connect-src')).toBe("connect-src 'self' ws:");
|
|
expect(csp).not.toContain('unsafe-eval');
|
|
});
|
|
|
|
it('zet alle verplichte headers', () => {
|
|
expect(securityHeaders('production')).toMatchObject({
|
|
'Strict-Transport-Security': 'max-age=31536000; includeSubDomains',
|
|
'X-Content-Type-Options': 'nosniff',
|
|
'X-Frame-Options': 'DENY',
|
|
'Referrer-Policy': 'strict-origin-when-cross-origin',
|
|
});
|
|
});
|
|
});
|