@@ -53,6 +53,24 @@ bun run typecheck # tsc --noEmit type checking
5353
5454 The `spec.md` file is the source of truth for all API design decisions. Always read it before making changes to core framework behavior. The open questions at the bottom track what's been decided vs. still in progress.
5555
56+## Testing Strategy
57+
58+Use `bun test` (built-in test runner, no extra deps). Test files live next to source as `*.test.ts`.
59+
60+**TDD for pure logic** — write tests first for:
61+
62+- Character width (`visibleWidth`, grapheme segmentation, ANSI stripping)
63+- Cell buffer (write, read, diff)
64+- Layout engine (input tree + available space → output rects)
65+- Painting/clipping (node + rect → cell buffer contents)
66+- Hit detection (position → node lookup)
67+- Focus/key routing (key events → correct handler)
68+
69+**Integration tests with mock terminal** for:
70+
71+- Terminal I/O (assert emitted ANSI sequences against an in-memory buffer)
72+- End-to-end pipeline (`cel.viewport` → rendered output)
73+
5674 ## Conventions
5775
5876 - All code is TypeScript with strict mode