17 lines
665 B
TypeScript
17 lines
665 B
TypeScript
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" }]);
|
|
});
|
|
});
|