|
|
|
|
@ -1,7 +1,23 @@
|
|
|
|
|
import { describe, it, expect } from 'bun:test';
|
|
|
|
|
import { describe, it, expect, beforeEach, afterEach } from 'bun:test';
|
|
|
|
|
import { Database } from 'bun:sqlite';
|
|
|
|
|
import { initializeDatabase } from '../../../src/db';
|
|
|
|
|
import { CommandService } from '../../../src/services/command';
|
|
|
|
|
import { setDb, resetDb } from '../../../src/db/locator';
|
|
|
|
|
|
|
|
|
|
describe('CommandService - comando desconocido devuelve ayuda rápida', () => {
|
|
|
|
|
let memdb: Database;
|
|
|
|
|
|
|
|
|
|
beforeEach(() => {
|
|
|
|
|
process.env.NODE_ENV = 'test';
|
|
|
|
|
memdb = new Database(':memory:');
|
|
|
|
|
initializeDatabase(memdb);
|
|
|
|
|
setDb(memdb);
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
afterEach(() => {
|
|
|
|
|
try { resetDb(); memdb.close(); } catch {}
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
it('responde con encabezado y CTA a /t ayuda incluyendo quick help', async () => {
|
|
|
|
|
const res = await CommandService.handle({
|
|
|
|
|
sender: '600000001',
|
|
|
|
|
|