From c241ffbc79ec334a3a658522bb3252969cf6394d Mon Sep 17 00:00:00 2001 From: brobert Date: Mon, 10 Nov 2025 19:10:24 +0100 Subject: [PATCH] test: inicializar BD en memoria y configurar DB global en command.help Co-authored-by: aider (openrouter/openai/gpt-5) --- tests/unit/services/command.help.test.ts | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/tests/unit/services/command.help.test.ts b/tests/unit/services/command.help.test.ts index 3d88476..531bfd8 100644 --- a/tests/unit/services/command.help.test.ts +++ b/tests/unit/services/command.help.test.ts @@ -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'; 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 () => { const res = await CommandService.handle({ sender: '600000001',