|
|
|
|
@ -7,6 +7,7 @@ import { initializeDatabase, ensureUserExists } from '../../src/db';
|
|
|
|
|
|
|
|
|
|
// Simulated ResponseQueue for testing (in-memory array)
|
|
|
|
|
let simulatedQueue: any[] = [];
|
|
|
|
|
let originalAdd: any;
|
|
|
|
|
|
|
|
|
|
class SimulatedResponseQueue {
|
|
|
|
|
static async add(responses: any[]) {
|
|
|
|
|
@ -30,9 +31,12 @@ beforeAll(() => {
|
|
|
|
|
testDb = new Database(':memory:');
|
|
|
|
|
// Initialize schema
|
|
|
|
|
initializeDatabase(testDb);
|
|
|
|
|
// Guardar implementación original de ResponseQueue.add para restaurar después
|
|
|
|
|
originalAdd = (ResponseQueue as any).add;
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
afterAll(() => {
|
|
|
|
|
(ResponseQueue as any).add = originalAdd;
|
|
|
|
|
// Close the test database
|
|
|
|
|
testDb.close();
|
|
|
|
|
});
|
|
|
|
|
@ -82,6 +86,7 @@ describe('WebhookServer', () => {
|
|
|
|
|
|
|
|
|
|
afterEach(() => {
|
|
|
|
|
process.env = envBackup;
|
|
|
|
|
(ResponseQueue as any).add = originalAdd;
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
const createTestRequest = (payload: any) =>
|
|
|
|
|
|