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
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?
2 Replies
Unknown User
Unknown User•17mo ago
Message Not Public
Sign In & Join Server To View
Adi
Adi•17mo ago
Got it, I'll ask in that channel, thanks 🙂
Want results from more Discord servers?
Add your server