Fix jwt-token
This commit is contained in:
@@ -3,8 +3,23 @@ const { expect } = require('chai');
|
|||||||
const { getDroneTypeInfo, getDroneTypeName, isValidDroneType } = require('../../utils/droneTypes');
|
const { getDroneTypeInfo, getDroneTypeName, isValidDroneType } = require('../../utils/droneTypes');
|
||||||
|
|
||||||
describe('DroneTypes Utility', () => {
|
describe('DroneTypes Utility', () => {
|
||||||
describe('getDroneTypeInfo', () => {
|
describe('getDroneTypeInfo', () => it('should handle boolean inputs', () => {
|
||||||
it('should return correct info for Orlan drone (type 2)', () => {
|
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);
|
const info = getDroneTypeInfo(2);
|
||||||
|
|
||||||
expect(info).to.exist;
|
expect(info).to.exist;
|
||||||
@@ -283,7 +298,7 @@ describe('DroneTypes Utility', () => {
|
|||||||
describe('Edge Cases and Error Handling', () => {
|
describe('Edge Cases and Error Handling', () => {
|
||||||
it('should handle floating point numbers', () => {
|
it('should handle floating point numbers', () => {
|
||||||
const info = getDroneTypeInfo(2.5);
|
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', () => {
|
it('should handle negative numbers', () => {
|
||||||
|
|||||||
Reference in New Issue
Block a user