adding frequncy mapping ignore customvalidator decorator declaration for coverage
This commit is contained in:
parent
ade5508713
commit
10f4d1a0dc
|
@ -13,6 +13,7 @@ export function hasProperPositionIndexes(value: AddressRequestDTO[]) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* istanbul ignore next */
|
||||||
export function HasProperPositionIndexes(
|
export function HasProperPositionIndexes(
|
||||||
validationOptions?: ValidationOptions,
|
validationOptions?: ValidationOptions,
|
||||||
): PropertyDecorator {
|
): PropertyDecorator {
|
||||||
|
@ -23,6 +24,7 @@ export function HasProperPositionIndexes(
|
||||||
validator: {
|
validator: {
|
||||||
validate: (value: AddressRequestDTO[]): boolean =>
|
validate: (value: AddressRequestDTO[]): boolean =>
|
||||||
hasProperPositionIndexes(value),
|
hasProperPositionIndexes(value),
|
||||||
|
|
||||||
defaultMessage: buildMessage(
|
defaultMessage: buildMessage(
|
||||||
() =>
|
() =>
|
||||||
`indexes position incorrect, please provide a complete list of indexes or ordened list of adresses from start to end of journey`,
|
`indexes position incorrect, please provide a complete list of indexes or ordened list of adresses from start to end of journey`,
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
import { Frequency } from '../../types/frequency.enum';
|
import { Frequency } from '../../types/frequency.enum';
|
||||||
export const mappingKeyToFrequency = (index: number): string => {
|
export const mappingKeyToFrequency = (index: number): string => {
|
||||||
|
console.log(Frequency[index - 1]);
|
||||||
return Frequency[index - 1];
|
return Frequency[index - 1];
|
||||||
};
|
};
|
||||||
|
|
|
@ -18,7 +18,7 @@ export function hasProperDriverSeats(value: any, args: ValidationArguments) {
|
||||||
return true;
|
return true;
|
||||||
else return false;
|
else return false;
|
||||||
}
|
}
|
||||||
|
/* istanbul ignore next */
|
||||||
export function HasProperDriverSeats(
|
export function HasProperDriverSeats(
|
||||||
validationOptions?: ValidationOptions,
|
validationOptions?: ValidationOptions,
|
||||||
): PropertyDecorator {
|
): PropertyDecorator {
|
||||||
|
|
|
@ -18,7 +18,7 @@ export function hasProperPassengerSeats(value: any, args: ValidationArguments) {
|
||||||
return true;
|
return true;
|
||||||
else return false;
|
else return false;
|
||||||
}
|
}
|
||||||
|
/* istanbul ignore next */
|
||||||
export function HasProperPassengerSeats(
|
export function HasProperPassengerSeats(
|
||||||
validationOptions?: ValidationOptions,
|
validationOptions?: ValidationOptions,
|
||||||
): PropertyDecorator {
|
): PropertyDecorator {
|
||||||
|
|
|
@ -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();
|
||||||
|
});
|
||||||
|
});
|
Loading…
Reference in New Issue