matcher/old/modules/utils/tests/unit/rpc-validation-pipe.usecase...

21 lines
667 B
TypeScript

import { ArgumentMetadata } from '@nestjs/common';
import { RpcValidationPipe } from '../../pipes/rpc.validation-pipe';
import { MatchRequest } from '../../../matcher/domain/dtos/match.request';
describe('RpcValidationPipe', () => {
it('should not validate request', async () => {
const target: RpcValidationPipe = new RpcValidationPipe({
whitelist: true,
forbidUnknownValues: false,
});
const metadata: ArgumentMetadata = {
type: 'body',
metatype: MatchRequest,
data: '',
};
await target.transform(<MatchRequest>{}, metadata).catch((err) => {
expect(err.message).toEqual('Rpc Exception');
});
});
});