test: inicializar BD en memoria y configurar DB global en command.help

Co-authored-by: aider (openrouter/openai/gpt-5) <aider@aider.chat>
main
brobert 1 month ago
parent 4b1374a4a4
commit c241ffbc79

@ -1,7 +1,22 @@
import { describe, it, expect } from 'bun:test'; import { describe, it, expect, beforeAll, afterAll } from 'bun:test';
import { Database } from 'bun:sqlite';
import { initializeDatabase } from '../../../src/db';
import { setDb, resetDb } from '../../../src/db/locator';
import { CommandService } from '../../../src/services/command'; import { CommandService } from '../../../src/services/command';
describe('CommandService - /t ayuda y /t ayuda avanzada usando help centralizado', () => { describe('CommandService - /t ayuda y /t ayuda avanzada usando help centralizado', () => {
let memdb: Database;
beforeAll(() => {
memdb = new Database(':memory:');
initializeDatabase(memdb);
setDb(memdb);
});
afterAll(() => {
resetDb();
try { (memdb as any)?.close?.(); } catch {}
});
it('"/t ayuda" incluye quick help y CTA a ayuda avanzada', async () => { it('"/t ayuda" incluye quick help y CTA a ayuda avanzada', async () => {
const res = await CommandService.handle({ const res = await CommandService.handle({
sender: '600000001', sender: '600000001',

Loading…
Cancel
Save