Skip to content
memex

Pattern

Test cases

One folder per case, with one CASE.md: an id kept forever and a one-line claim, carried into the test’s name.

When to use it

When a claim about the code needs a test to prove it, and you want an agent to get from the claim to its test, and back, without reading the suite.

Steps

  1. Make one folder per case, with one CASE.md in it.
  2. Its frontmatter says memex: cases and gives the case its id, which is kept forever. The body’s first line is the claim.
  3. Put the id in the test’s name, so rg finds it: it("NAME-001 class names are stable", …).
  4. Writing a case before its test exists is fine; say so in the claim, “(planned)”.

A case

# tests/cases/NAME-001/CASE.md
---
memex: cases
id: NAME-001
---
Class names are stable across runs and platforms.
Evidence: `tests/namer.test.ts`

Find the tests for X

# the claims
memex search stable class names --in cases
# the claim and who cites it
memex show NAME-001
# the test itself
rg NAME-001

The id field is required: without it every CASE.md would take the id CASE from its file stem. memex search --in cases with no words prints the roster, and <-0 marks cases nothing cites.

← All patterns