feat(db): drizzle schema (settings, sessions) + boot migrations
This commit is contained in:
16
server/test/db.test.ts
Normal file
16
server/test/db.test.ts
Normal file
@@ -0,0 +1,16 @@
|
||||
import { describe, expect, test } from "bun:test";
|
||||
import { mkdtempSync } from "node:fs";
|
||||
import { tmpdir } from "node:os";
|
||||
import { join } from "node:path";
|
||||
import { openDb } from "../src/db";
|
||||
import { settings } from "../src/db/schema";
|
||||
|
||||
describe("db", () => {
|
||||
test("opens, migrates, round-trips a setting", async () => {
|
||||
const dir = mkdtempSync(join(tmpdir(), "helios-"));
|
||||
const db = openDb(dir);
|
||||
await db.insert(settings).values({ key: "llm_base_url", value: "https://openrouter.ai/api/v1" });
|
||||
const rows = await db.select().from(settings);
|
||||
expect(rows).toEqual([{ key: "llm_base_url", value: "https://openrouter.ai/api/v1" }]);
|
||||
});
|
||||
});
|
||||
Reference in New Issue
Block a user