File tree Expand file tree Collapse file tree 1 file changed +20
-0
lines changed
Expand file tree Collapse file tree 1 file changed +20
-0
lines changed Original file line number Diff line number Diff line change 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+ } ) ;
You can’t perform that action at this time.
0 commit comments