test: move resetDb to own testing lib function

This commit is contained in:
2024-06-15 06:04:58 -04:00
parent 98d0be141e
commit fd61974740
4 changed files with 16 additions and 15 deletions

View File

@@ -3,8 +3,6 @@ import { drizzle } from "drizzle-orm/libsql";
import type { Env } from "~/types/env";
import { tables } from "./schema";
type Db = ReturnType<typeof createDb>;
let db: Db | null = null;
@@ -17,14 +15,6 @@ export function getDb(env: Env): Db {
return db;
}
export async function resetDb() {
if (!db) return;
for (const table of tables) {
await db.delete(table);
}
}
function createDb(env: Env) {
const client = createClient({
url: env.TURSO_URL,