Skip to content

Commit

Permalink
first test where we also test that we charge the correct amount
Browse files Browse the repository at this point in the history
  • Loading branch information
girazoki committed Jan 10, 2024
1 parent c0463bc commit b63647f
Showing 1 changed file with 12 additions and 3 deletions.
15 changes: 12 additions & 3 deletions runtime/dancebox/tests/common/xcm/token_derivative_reception.rs
Original file line number Diff line number Diff line change
Expand Up @@ -99,24 +99,33 @@ fn receive_tokens_from_the_relay_to_tanssi() {
// We should have received the tokens
Dancebox::execute_with(|| {
type RuntimeEvent = <Dancebox as Chain>::RuntimeEvent;
let mut outcome_weight = Weight::default();
assert_expected_events!(
Dancebox,
vec![
RuntimeEvent::DmpQueue(
cumulus_pallet_dmp_queue::Event::ExecutedDownward {
outcome, ..
}) => {
outcome: outcome.clone().ensure_complete().is_ok(),
outcome: {
outcome_weight = outcome.clone().weight_used();
outcome.clone().ensure_complete().is_ok()
},
},
]
);
type ForeignAssets = <Dancebox as DanceboxPallet>::ForeignAssets;

// We should have charged an amount of tokens that is identical to the weight spent
let native_balance = dancebox_runtime::WeightToFee::weight_to_fee(&outcome_weight);

// Assert empty receiver received funds
assert!(
assert_eq!(
<ForeignAssets as frame_support::traits::fungibles::Inspect<_>>::balance(
1,
&DanceboxReceiver::get(),
) > 0
),
amount_to_send - native_balance
);
});
}

0 comments on commit b63647f

Please sign in to comment.