jevstrudel.git / worker / test / README.md

worker/test

Helpers for the Worker's tests (the tests themselves sit beside their sources, as src/*.test.ts). Outside src/, so the Worker's type check and bundle never see them.

FileWhat it is
kv.tsmemoryKV(): a KV namespace in memory that records each put and its options (TTL, metadata).
budget.tsmemoryBudgets(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.
authenticator.tsauthenticator(): 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.
r2.tsmemoryR2(): an R2 bucket in memory (put, get, delete, list).
tab-hubs.tsmemoryTabHubs(): the TAB_HUB namespace, a hub per user holding the tabs a test opens.
d1.tstestD1(): 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.