testing
Installation
SKILL.md
Testing
Two suites: unit for action/service internals with dependencies stubbed; functional for HTTP endpoints hit against a real Postgres wrapped in a per-test transaction. Every spec matches the shape of the nearest existing spec — same imports, same setup/teardown order, same helpers. Anything that reaches out (mail, drive, emitter, transmit, third-party HTTP) must be faked; a global mail fake in tests/bootstrap.ts is a safety net so a forgotten setup doesn't send a real email.
Mandatory fakes by dependency
Every side-effect dependency needs an explicit fake so no test reaches real infra:
| Dependency | How to fake | Scope |
|---|---|---|
mail.fake() |
Global in tests/bootstrap.ts + per-test when asserting |
|
| Drive | drive.fake(env.get('DRIVE_DISK') ?? 'fs') |
Per-group setup + teardown |
| Emitter | emitter.fake(['event:name']) → EventsBuffer |
Per-test opt-in |
| Transmit (SSE) | transport: null in config/transmit.ts (default) |
Global |
emitter.fake takes an array of event names — a bare string is a TypeScript error: