From de8db8b6484a3247b622b9a52877f84e413c6956 Mon Sep 17 00:00:00 2001 From: sbriat Date: Thu, 13 Jul 2023 10:29:18 +0200 Subject: [PATCH] remove unused code --- src/utils/pipes/rpc.validation-pipe.ts | 14 ------------ .../unit/rpc-validation-pipe.usecase.spec.ts | 22 ------------------- 2 files changed, 36 deletions(-) delete mode 100644 src/utils/pipes/rpc.validation-pipe.ts delete mode 100644 src/utils/tests/unit/rpc-validation-pipe.usecase.spec.ts diff --git a/src/utils/pipes/rpc.validation-pipe.ts b/src/utils/pipes/rpc.validation-pipe.ts deleted file mode 100644 index f2b8c19..0000000 --- a/src/utils/pipes/rpc.validation-pipe.ts +++ /dev/null @@ -1,14 +0,0 @@ -import { Injectable, ValidationPipe } from '@nestjs/common'; -import { RpcException } from '@nestjs/microservices'; - -@Injectable() -export class RpcValidationPipe extends ValidationPipe { - createExceptionFactory() { - return (validationErrors = []) => { - return new RpcException({ - code: 3, - message: this.flattenValidationErrors(validationErrors), - }); - }; - } -} diff --git a/src/utils/tests/unit/rpc-validation-pipe.usecase.spec.ts b/src/utils/tests/unit/rpc-validation-pipe.usecase.spec.ts deleted file mode 100644 index 510e9c4..0000000 --- a/src/utils/tests/unit/rpc-validation-pipe.usecase.spec.ts +++ /dev/null @@ -1,22 +0,0 @@ -import { ArgumentMetadata } from '@nestjs/common'; -import { RpcValidationPipe } from '../../pipes/rpc.validation-pipe'; -import { ValidateAuthenticationRequestDto } from '@modules/authentication/interface/grpc-controllers/dtos/validate-authentication.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: ValidateAuthenticationRequestDto, - data: '', - }; - await target - .transform({}, metadata) - .catch((err) => { - expect(err.message).toEqual('Rpc Exception'); - }); - }); -});