@@ -5,13 +5,12 @@ import chaiAsPromised from 'chai-as-promised';
55import pino from 'pino' ;
66import sinon from 'sinon' ;
77
8- import { RPC_PARAM_VALIDATION_RULES_KEY } from '../../../src/lib/decorators' ;
98import { RpcMethodDispatcher } from '../../../src/lib/dispatcher/rpcMethodDispatcher' ;
109import { JsonRpcError , predefined } from '../../../src/lib/errors/JsonRpcError' ;
1110import { MirrorNodeClientError } from '../../../src/lib/errors/MirrorNodeClientError' ;
1211import { SDKClientError } from '../../../src/lib/errors/SDKClientError' ;
1312import { RequestDetails , RpcMethodRegistry } from '../../../src/lib/types' ;
14- import { Validator } from '../../../src/lib/validators' ;
13+ import * as Validator from '../../../src/lib/validators' ;
1514import { Utils } from '../../../src/utils' ;
1615
1716chai . use ( chaiAsPromised ) ;
@@ -118,7 +117,7 @@ describe('RpcMethodDispatcher', () => {
118117 it ( 'should validate parameters when schema exists' , ( ) => {
119118 // Set up validation schema
120119 const validationRules = { 0 : { type : 'string' , required : true } } ;
121- operationHandler [ RPC_PARAM_VALIDATION_RULES_KEY ] = validationRules ;
120+ operationHandler [ Validator . RPC_PARAM_VALIDATION_RULES_KEY ] = validationRules ;
122121
123122 ( dispatcher as any ) . precheckRpcMethod ( TEST_METHOD_NAME , TEST_PARAMS , TEST_REQUEST_DETAILS ) ;
124123
@@ -128,7 +127,7 @@ describe('RpcMethodDispatcher', () => {
128127
129128 it ( 'should skip validation when no schema exists' , ( ) => {
130129 // Ensure there's no validation schema
131- delete operationHandler [ RPC_PARAM_VALIDATION_RULES_KEY ] ;
130+ delete operationHandler [ Validator . RPC_PARAM_VALIDATION_RULES_KEY ] ;
132131
133132 ( dispatcher as any ) . precheckRpcMethod ( TEST_METHOD_NAME , TEST_PARAMS , TEST_REQUEST_DETAILS ) ;
134133
@@ -404,7 +403,7 @@ describe('RpcMethodDispatcher', () => {
404403 // Test with schema
405404 validateParamsStub . reset ( ) ;
406405 const validationRules = { 0 : { type : 'string' , required : true } } ;
407- operationHandler [ RPC_PARAM_VALIDATION_RULES_KEY ] = validationRules ;
406+ operationHandler [ Validator . RPC_PARAM_VALIDATION_RULES_KEY ] = validationRules ;
408407
409408 result = await dispatcher . dispatch ( TEST_METHOD_NAME , TEST_PARAMS , TEST_REQUEST_DETAILS ) ;
410409 expect ( result ) . to . equal ( TEST_RESULT ) ;
@@ -432,15 +431,15 @@ describe('RpcMethodDispatcher', () => {
432431 // Validation error
433432 validateParamsStub . throws ( predefined . INVALID_PARAMETERS ) ;
434433 const validationRules = { 0 : { type : 'string' , required : true } } ;
435- operationHandler [ RPC_PARAM_VALIDATION_RULES_KEY ] = validationRules ;
434+ operationHandler [ Validator . RPC_PARAM_VALIDATION_RULES_KEY ] = validationRules ;
436435
437436 let result = await dispatcher . dispatch ( TEST_METHOD_NAME , TEST_PARAMS , TEST_REQUEST_DETAILS ) ;
438437 expect ( result ) . to . be . instanceOf ( JsonRpcError ) ;
439438 expect ( result . code ) . to . equal ( predefined . INVALID_PARAMETERS . code ) ;
440439
441440 // Execution error
442441 validateParamsStub . reset ( ) ;
443- delete operationHandler [ RPC_PARAM_VALIDATION_RULES_KEY ] ;
442+ delete operationHandler [ Validator . RPC_PARAM_VALIDATION_RULES_KEY ] ;
444443 operationHandler . rejects ( new Error ( 'Execution failed' ) ) ;
445444
446445 result = await dispatcher . dispatch ( TEST_METHOD_NAME , TEST_PARAMS , TEST_REQUEST_DETAILS ) ;
0 commit comments