49c8def037
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
42 lines
1.5 KiB
TypeScript
42 lines
1.5 KiB
TypeScript
import { describe, expect, it } from 'vitest';
|
|
import { lintCopy, stripComments } from '../src/copy-lint.js';
|
|
|
|
describe('lint:copy core', () => {
|
|
it('reports a forbidden word in a string, with its line', () => {
|
|
const problems = lintCopy("export const a = 'ok';\nexport const b = 'A gentle therapy';\n");
|
|
expect(problems).toHaveLength(1);
|
|
expect(problems[0]?.line).toBe(2);
|
|
expect(problems[0]?.message).toContain('therapy');
|
|
});
|
|
|
|
it('reports a forbidden word in Svelte markup', () => {
|
|
expect(lintCopy('<p>For the lonely.</p>')).toHaveLength(1);
|
|
});
|
|
|
|
it('ignores comments, where rules are explained', () => {
|
|
expect(lintCopy('// never say therapy\n/* nor lonely */\n<!-- nor Gandalf -->\nconst ok = 1;')).toEqual([]);
|
|
});
|
|
|
|
it('keeps line numbers when it strips a multi-line comment', () => {
|
|
const problems = lintCopy("/*\n\n*/\nconst s = 'cure';");
|
|
expect(problems[0]?.line).toBe(4);
|
|
});
|
|
|
|
it('does not mistake a URL for a comment', () => {
|
|
expect(stripComments("'https://example.invalid/cure'")).toContain('cure');
|
|
});
|
|
|
|
it("reports 'Domi' standing alone", () => {
|
|
expect(lintCopy("const title = 'Domi';")).toHaveLength(1);
|
|
expect(lintCopy("const title = 'Welcome to Domi';")).toHaveLength(1);
|
|
});
|
|
|
|
it("accepts 'Domi' after its first word", () => {
|
|
expect(lintCopy("'Rosea Domi', 'Panda Domi', 'Amicitia Domi'")).toEqual([]);
|
|
});
|
|
|
|
it('accepts clean shell copy', () => {
|
|
expect(lintCopy("preparing: 'The garden is being prepared.'")).toEqual([]);
|
|
});
|
|
});
|