Fix jwt-token
This commit is contained in:
@@ -345,8 +345,8 @@ describe('Models', () => {
|
||||
drone_id: 1001
|
||||
});
|
||||
|
||||
expect(detection.server_timestamp).to.exist;
|
||||
expect(detection.server_timestamp).to.be.a('date');
|
||||
expect(detection.created_at).to.exist;
|
||||
expect(detection.created_at).to.be.a('date');
|
||||
});
|
||||
|
||||
it('should validate coordinate ranges', async () => {
|
||||
@@ -408,9 +408,9 @@ describe('Models', () => {
|
||||
const ruleData = {
|
||||
tenant_id: tenant.id,
|
||||
name: 'Test Rule',
|
||||
drone_type: 2,
|
||||
min_rssi: -70,
|
||||
max_distance: 1000,
|
||||
priority: 'high',
|
||||
min_detections: 2,
|
||||
time_window: 300,
|
||||
is_active: true
|
||||
};
|
||||
|
||||
@@ -418,8 +418,8 @@ describe('Models', () => {
|
||||
|
||||
expect(rule.id).to.exist;
|
||||
expect(rule.name).to.equal('Test Rule');
|
||||
expect(rule.drone_type).to.equal(2);
|
||||
expect(rule.min_rssi).to.equal(-70);
|
||||
expect(rule.priority).to.equal('high');
|
||||
expect(rule.min_detections).to.equal(2);
|
||||
});
|
||||
|
||||
it('should have default values', async () => {
|
||||
@@ -429,12 +429,6 @@ describe('Models', () => {
|
||||
name: 'Test Rule'
|
||||
});
|
||||
|
||||
console.log('DEBUG AlertRule defaults:', {
|
||||
is_active: rule.is_active,
|
||||
priority: rule.priority,
|
||||
allFields: Object.keys(rule.dataValues)
|
||||
});
|
||||
|
||||
expect(rule.is_active).to.be.true;
|
||||
expect(rule.priority).to.equal('medium');
|
||||
});
|
||||
@@ -481,19 +475,17 @@ describe('Models', () => {
|
||||
|
||||
const logData = {
|
||||
device_id: device.id,
|
||||
rule_name: 'Test Alert',
|
||||
threat_level: 'high',
|
||||
alert_type: 'email',
|
||||
recipient: 'test@example.com',
|
||||
message: 'Test alert message',
|
||||
drone_type: 2,
|
||||
rssi: -50,
|
||||
drone_id: 1001
|
||||
status: 'pending'
|
||||
};
|
||||
|
||||
const alertLog = await models.AlertLog.create(logData);
|
||||
|
||||
expect(alertLog.id).to.exist;
|
||||
expect(alertLog.rule_name).to.equal('Test Alert');
|
||||
expect(alertLog.threat_level).to.equal('high');
|
||||
expect(alertLog.alert_type).to.equal('email');
|
||||
expect(alertLog.recipient).to.equal('test@example.com');
|
||||
expect(alertLog.message).to.equal('Test alert message');
|
||||
});
|
||||
|
||||
@@ -507,13 +499,12 @@ describe('Models', () => {
|
||||
|
||||
const alertLog = await models.AlertLog.create({
|
||||
device_id: device.id,
|
||||
rule_name: 'Test Alert',
|
||||
threat_level: 'high',
|
||||
alert_type: 'email',
|
||||
message: 'Test alert message'
|
||||
});
|
||||
|
||||
expect(alertLog.timestamp).to.exist;
|
||||
expect(alertLog.timestamp).to.be.a('date');
|
||||
expect(alertLog.created_at).to.exist;
|
||||
expect(alertLog.created_at).to.be.a('date');
|
||||
});
|
||||
|
||||
it('should validate threat level values', async () => {
|
||||
|
||||
Reference in New Issue
Block a user