mirror of
https://github.com/actualbudget/actual.git
synced 2026-04-28 18:40:34 -05:00
* Port to ESM * + @types packages * s/rmdir/rm/ * bump uuid * Fix reading in eslintrc * Add /build to eslintignore * Update linting/types packages * Stronger error checking * - DOM globals * update better-sqlite3 * Create .node-version * Revert "update better-sqlite3" This reverts commit 6b8003804fc09ade6c81324f591e5ad853517dfa.
18 lines
671 B
JavaScript
18 lines
671 B
JavaScript
import fs from 'node:fs';
|
|
import path from 'node:path';
|
|
import getAccountDb from './src/account-db.js';
|
|
import config from './src/load-config.js';
|
|
|
|
// Delete previous test database (force creation of a new one)
|
|
const dbPath = path.join(config.serverFiles, 'account.sqlite');
|
|
if (fs.existsSync(dbPath)) fs.unlinkSync(dbPath);
|
|
|
|
// Create path for test user files and delete previous files there
|
|
if (fs.existsSync(config.userFiles))
|
|
fs.rmSync(config.userFiles, { recursive: true });
|
|
fs.mkdirSync(config.userFiles);
|
|
|
|
// Insert a fake "valid-token" fixture that can be reused
|
|
const db = getAccountDb();
|
|
db.mutate('INSERT INTO sessions (token) VALUES (?)', ['valid-token']);
|