Fix jwt-token

This commit is contained in:
2025-09-15 20:37:43 +02:00
parent d341e12449
commit 37b3fc82a9

View File

@@ -3,12 +3,51 @@ const { expect } = require('chai');
const { getDroneTypeInfo, getDroneTypeName, isValidDroneType } = require('../../utils/droneTypes');
describe('DroneTypes Utility', () => {
describe('getDroneTypeInfo', () => it('should handle boolean inputs', () => {
const infoTrue = getDroneTypeInfo(true);
const infoFalse = getDroneTypeInfo(false);
describe('getDroneTypeInfo', () => {
it('should return correct info for Orlan drone (type 2)', () => {
const info = getDroneTypeInfo(2);
expect(infoTrue.name).to.equal('Unknown');
expect(infoFalse.name).to.equal('Unknown'); // Boolean inputs are not valid
expect(info).to.exist;
expect(info.name).to.equal('Orlan');
expect(info.category).to.include('Military');
expect(info.threat_level).to.equal('critical');
expect(info.description).to.be.a('string');
});
it('should return correct info for Unknown drone (type 1)', () => {
const info = getDroneTypeInfo(1);
expect(info).to.exist;
expect(info.name).to.equal('Unknown');
expect(info.category).to.include('Unknown');
expect(info.threat_level).to.equal('medium');
});
it('should return correct info for DJI drone (type 13)', () => {
const info = getDroneTypeInfo(13);
expect(info).to.exist;
expect(info.name).to.equal('DJI');
expect(info.category).to.include('Commercial');
expect(info.threat_level).to.equal('low');
});
it('should return correct info for FPV CrossFire (type 7)', () => {
const info = getDroneTypeInfo(7);
expect(info).to.exist;
expect(info.name).to.equal('FPV_CrossFire');
expect(info.category).to.include('Racing');
expect(info.threat_level).to.equal('low');
});
it('should return default info for invalid drone type', () => {
const info = getDroneTypeInfo(999);
expect(info).to.exist;
expect(info.name).to.equal('Unknown');
expect(info.category).to.include('Unknown');
expect(info.threat_level).to.equal('medium');
});
it('should handle object inputs', () => {