Cloudflare DevelopersCD
Cloudflare Developers3y ago
1 reply
Adi

Miniflare 3 D1 testing

Some of the discussion actually reminded me of a question I have had since wrangler3/miniflare3 came out.
With those old miniflare packages (https://www.npmjs.com/package/@miniflare/d1) when in a test environment, you could write code that would simulate d1 in the following way
import { D1Database, D1DatabaseAPI } from "@miniflare/d1";
import { drizzle } from "drizzle-orm/d1";

const d1 = new D1Database(new D1DatabaseAPI(sqliteDb));
const db = drizzle(d1); // now I can can write unit tests for drizzle


How can I write this with miniflare 3?
Was this page helpful?