From a73c8c058ff6f95a6cc0089cc73d93bcc0f90b14 Mon Sep 17 00:00:00 2001 From: Alexander Borg Date: Mon, 15 Sep 2025 15:15:47 +0200 Subject: [PATCH] Fix jwt-token --- server/tests/setup.js | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/server/tests/setup.js b/server/tests/setup.js index c1bc201..5e9a41e 100644 --- a/server/tests/setup.js +++ b/server/tests/setup.js @@ -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; + } } }