mirror of
https://github.com/mileswolfallen2/miles-web.git
synced 2026-12-03 23:44:07 +00:00
- Implement tests for HTTP API endpoints, ensuring correct responses and security headers. - Create configuration tests to validate loading of defaults and environment overrides. - Add tests for FEDL service to verify data handling and snapshot functionality. - Introduce GitHub service tests to check API data normalization and caching behavior. - Develop monitor service tests for network checks and uptime calculations. - Implement persistence tests to ensure database migrations are idempotent and data persists across restarts. - Add vault service tests for session management and brute-force protection mechanisms. - Include helper functions for test context creation and JSON response handling.
21 lines
666 B
JavaScript
21 lines
666 B
JavaScript
import { loadEnv } from '../lib/env.js';
|
|
import { loadConfig } from '../config.js';
|
|
import { openDatabase } from '../db/index.js';
|
|
import { migrate } from '../db/migrate.js';
|
|
import { seedConfig } from '../db/seed.js';
|
|
|
|
loadEnv();
|
|
const config = loadConfig();
|
|
const db = openDatabase(config.dbPath);
|
|
const count = migrate(db);
|
|
seedConfig(db, config);
|
|
const tables = db
|
|
.prepare("SELECT name FROM sqlite_master WHERE type = 'table' AND name NOT LIKE 'sqlite_%' ORDER BY name")
|
|
.all()
|
|
.map((row) => row.name);
|
|
db.close();
|
|
|
|
console.log(`Database ready: ${config.dbPath}`);
|
|
console.log(`Migrations applied: ${count}`);
|
|
console.log(`Tables: ${tables.join(', ')}`);
|