From 37b3fc82a9b653099145470f1413a882ea4bc733 Mon Sep 17 00:00:00 2001 From: Alexander Borg Date: Mon, 15 Sep 2025 20:37:43 +0200 Subject: [PATCH] Fix jwt-token --- server/tests/utils/droneTypes.test.js | 49 ++++++++++++++++++++++++--- 1 file changed, 44 insertions(+), 5 deletions(-) diff --git a/server/tests/utils/droneTypes.test.js b/server/tests/utils/droneTypes.test.js index 97d8034..9467777 100644 --- a/server/tests/utils/droneTypes.test.js +++ b/server/tests/utils/droneTypes.test.js @@ -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', () => {