From 2b4a6818c0ce0ff424d263e81a1f4e006a5f9edc Mon Sep 17 00:00:00 2001 From: Dorin Marian Iancu Date: Thu, 8 Aug 2024 12:26:39 +0300 Subject: [PATCH] async call sc test --- .../tests/ms_improved_tests.rs | 22 +++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/contracts/multisig-improved/tests/ms_improved_tests.rs b/contracts/multisig-improved/tests/ms_improved_tests.rs index 4f7467fb..4499fb2e 100644 --- a/contracts/multisig-improved/tests/ms_improved_tests.rs +++ b/contracts/multisig-improved/tests/ms_improved_tests.rs @@ -369,6 +369,28 @@ fn transfer_execute_batch_test() { .assert_ok(); } +#[test] +fn async_call_to_sc_test() { + let mut ms_setup = MsImprovedSetup::new(multisig_improved::contract_obj, adder::contract_obj); + + let args = [&[5u8][..]].to_vec(); + let action_id = ms_setup.propose_async_call( + &ms_setup.adder_wrapper.address_ref().clone(), + 0, + b"add", + args, + ); + ms_setup.sign(action_id, 0); + ms_setup.perform(action_id); + + ms_setup + .b_mock + .execute_query(&ms_setup.adder_wrapper, |sc| { + assert_eq!(sc.sum().get(), 5); + }) + .assert_ok(); +} + #[test] fn add_can_execute_module_test() { let mut ms_setup = MsImprovedSetup::new(multisig_improved::contract_obj, adder::contract_obj);