Skip to content

Commit

Permalink
test(pallet-grants): add more tests
Browse files Browse the repository at this point in the history
  • Loading branch information
aliXsed committed Jul 18, 2024
1 parent 8115c7b commit 7046e6c
Showing 1 changed file with 42 additions and 0 deletions.
42 changes: 42 additions & 0 deletions pallets/grants/src/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -511,6 +511,48 @@ fn set_bridge_fails_if_bridge_already_exists() {
});
}

#[test]
fn set_bridge_fails_if_name_too_long() {
ExtBuilder::default().build().execute_with(|| {
let bridge_id = 1;
let bridge_name = b"somereallylonglonglongnnnnnnnnameeee";
let remote_chain_id = 9924;
assert_err!(
Vesting::set_bridge(RuntimeOrigin::root(), bridge_id, bridge_name.into(), remote_chain_id),
Error::<Runtime>::BridgeNameTooLong
);
});
}

#[test]
fn set_bridge_fails_if_non_root() {
ExtBuilder::default().build().execute_with(|| {
let bridge_id = 1;
let bridge_name = b"zklocal";
let remote_chain_id = 9924;
assert_err!(
Vesting::set_bridge(
RuntimeOrigin::signed(ALICE::get()),
bridge_id,
bridge_name.into(),
remote_chain_id
),
BadOrigin
);
});
}

#[test]
fn remove_bridge_fails_if_non_root() {
ExtBuilder::default().build().execute_with(|| {
let bridge_id = 1;
assert_err!(
Vesting::remove_bridge(RuntimeOrigin::signed(ALICE::get()), bridge_id),
BadOrigin
);
});
}

#[test]
fn remove_bridge_works() {
ExtBuilder::default().build().execute_with(|| {
Expand Down

0 comments on commit 7046e6c

Please sign in to comment.