Shows the three live packages as cards with their price and what is included. Each card links to the contact section with ?pakket=<id>, so the contact form can preselect it. Invalid packages from the CMS are skipped and the pakket value is only accepted when it names a package. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
33 lines
1.1 KiB
TypeScript
33 lines
1.1 KiB
TypeScript
import fc from 'fast-check';
|
|
import { describe, expect, it } from 'vitest';
|
|
import { formatPrice } from './formatPrice';
|
|
|
|
const NBSP = '\u00a0';
|
|
|
|
describe('formatPrice', () => {
|
|
it('formats whole euros the Dutch way', () => {
|
|
expect(formatPrice(175)).toBe(`€${NBSP}175`);
|
|
expect(formatPrice(1250)).toBe(`€${NBSP}1.250`);
|
|
});
|
|
|
|
it('gives back the amount from its digits (round-trip)', () => {
|
|
fc.assert(
|
|
fc.property(fc.integer({ min: 1, max: 1_000_000 }), (price) => {
|
|
expect(Number(formatPrice(price).replace(/\D/g, ''))).toBe(
|
|
price,
|
|
);
|
|
}),
|
|
);
|
|
});
|
|
|
|
it('starts with the euro sign and a non-breaking space, and has no breaking space (invariant)', () => {
|
|
fc.assert(
|
|
fc.property(fc.integer({ min: 1, max: 1_000_000 }), (price) => {
|
|
const text = formatPrice(price);
|
|
expect(text.startsWith(`€${NBSP}`)).toBe(true);
|
|
expect(/[ \t\n\u202f]/.test(text)).toBe(false);
|
|
}),
|
|
);
|
|
});
|
|
});
|