test: reutilizar DB en memoria entre bloques de ResponseQueue

Co-authored-by: aider (openrouter/openai/gpt-5) <aider@aider.chat>
pull/1/head
borja 2 months ago
parent 504f15d491
commit 88b95847a1

@ -19,8 +19,7 @@ describe('ResponseQueue (persistent add)', () => {
afterAll(() => { afterAll(() => {
process.env = envBackup; process.env = envBackup;
(ResponseQueue as any).dbInstance = originalDbInstance; // No cerramos ni restablecemos la DB aquí; se hará al final del bloque de reintentos.
testDb.close();
}); });
beforeEach(() => { beforeEach(() => {
@ -108,15 +107,9 @@ describe('ResponseQueue (persistent add)', () => {
}); });
describe('ResponseQueue (retries/backoff)', () => { describe('ResponseQueue (retries/backoff)', () => {
beforeAll(() => { // Reutiliza la misma DB inyectada en el bloque anterior
// Re-crear DB en memoria y reinyectar para este bloque
testDb = new Database(':memory:');
initializeDatabase(testDb);
originalDbInstance = (ResponseQueue as any).dbInstance;
(ResponseQueue as any).dbInstance = testDb;
});
afterAll(() => { afterAll(() => {
// Restaurar DB original y cerrar la de prueba al finalizar todos los tests de reintentos
(ResponseQueue as any).dbInstance = originalDbInstance; (ResponseQueue as any).dbInstance = originalDbInstance;
testDb.close(); testDb.close();
}); });

Loading…
Cancel
Save