From ab04a3e776e109e6c2158a765b54ee4b17c8c582 Mon Sep 17 00:00:00 2001 From: Alexander Borg Date: Mon, 15 Sep 2025 05:18:01 +0200 Subject: [PATCH] Fix jwt-token --- server/tests/setup.js | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/server/tests/setup.js b/server/tests/setup.js index c877ad9..4ae6799 100644 --- a/server/tests/setup.js +++ b/server/tests/setup.js @@ -74,6 +74,15 @@ async function setupTestEnvironment() { ManagementUser }; + // Override the main models module with our test models + // This ensures that when other modules import '../models', they get our test models + const mainModelsPath = path.resolve(__dirname, '../models/index.js'); + require.cache[mainModelsPath] = { + exports: models, + loaded: true, + id: mainModelsPath + }; + // Sync database await sequelize.sync({ force: true });