1# worker/test 2 3Helpers for the Worker's tests (the tests themselves sit beside their 4sources, as `src/*.test.ts`). Outside `src/`, so the Worker's type check and 5bundle never see them. 6 7| File | What it is | 8|---|---| 9| `kv.ts` | `memoryKV()`: a KV namespace in memory that records each `put` and its options (TTL, metadata). | 10| `budget.ts` | `memoryBudgets(limit)`: the `BUDGET` namespace, one `JevBudget`'s counting (`src/budget-counter.ts`) per name, each on its own in-memory SQLite, as a Durable Object's `ctx.storage.sql`. | 11| `authenticator.ts` | `authenticator()`: a passkey in software (ES256, `none` attestation) that answers the Worker's registration and sign-in options as a browser would, so `auth.test.ts` runs real signatures through the real library. | 12| `r2.ts` | `memoryR2()`: an R2 bucket in memory (put, get, delete, list). | 13| `tab-hubs.ts` | `memoryTabHubs()`: the `TAB_HUB` namespace, a hub per user holding the tabs a test opens. | 14| `d1.ts` | `testD1()`: a D1 database in memory (Node's `node:sqlite`) with every migration in `../migrations/` applied, so a test runs the Worker's real SQL against the real schema. |