Skip to content

Commit

Permalink
add bridge paused tests for finalize and revert extrinsics
Browse files Browse the repository at this point in the history
  • Loading branch information
kdembler committed Jun 4, 2024
1 parent c9e4269 commit 67b6d36
Showing 1 changed file with 48 additions and 0 deletions.
48 changes: 48 additions & 0 deletions runtime-modules/argo-bridge/src/tests/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -344,6 +344,30 @@ fn finalize_inbound_transfer_with_insufficient_bridge_mint() {
});
}

#[test]
fn finalize_inbound_transfer_with_bridge_paused() {
with_test_externalities(|| {
let remote_chains = BoundedVec::try_from(vec![1u32]).unwrap();
let parameters = BridgeConstraints {
operator_account: Some(account!(1)),
pauser_accounts: Some(vec![account!(2)]),
bridging_fee: None,
thawn_duration: None,
remote_chains: Some(remote_chains),
};
ArgoBridge::update_bridge_constrains(RuntimeOrigin::root(), parameters).unwrap();

let remote_transfer = RemoteTransfer { id: 0, chain_id: 1 };
let result = ArgoBridge::finalize_inbound_transfer(
RuntimeOrigin::signed(account!(1)),
remote_transfer,
account!(2),
1000,
);
assert_err!(result, Error::<Test>::BridgeNotActive);
});
}

#[test]
fn revert_outbound_transfer_success() {
with_test_externalities_custom_mint_allowance(joy!(1000), || {
Expand Down Expand Up @@ -436,6 +460,30 @@ fn revert_outbound_transfer_with_insufficient_bridge_mint() {
});
}

#[test]
fn revert_outbound_transfer_with_bridge_paused() {
with_test_externalities(|| {
let remote_chains = BoundedVec::try_from(vec![1u32]).unwrap();
let parameters = BridgeConstraints {
operator_account: Some(account!(1)),
pauser_accounts: Some(vec![account!(2)]),
bridging_fee: None,
thawn_duration: None,
remote_chains: Some(remote_chains),
};
ArgoBridge::update_bridge_constrains(RuntimeOrigin::root(), parameters).unwrap();

let result = ArgoBridge::revert_outbound_transfer(
RuntimeOrigin::signed(account!(1)),
1u64,
account!(2),
joy!(100),
vec![],
);
assert_err!(result, Error::<Test>::BridgeNotActive);
});
}

#[test]
fn pause_bridge_success() {
with_test_externalities(|| {
Expand Down

0 comments on commit 67b6d36

Please sign in to comment.