import type { DatabaseSync } from "node:sqlite"; import { camel } from "../../src/main/services/snapshot-service"; /** A table's rows with camel-cased keys, for asserting backend records the app no longer ships to the window. */ export function tableRows(db: DatabaseSync, table: string, orderBy: string, booleans: string[] = []): Array> { return (db.prepare(`select * from ${table} order by ${orderBy}`).all() as Array>).map((row) => { const next = camel(row as Record); for (const key of booleans) next[key] = next[key] === 1; return next; }); }