Both @rozenmd and I were chatting about the state of testing (our excuse: we're in alpha). We're wor

Both @rozenmd and I were chatting about the state of testing (our excuse: we're in alpha). We're working through a design but I think the right approach is to be able to call:

  • createTestDatabase(): Promise<D1Database>
  • runMigration(db: D1Database, name: string, dir?: string): Promise<void>
  • deleteTestDatabase(db: D1Database): Promise<void>
... as helper methods that spawn a local DB for testing against. The D1Database allows you to call the regular .prepare, .exec, etc methods on top.

What else are folks wanting here? We want avoid local testing drifting from production APIs, and you shouldn't have to think about where .state is stored.
Was this page helpful?