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