Fix jwt-token

This commit is contained in:
2025-09-15 13:50:59 +02:00
parent 4f0ce39c69
commit 44f2607773
2 changed files with 25 additions and 3 deletions

View File

@@ -108,7 +108,24 @@ async function teardownTestEnvironment() {
*/
async function cleanDatabase() {
if (sequelize) {
await sequelize.sync({ force: true });
try {
// Disable foreign key checks temporarily
await sequelize.query('PRAGMA foreign_keys = OFF');
// Force sync with drop and recreate
await sequelize.sync({ force: true });
// Re-enable foreign key checks
await sequelize.query('PRAGMA foreign_keys = ON');
// Reset test counter to ensure fresh unique IDs
testCounter = 0;
console.log('✅ Database cleaned successfully');
} catch (error) {
console.error('❌ Database cleanup failed:', error.message);
throw error;
}
}
}