From 372ce6e65bd528de3dd7386f9409c5b5e375642c Mon Sep 17 00:00:00 2001 From: Alexander Borg Date: Tue, 16 Sep 2025 21:53:09 +0200 Subject: [PATCH] Fix jwt-token --- server/tests/routes/detections.test.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/server/tests/routes/detections.test.js b/server/tests/routes/detections.test.js index c134729..a680ce8 100644 --- a/server/tests/routes/detections.test.js +++ b/server/tests/routes/detections.test.js @@ -5,7 +5,7 @@ const request = require('supertest'); const express = require('express'); const { setupTestEnvironment, teardownTestEnvironment, cleanDatabase, createTestUser, createTestTenant, createTestDevice, createTestDetection, generateTestToken } = require('../setup'); const detectionsRoutes = require('../../routes/detections'); -const { authenticateToken } = require('../../middleware/auth'); +const { authenticateToken, setModels } = require('../../middleware/auth'); describe('Detections Routes', () => { let app, models, sequelize; @@ -13,6 +13,9 @@ describe('Detections Routes', () => { before(async () => { ({ models, sequelize } = await setupTestEnvironment()); + // Inject models into auth middleware for testing + setModels(models); + // Setup express app for testing app = express(); app.use(express.json());