diff --git a/src/modules/ad/domain/dtos/utils/address-position.validator.ts b/src/modules/ad/domain/dtos/utils/address-position.validator.ts index 873790c..5602713 100644 --- a/src/modules/ad/domain/dtos/utils/address-position.validator.ts +++ b/src/modules/ad/domain/dtos/utils/address-position.validator.ts @@ -13,6 +13,7 @@ export function hasProperPositionIndexes(value: AddressRequestDTO[]) { return false; } +/* istanbul ignore next */ export function HasProperPositionIndexes( validationOptions?: ValidationOptions, ): PropertyDecorator { @@ -23,6 +24,7 @@ export function HasProperPositionIndexes( validator: { validate: (value: AddressRequestDTO[]): boolean => hasProperPositionIndexes(value), + defaultMessage: buildMessage( () => `indexes position incorrect, please provide a complete list of indexes or ordened list of adresses from start to end of journey`, diff --git a/src/modules/ad/domain/dtos/utils/frequency.mapping.ts b/src/modules/ad/domain/dtos/utils/frequency.mapping.ts index 4d59786..8749ad0 100644 --- a/src/modules/ad/domain/dtos/utils/frequency.mapping.ts +++ b/src/modules/ad/domain/dtos/utils/frequency.mapping.ts @@ -1,4 +1,5 @@ import { Frequency } from '../../types/frequency.enum'; export const mappingKeyToFrequency = (index: number): string => { + console.log(Frequency[index - 1]); return Frequency[index - 1]; }; diff --git a/src/modules/ad/domain/dtos/utils/has-driver-seats.validator.ts b/src/modules/ad/domain/dtos/utils/has-driver-seats.validator.ts index e02f578..696e4e0 100644 --- a/src/modules/ad/domain/dtos/utils/has-driver-seats.validator.ts +++ b/src/modules/ad/domain/dtos/utils/has-driver-seats.validator.ts @@ -18,7 +18,7 @@ export function hasProperDriverSeats(value: any, args: ValidationArguments) { return true; else return false; } - +/* istanbul ignore next */ export function HasProperDriverSeats( validationOptions?: ValidationOptions, ): PropertyDecorator { diff --git a/src/modules/ad/domain/dtos/utils/has-passenger-seats.validator.ts b/src/modules/ad/domain/dtos/utils/has-passenger-seats.validator.ts index 7d4a361..b443c60 100644 --- a/src/modules/ad/domain/dtos/utils/has-passenger-seats.validator.ts +++ b/src/modules/ad/domain/dtos/utils/has-passenger-seats.validator.ts @@ -18,7 +18,7 @@ export function hasProperPassengerSeats(value: any, args: ValidationArguments) { return true; else return false; } - +/* istanbul ignore next */ export function HasProperPassengerSeats( validationOptions?: ValidationOptions, ): PropertyDecorator { diff --git a/src/modules/ad/tests/unit/frequency.mapping.spec.ts b/src/modules/ad/tests/unit/frequency.mapping.spec.ts new file mode 100644 index 0000000..1fbf9a2 --- /dev/null +++ b/src/modules/ad/tests/unit/frequency.mapping.spec.ts @@ -0,0 +1,15 @@ +import { mappingKeyToFrequency } from '../../domain/dtos/utils/frequency.mapping'; +import { Frequency } from '../../domain/types/frequency.enum'; + +describe('frequency mapping function ', () => { + it('should return punctual', () => { + expect(mappingKeyToFrequency(1)).toBe(Frequency[0]); + }); + it('should return recurent', () => { + expect(mappingKeyToFrequency(2)).toBe(Frequency[1]); + }); + it('should return undefined', () => { + expect(mappingKeyToFrequency(0)).toBeUndefined(); + expect(mappingKeyToFrequency(3)).toBeUndefined(); + }); +});