refactor: migrate from node-sqlite3-wasm to better-sqlite3
Replace all db.run(sql, [params]) calls with db.prepare(sql).run(...params) across all source modules and test files. Also remove the node-sqlite3-wasm import from tests/db.test.ts and update the type annotation accordingly. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -8,10 +8,9 @@ beforeAll(() => {
|
||||
const db = initDb(':memory:');
|
||||
// Create a test user
|
||||
const hash = bcrypt.hashSync('correctpassword', 10);
|
||||
db.run(
|
||||
`INSERT INTO users (username, password_hash) VALUES (?, ?)`,
|
||||
['testuser', hash]
|
||||
);
|
||||
db.prepare(
|
||||
`INSERT INTO users (username, password_hash) VALUES (?, ?)`
|
||||
).run('testuser', hash);
|
||||
});
|
||||
|
||||
afterAll(() => {
|
||||
|
||||
@@ -9,22 +9,22 @@ beforeAll(() => {
|
||||
const db = initDb(':memory:');
|
||||
|
||||
// Create a layout
|
||||
db.run(
|
||||
db.prepare(
|
||||
`INSERT INTO layouts (id, name, type, width, height)
|
||||
VALUES (1, 'Test Layout', 'free', 800, 480)`
|
||||
);
|
||||
).run();
|
||||
|
||||
// Display without token
|
||||
db.run(
|
||||
db.prepare(
|
||||
`INSERT INTO displays (id, name, layout_id, refresh_sec)
|
||||
VALUES (1, 'Open Display', 1, 60)`
|
||||
);
|
||||
).run();
|
||||
|
||||
// Display with token auth
|
||||
db.run(
|
||||
db.prepare(
|
||||
`INSERT INTO displays (id, name, layout_id, api_token, refresh_sec)
|
||||
VALUES (2, 'Secure Display', 1, 'secret-token-123', 300)`
|
||||
);
|
||||
).run();
|
||||
});
|
||||
|
||||
afterAll(() => {
|
||||
|
||||
Reference in New Issue
Block a user