remove unused code

This commit is contained in:
sbriat 2023-07-13 10:29:18 +02:00
parent d099a4e42a
commit de8db8b648
2 changed files with 0 additions and 36 deletions

View File

@ -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),
});
};
}
}

View File

@ -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(<ValidateAuthenticationRequestDto>{}, metadata)
.catch((err) => {
expect(err.message).toEqual('Rpc Exception');
});
});
});