Skip to content

Commit

Permalink
test: view address refund
Browse files Browse the repository at this point in the history
  • Loading branch information
bucurdavid committed May 3, 2024
1 parent 4a902f8 commit ba89526
Showing 1 changed file with 31 additions and 2 deletions.
33 changes: 31 additions & 2 deletions tests/endpoints/proof.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,10 @@ use core_mx_life_bonding_sc::{
storage::{PenaltyType, Refund},
views::ProxyTrait,
};
use multiversx_sc::{codec::multi_types::OptionalValue, types::EsdtTokenPayment};
use multiversx_sc::{
codec::multi_types::OptionalValue,
types::{EsdtTokenPayment, ManagedVec, MultiValueEncoded},
};
use multiversx_sc_scenario::{
managed_address, managed_token_id,
scenario_model::{
Expand Down Expand Up @@ -118,6 +121,19 @@ fn proof_test() {
.world
.set_state_step(SetStateStep::new().block_timestamp(12u64));

let mut multiValue = MultiValueEncoded::new();

multiValue.push(1u64);

state.world.sc_query(
ScQueryStep::new()
.call(state.contract.get_address_refund_for_compensations(
managed_address!(&first_user_address),
multiValue.clone(),
))
.expect_value(ManagedVec::new()),
);

state.world.sc_query(
ScQueryStep::new()
.call(state.contract.get_address_refund_for_compensation(
Expand Down Expand Up @@ -165,6 +181,19 @@ fn proof_test() {
managed_token_id!(DATA_NFT_IDENTIFIER),
1u64,
))
.expect_value(Some(refund)),
.expect_value(Some(refund.clone())),
);

let mut managedVec = ManagedVec::new();

managedVec.push(refund.clone());

state.world.sc_query(
ScQueryStep::new()
.call(state.contract.get_address_refund_for_compensations(
managed_address!(&first_user_address),
multiValue,
))
.expect_value(managedVec),
);
}

0 comments on commit ba89526

Please sign in to comment.