This commit is contained in:
2025-07-20 20:43:06 +02:00
parent 0abee5b794
commit 29592c7fc8
93 changed files with 23400 additions and 131 deletions

View File

@ -0,0 +1,39 @@
const testDatabase = require('../testDatabase');
class TestHelper {
static async setupDatabase() {
try {
await testDatabase.connect();
await testDatabase.setupTables();
} catch (error) {
console.error('Failed to setup test database:', error);
throw error;
}
}
static async cleanupDatabase() {
try {
await testDatabase.cleanupTables();
await testDatabase.disconnect();
} catch (error) {
console.error('Failed to cleanup test database:', error);
}
}
static async clearTables() {
try {
await testDatabase.cleanupTables();
} catch (error) {
console.error('Failed to clear test tables:', error);
}
}
static mockDbErrorHandler() {
// Mock the dbErrorHandler to just execute the function
jest.mock('../../src/middleware/errorHandler', () => ({
dbErrorHandler: jest.fn((fn) => fn())
}));
}
}
module.exports = TestHelper;