Skip to content

Commit dfd5d98

Browse files
committed
docs: clarify test-naming convention allows judgment for cross-cutting tests
The "one file per lexicon" rule is a default, not a strict requirement. When a test exercises behavior that spans multiple lexicons or code files (shared *.defs lexicons, cross-cutting union semantics, etc.), pick the clearest name for what's under test rather than duplicating near-identical tests across every carrier. Cite validate-signature-defs.test.ts as an illustrative example. Surfaced by CodeRabbit feedback on PR #170.
1 parent f0f6b40 commit dfd5d98

1 file changed

Lines changed: 16 additions & 1 deletion

File tree

AGENTS.md

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -294,10 +294,25 @@ npm run check
294294

295295
### Writing Tests
296296

297-
Tests live in `tests/` with one file per lexicon, named
297+
Tests live in `tests/` and by default use one file per lexicon, named
298298
`validate-<lexicon-slug>.test.ts` (e.g. `validate-link-evm.test.ts`,
299299
`validate-rights.test.ts`).
300300

301+
This is a convention, not a strict rule. When a test genuinely
302+
exercises behavior that spans multiple lexicons or code files —
303+
shared `*.defs` lexicons referenced from many records, cross-cutting
304+
union semantics, validation behavior that surfaces only in
305+
composition, etc. — pick the clearest, most concise name that
306+
describes what's actually under test, even if that file doesn't map
307+
1:1 to a single lexicon. Don't duplicate near-identical tests across
308+
every carrier just to satisfy the naming convention.
309+
310+
For example, `validate-signature-defs.test.ts` exercises
311+
`app.certified.signature.defs#list` (union of inline + strongRef,
312+
array semantics) via a representative record carrier, rather than
313+
spawning 19 near-identical files for every record lexicon that
314+
references the def.
315+
301316
The generated code provides two ways to validate records:
302317

303318
- **`validate()` from `generated/lexicons.js`** — generic, untyped.

0 commit comments

Comments
 (0)