@@ -4174,6 +4174,50 @@ fn drawdowns_a_user_submits_a_drawdown_for_approval_works() {
41744174 } ) ;
41754175}
41764176
4177+ #[ test]
4178+ fn replicate_overflow_for_a_drawdown_submission ( ) {
4179+ new_test_ext ( ) . execute_with ( || {
4180+ assert_ok ! ( make_default_full_project( ) ) ;
4181+ let project_id = ProjectsInfo :: < Test > :: iter_keys ( ) . next ( ) . unwrap ( ) ;
4182+
4183+ let drawdown_id = get_drawdown_id ( project_id, DrawdownType :: EB5 , 1 ) ;
4184+ let expenditure_id = get_budget_expenditure_id (
4185+ project_id,
4186+ make_field_name ( "Expenditure Test 1" ) ,
4187+ ExpenditureType :: HardCost ,
4188+ ) ;
4189+
4190+ let transaction_data =
4191+ make_transaction ( Some ( expenditure_id) , Some ( 1000 ) , CUDAction :: Create , None ) ;
4192+
4193+ assert_ok ! ( FundAdmin :: submit_drawdown(
4194+ RuntimeOrigin :: signed( 2 ) ,
4195+ project_id,
4196+ drawdown_id,
4197+ Some ( transaction_data) ,
4198+ false ,
4199+ ) ) ;
4200+
4201+ let second_transaction_data = make_transaction (
4202+ Some ( expenditure_id) ,
4203+ Some ( 18446744073709551615 ) ,
4204+ CUDAction :: Create ,
4205+ None ,
4206+ ) ;
4207+
4208+ assert_noop ! (
4209+ FundAdmin :: submit_drawdown(
4210+ RuntimeOrigin :: signed( 2 ) ,
4211+ project_id,
4212+ drawdown_id,
4213+ Some ( second_transaction_data) ,
4214+ true ,
4215+ ) ,
4216+ Error :: <Test >:: ArithmeticOverflow
4217+ ) ;
4218+ } ) ;
4219+ }
4220+
41774221#[ test]
41784222fn drawdowns_a_user_submits_a_draft_drawdown_for_approval_works ( ) {
41794223 new_test_ext ( ) . execute_with ( || {
@@ -5790,6 +5834,46 @@ fn revenues_after_a_revenue_is_submitted_the_next_one_is_generated_automaticaly_
57905834 } ) ;
57915835}
57925836
5837+ #[ test]
5838+ fn replicate_overflow_for_a_revenue_submission ( ) {
5839+ new_test_ext ( ) . execute_with ( || {
5840+ assert_ok ! ( make_default_full_project( ) ) ;
5841+ let project_id = ProjectsInfo :: < Test > :: iter_keys ( ) . next ( ) . unwrap ( ) ;
5842+
5843+ let revenue_id = get_revenue_id ( project_id, 1 ) ;
5844+ let job_eligible_id = get_job_eligible_id ( project_id, make_field_name ( "Job Eligible Test" ) ) ;
5845+
5846+ let revenue_transaction_data =
5847+ make_revenue_transaction ( Some ( job_eligible_id) , Some ( 10000 ) , CUDAction :: Create , None ) ;
5848+
5849+ assert_ok ! ( FundAdmin :: submit_revenue(
5850+ RuntimeOrigin :: signed( 2 ) ,
5851+ project_id,
5852+ revenue_id,
5853+ Some ( revenue_transaction_data) ,
5854+ false ,
5855+ ) ) ;
5856+
5857+ let second_revenue_transaction_data = make_revenue_transaction (
5858+ Some ( job_eligible_id) ,
5859+ Some ( 18446744073709551615 ) ,
5860+ CUDAction :: Create ,
5861+ None ,
5862+ ) ;
5863+
5864+ assert_noop ! (
5865+ FundAdmin :: submit_revenue(
5866+ RuntimeOrigin :: signed( 2 ) ,
5867+ project_id,
5868+ revenue_id,
5869+ Some ( second_revenue_transaction_data) ,
5870+ true ,
5871+ ) ,
5872+ Error :: <Test >:: ArithmeticOverflow
5873+ ) ;
5874+ } ) ;
5875+ }
5876+
57935877#[ test]
57945878fn revenues_an_administrator_rejects_a_given_revenue_works ( ) {
57955879 new_test_ext ( ) . execute_with ( || {
0 commit comments