Files
Rosea/packages/content/test/forbidden.test.ts
T
mnovak 49c8def037 [repo] Workspace: Scaffold Phase 0 with schema, engine, content, ui and the PWA shell
pnpm + turbo workspace with the commands from CLAUDE.md §3. The contracts
from §6 as JSON Schemas with generated types; localDay as the one place a
day is computed; the forbidden-word list shared by lint:copy and the
library validator, with 13 negative fixtures; a Svelte 5 PWA shell built
under /Rosea/ with a meta CSP. E2E and offline suites run against the
built bundle; the offline one closes the server rather than emulating.

Analysis: .agents/features/phase0-workspace.md
2026-11-01 00:27:33 +01:00

45 lines
1.4 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']);
});
});
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([]);
});
});