Skip to content

Commit

Permalink
add deploy from source test
Browse files Browse the repository at this point in the history
  • Loading branch information
ovstinga committed Aug 24, 2023
1 parent dbfb714 commit f07f2ae
Showing 1 changed file with 22 additions and 2 deletions.
24 changes: 22 additions & 2 deletions contracts/examples/multisig/tests/multisig_new_blackbox_test.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,10 @@ use multisig::{
ProxyTrait as _,
};
use multiversx_sc::{
codec::{multi_types::MultiValueVec, test_util::top_encode_to_vec_u8_or_panic},
codec::{
multi_types::{MultiValueVec, OptionalValue},
test_util::top_encode_to_vec_u8_or_panic,
},
storage::mappers::{SingleValue, SingleValueMapper},
types::{Address, CodeMetadata},
};
Expand Down Expand Up @@ -393,6 +396,7 @@ fn test_change_quorum() {
}

#[test]
#[ignore = "not yet implemented"]
fn test_transfer_execute_to_user() {
let mut state = MultisigTestState::new();
state.deploy_multisig_contract();
Expand Down Expand Up @@ -485,6 +489,22 @@ fn test_deploy_and_upgrade_from_source() {
));

let new_adder_address = AddressValue::from(NEW_ADDER_ADDRESS_EXPR).to_address();
let adder_address = AddressValue::from(ADDER_ADDRESS_EXPR).to_address();

// state.propose()
let action_id = state.propose(Action::SCDeployFromSource(
0u64,
adder_address.clone(),
CodeMetadata::all(),
MultiValueVec::from([top_encode_to_vec_u8_or_panic(&5u64)]),
));
state.sign(action_id);
state.world.sc_call_use_result(
ScCallStep::new()
.from(BOARD_MEMBER_ADDRESS_EXPR)
.call(state.multisig_contract.perform_action_endpoint(action_id)),
|r| {
let result: OptionalValue<Address> = r.result.unwrap();
assert_eq!(result.into_option().unwrap(), new_adder_address);
},
);
}

0 comments on commit f07f2ae

Please sign in to comment.