feat: add MariaDB schema and connection pool

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
2026-07-29 14:09:46 +02:00
co-authored by Claude Sonnet 5
parent 378ca762a2
commit a5ab05303f
3 changed files with 68 additions and 0 deletions
+26
View File
@@ -0,0 +1,26 @@
import { describe, it, expect, afterAll } from 'vitest';
import { getPool, closePool } from '../src/db.js';
import { loadConfig } from '../src/config.js';
describe('getPool', () => {
afterAll(async () => {
await closePool();
});
it('returns a working pool that can run a query', async () => {
const config = loadConfig();
const pool = getPool(config);
const rows = await pool.query('SELECT 1 AS value');
expect(Number(rows[0].value)).toBe(1);
});
it('returns the same pool instance on repeated calls', () => {
const config = loadConfig();
const poolA = getPool(config);
const poolB = getPool(config);
expect(poolA).toBe(poolB);
});
});