Fix jwt-token
This commit is contained in:
@@ -103,7 +103,23 @@ async function teardownTestEnvironment() {
|
||||
*/
|
||||
async function cleanDatabase() {
|
||||
if (sequelize) {
|
||||
await sequelize.sync({ force: true });
|
||||
try {
|
||||
// Drop all tables and recreate them
|
||||
await sequelize.drop();
|
||||
await sequelize.sync({ force: true });
|
||||
|
||||
// Verify tables are clean
|
||||
const tableNames = Object.keys(sequelize.models);
|
||||
for (const tableName of tableNames) {
|
||||
const count = await sequelize.models[tableName].count();
|
||||
if (count > 0) {
|
||||
console.warn(`Warning: ${tableName} table not properly cleaned, has ${count} records`);
|
||||
}
|
||||
}
|
||||
} catch (error) {
|
||||
console.error('Error cleaning database:', error);
|
||||
throw error;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user