import { describe, it, expect, beforeAll, afterAll } from "vitest";
import { drizzle, DrizzleD1Database } from "drizzle-orm/d1";
import { env, applyD1Migrations } from "cloudflare:test";
import { contributorRole } from "db/schema";
import { v7 as uuidv7 } from "uuid";
// This is now connected to your persistent local D1
let db: DrizzleD1Database;
beforeAll(async () => {
await applyD1Migrations(env.DB, env.TEST_MIGRATIONS);
db = drizzle(env.DB);
});
describe("ContributorRole Service", () => {
it("should find data I already migrated", async () => {
// lalala
// This will now query your actual local .sqlite file
const roles = await db
.insert(contributorRole)
.values({
id: uuidv7(),
name: "Role",
createdAt: new Date(),
updatedAt: new Date(),
})
.returning()
.get();
console.log(roles.name, "Role");
expect(roles).toBeDefined();
});
});
import { describe, it, expect, beforeAll, afterAll } from "vitest";
import { drizzle, DrizzleD1Database } from "drizzle-orm/d1";
import { env, applyD1Migrations } from "cloudflare:test";
import { contributorRole } from "db/schema";
import { v7 as uuidv7 } from "uuid";
// This is now connected to your persistent local D1
let db: DrizzleD1Database;
beforeAll(async () => {
await applyD1Migrations(env.DB, env.TEST_MIGRATIONS);
db = drizzle(env.DB);
});
describe("ContributorRole Service", () => {
it("should find data I already migrated", async () => {
// lalala
// This will now query your actual local .sqlite file
const roles = await db
.insert(contributorRole)
.values({
id: uuidv7(),
name: "Role",
createdAt: new Date(),
updatedAt: new Date(),
})
.returning()
.get();
console.log(roles.name, "Role");
expect(roles).toBeDefined();
});
});