Files
Rosea/packages/content/test/forbidden.test.ts
T
mnovak 6885a217cd [repo] Workspace: Review Phase 0 and record gaps, lessons and handover
Adversarial review with per-package counts and 13 reintroduced bugs, all
caught. Fixes from the review: the trace geocell is capped at 6 characters
(~1 km; 16 allowed centimetres), one forbidden-word hit per place, and an
e2e guard that meta charset stays within the first 1024 bytes.

CLAUDE.md §6.2 no longer contradicts itself about care acts; §2 and §3
say what Phase 0 actually built.
2026-11-01 00:36:06 +01:00

50 lines
1.6 KiB
TypeScript

import { describe, expect, it } from 'vitest';
import { FORBIDDEN, findForbidden } from '../src/forbidden.js';
const terms = (text: string): string[] => findForbidden(text).map((h) => h.term);
describe('forbidden words — what is caught', () => {
it('catches every listed term on its own', () => {
const missed = FORBIDDEN.filter(({ term }) => !terms(`before ${term} after`).includes(term)).map((t) => t.term);
expect(missed).toEqual([]);
});
it.each([
['A soft THERAPY for the soul', 'therapy'],
['self-healing petals', 'healing'],
["the rose's lonely planet", 'lonely'],
['Loneliness.', 'loneliness'],
['a treat for the fox', 'treat'],
['be patient with yourself', 'patient'],
['Middle-earth', 'Middle-earth'],
['Middle earth', 'Middle-earth'],
['Malý princ', 'Malý princ'],
['Saint-Exupéry wrote', 'Saint-Exupéry']
])('"%s" contains %s', (text, term) => {
expect(terms(text)).toContain(term);
});
it('reports hits in reading order', () => {
expect(terms('cure first, then therapy')).toEqual(['cure', 'therapy']);
});
it('reports one word once, though two spellings of it match', () => {
expect(terms('Middle earth')).toHaveLength(1);
expect(terms('Middle-earth and Middle earth')).toHaveLength(2);
});
});
describe('forbidden words — what is NOT caught', () => {
it.each([
'a treaty between two roses',
'a healthy rose',
'patience, and patiently waiting',
'the lamplighter on his planet',
'the king, the vain man, the businessman',
'a fox among the berries',
'Rosea Domi'
])('"%s" is clean', (text) => {
expect(terms(text)).toEqual([]);
});
});