Skip to content

Commit 692d5f8

Browse files
alexandre-mrtclaude
andcommitted
test: add DB schema validation (129 tests)
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent 6aadad2 commit 692d5f8

File tree

1 file changed

+20
-0
lines changed

1 file changed

+20
-0
lines changed

tests/db-schema.test.ts

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
import { describe, expect, test } from "bun:test";
2+
3+
process.env.DATABASE_URL = ":memory:";
4+
const { db } = await import("../src/services/db");
5+
6+
describe("DB schema", () => {
7+
test("drops table exists", () => {
8+
const result = db.prepare("SELECT name FROM sqlite_master WHERE type='table' AND name='drops'").get();
9+
expect(result).toBeTruthy();
10+
});
11+
12+
test("drops table has expected columns", () => {
13+
const cols = db.prepare("PRAGMA table_info(drops)").all();
14+
const names = (cols as Array<{name: string}>).map(c => c.name);
15+
expect(names).toContain("id");
16+
expect(names).toContain("root_hash");
17+
expect(names).toContain("file_name");
18+
expect(names).toContain("downloads");
19+
});
20+
});

0 commit comments

Comments
 (0)