21 lines
726 B
TypeScript
21 lines
726 B
TypeScript
import { ArgumentMetadata } from '@nestjs/common';
|
|
import { RpcValidationPipe } from '../../pipes/rpc.validation-pipe';
|
|
import { FindAdByIdRequestDto } from '../../../modules/ad/interface/grpc-controllers/dtos/find-ad-by-id.request.dto';
|
|
|
|
describe('RpcValidationPipe', () => {
|
|
it('should not validate request', async () => {
|
|
const target: RpcValidationPipe = new RpcValidationPipe({
|
|
whitelist: true,
|
|
forbidUnknownValues: false,
|
|
});
|
|
const metadata: ArgumentMetadata = {
|
|
type: 'body',
|
|
metatype: FindAdByIdRequestDto,
|
|
data: '',
|
|
};
|
|
await target.transform(<FindAdByIdRequestDto>{}, metadata).catch((err) => {
|
|
expect(err.message).toEqual('Rpc Exception');
|
|
});
|
|
});
|
|
});
|