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());