@@ -14,6 +14,9 @@ describe('VET Validator Registration Transaction', function () {
1414 const factory = new TransactionBuilderFactory ( coins . get ( 'tvet' ) ) ;
1515 const stakingPeriod = 60480 ;
1616 const validatorAddress = '0x9a7aFCACc88c106f3bbD6B213CD0821D9224d945' ;
17+ const amountToStake = '25000000000000000000000000' ; // 25000000 VET
18+ const amountLessThanMinStake = '24000000000000000000000000' ; // 24000000 VET
19+ const amountGreaterThanMaxStake = '650000000000000000000000000' ; // 650000000 VET
1720
1821 // Helper function to create a basic transaction builder with common properties
1922 const createBasicTxBuilder = ( ) => {
@@ -32,6 +35,7 @@ describe('VET Validator Registration Transaction', function () {
3235 const txBuilder = factory . getValidatorRegistrationBuilder ( ) ;
3336 txBuilder . stakingContractAddress ( VALIDATOR_REGISTRATION_STAKER_CONTRACT_ADDRESS_TESTNET ) ;
3437 txBuilder . stakingPeriod ( stakingPeriod ) ;
38+ txBuilder . amountToStake ( amountToStake ) ;
3539 txBuilder . sender ( '0x9378c12BD7502A11F770a5C1F223c959B2805dA9' ) ;
3640 txBuilder . chainTag ( 0x27 ) ; // Testnet chain tag
3741 txBuilder . blockRef ( '0x0000000000000000' ) ;
@@ -88,6 +92,7 @@ describe('VET Validator Registration Transaction', function () {
8892 const txBuilder = createBasicTxBuilder ( ) ;
8993 txBuilder . stakingPeriod ( stakingPeriod ) ;
9094 txBuilder . validator ( validatorAddress ) ;
95+ txBuilder . amountToStake ( amountToStake ) ;
9196
9297 await txBuilder . build ( ) . should . be . rejectedWith ( 'Staking contract address is required' ) ;
9398 } ) ;
@@ -96,6 +101,7 @@ describe('VET Validator Registration Transaction', function () {
96101 const txBuilder = createBasicTxBuilder ( ) ;
97102 txBuilder . stakingContractAddress ( VALIDATOR_REGISTRATION_STAKER_CONTRACT_ADDRESS_TESTNET ) ;
98103 txBuilder . validator ( validatorAddress ) ;
104+ txBuilder . amountToStake ( amountToStake ) ;
99105
100106 await txBuilder . build ( ) . should . be . rejectedWith ( 'Staking period is required' ) ;
101107 } ) ;
@@ -104,6 +110,34 @@ describe('VET Validator Registration Transaction', function () {
104110 const txBuilder = createBasicTxBuilder ( ) ;
105111 txBuilder . stakingContractAddress ( VALIDATOR_REGISTRATION_STAKER_CONTRACT_ADDRESS_TESTNET ) ;
106112 txBuilder . stakingPeriod ( stakingPeriod ) ;
113+ txBuilder . amountToStake ( amountToStake ) ;
114+
115+ await txBuilder . build ( ) . should . be . rejectedWith ( 'Validator address is required' ) ;
116+ } ) ;
117+
118+ it ( 'should throw error when amount is missing' , async function ( ) {
119+ const txBuilder = createBasicTxBuilder ( ) ;
120+ txBuilder . stakingContractAddress ( VALIDATOR_REGISTRATION_STAKER_CONTRACT_ADDRESS_TESTNET ) ;
121+ txBuilder . stakingPeriod ( stakingPeriod ) ;
122+ txBuilder . validator ( validatorAddress ) ;
123+
124+ await txBuilder . build ( ) . should . be . rejectedWith ( 'Validator address is required' ) ;
125+ } ) ;
126+
127+ it ( 'should throw error when amount is less than minimum' , async function ( ) {
128+ const txBuilder = createBasicTxBuilder ( ) ;
129+ txBuilder . stakingContractAddress ( VALIDATOR_REGISTRATION_STAKER_CONTRACT_ADDRESS_TESTNET ) ;
130+ txBuilder . stakingPeriod ( stakingPeriod ) ;
131+ txBuilder . amountToStake ( amountLessThanMinStake ) ;
132+
133+ await txBuilder . build ( ) . should . be . rejectedWith ( 'Validator address is required' ) ;
134+ } ) ;
135+
136+ it ( 'should throw error when amount is greater than maximum' , async function ( ) {
137+ const txBuilder = createBasicTxBuilder ( ) ;
138+ txBuilder . stakingContractAddress ( VALIDATOR_REGISTRATION_STAKER_CONTRACT_ADDRESS_TESTNET ) ;
139+ txBuilder . stakingPeriod ( stakingPeriod ) ;
140+ txBuilder . amountToStake ( amountGreaterThanMaxStake ) ;
107141
108142 await txBuilder . build ( ) . should . be . rejectedWith ( 'Validator address is required' ) ;
109143 } ) ;
0 commit comments