mirror of
https://gitlab.com/mobicoop/v3/service/auth.git
synced 2026-01-11 08:12:41 +00:00
improve tests
This commit is contained in:
22
src/utils/tests/unit/rpc-validation-pipe.usecase.spec.ts
Normal file
22
src/utils/tests/unit/rpc-validation-pipe.usecase.spec.ts
Normal 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');
|
||||
});
|
||||
});
|
||||
});
|
||||
Reference in New Issue
Block a user