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;
|
||||
}
|
||||
|
||||
/* 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`,
|
||||
|
|
|
@ -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];
|
||||
};
|
||||
|
|
|
@ -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 {
|
||||
|
|
|
@ -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 {
|
||||
|
|
|
@ -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