Fix jwt-token

This commit is contained in:
2025-09-17 21:49:48 +02:00
parent 8c2943ac84
commit 0aacbd9a16
3 changed files with 26 additions and 6 deletions

View File

@@ -277,7 +277,10 @@ describe('Integration Tests', () => {
const mockIo = { const mockIo = {
emit: sinon.stub(), emit: sinon.stub(),
emitToDashboard: sinon.stub(), emitToDashboard: sinon.stub(),
emitToDevice: sinon.stub() emitToDevice: sinon.stub(),
to: (room) => ({
emit: sinon.stub()
})
}; };
// Simulate drone approach with multiple detections // Simulate drone approach with multiple detections

View File

@@ -27,7 +27,10 @@ describe('Detectors Routes', () => {
req.io = { req.io = {
emit: () => {}, // Mock emit function that does nothing emit: () => {}, // Mock emit function that does nothing
emitToDashboard: () => {}, emitToDashboard: () => {},
emitToDevice: () => {} emitToDevice: () => {},
to: (room) => ({
emit: () => {} // Mock room-based emit for tenant isolation
})
}; };
next(); next();
}); });

View File

@@ -448,7 +448,10 @@ describe('AlertService', () => {
const mockIo = { const mockIo = {
emit: sinon.stub(), emit: sinon.stub(),
emitToDashboard: sinon.stub(), emitToDashboard: sinon.stub(),
emitToDevice: sinon.stub() emitToDevice: sinon.stub(),
to: (room) => ({
emit: sinon.stub()
})
}; };
const result = await alertService.processDetectionAlert(detection, mockIo); const result = await alertService.processDetectionAlert(detection, mockIo);
@@ -469,7 +472,10 @@ describe('AlertService', () => {
const mockIo = { const mockIo = {
emit: sinon.stub(), emit: sinon.stub(),
emitToDashboard: sinon.stub(), emitToDashboard: sinon.stub(),
emitToDevice: sinon.stub() emitToDevice: sinon.stub(),
to: (room) => ({
emit: sinon.stub()
})
}; };
await alertService.processDetectionAlert(detection, mockIo); await alertService.processDetectionAlert(detection, mockIo);
@@ -500,7 +506,11 @@ describe('AlertService', () => {
rssi: -45 rssi: -45
}); });
const mockIo = { emitToDashboard: sinon.stub(), emitToDevice: sinon.stub() }; const mockIo = {
emitToDashboard: sinon.stub(),
emitToDevice: sinon.stub(),
to: (room) => ({ emit: sinon.stub() })
};
await alertService.processDetectionAlert(detection1, mockIo); await alertService.processDetectionAlert(detection1, mockIo);
await alertService.processDetectionAlert(detection2, mockIo); await alertService.processDetectionAlert(detection2, mockIo);
@@ -520,7 +530,11 @@ describe('AlertService', () => {
threatLevel: 'high' threatLevel: 'high'
}); });
const mockIo = { emitToDashboard: sinon.stub(), emitToDevice: sinon.stub() }; const mockIo = {
emitToDashboard: sinon.stub(),
emitToDevice: sinon.stub(),
to: (room) => ({ emit: sinon.stub() })
};
// Simulate clearing old alerts // Simulate clearing old alerts
await alertService.clearExpiredAlerts(mockIo); await alertService.clearExpiredAlerts(mockIo);