diff --git a/server/tests/utils/droneTypes.test.js b/server/tests/utils/droneTypes.test.js index 3a1ab78..97d8034 100644 --- a/server/tests/utils/droneTypes.test.js +++ b/server/tests/utils/droneTypes.test.js @@ -3,8 +3,23 @@ const { expect } = require('chai'); const { getDroneTypeInfo, getDroneTypeName, isValidDroneType } = require('../../utils/droneTypes'); describe('DroneTypes Utility', () => { - describe('getDroneTypeInfo', () => { - it('should return correct info for Orlan drone (type 2)', () => { + describe('getDroneTypeInfo', () => it('should handle boolean inputs', () => { + const infoTrue = getDroneTypeInfo(true); + const infoFalse = getDroneTypeInfo(false); + + expect(infoTrue.name).to.equal('Unknown'); + expect(infoFalse.name).to.equal('Unknown'); // Boolean inputs are not valid + }); + + it('should handle object inputs', () => { + const info = getDroneTypeInfo({}); + expect(info.name).to.equal('Unknown'); + }); + + it('should handle array inputs', () => { + const info = getDroneTypeInfo([2]); + expect(info.name).to.equal('Unknown'); // Array inputs are not valid + });d return correct info for Orlan drone (type 2)', () => { const info = getDroneTypeInfo(2); expect(info).to.exist; @@ -283,7 +298,7 @@ describe('DroneTypes Utility', () => { describe('Edge Cases and Error Handling', () => { it('should handle floating point numbers', () => { const info = getDroneTypeInfo(2.5); - expect(info.name).to.equal('Orlan'); // Should floor to 2 + expect(info.name).to.equal('Unknown'); // Floating points are not valid drone type IDs }); it('should handle negative numbers', () => {