improve tests

This commit is contained in:
sbriat
2023-01-27 16:34:06 +01:00
parent ee820a2e84
commit d5cf17e734
10 changed files with 320 additions and 70 deletions

View File

@@ -0,0 +1,22 @@
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');
});
});
});