diff --git a/zrml/swaps/src/tests.rs b/zrml/swaps/src/tests.rs index ad767a290..37788b790 100644 --- a/zrml/swaps/src/tests.rs +++ b/zrml/swaps/src/tests.rs @@ -1189,6 +1189,28 @@ fn create_pool_fails_on_weight_above_maximum_weight() { }); } +#[test] +fn create_pool_fails_on_total_weight_above_maximum_total_weight() { + ExtBuilder::default().build().execute_with(|| { + ASSETS.iter().cloned().for_each(|asset| { + let _ = Currencies::deposit(asset, &BOB, _100); + }); + let weight = ::MaxTotalWeight::get() / 4 + 100; + assert_noop!( + Swaps::create_pool( + BOB, + ASSETS.iter().cloned().collect(), + Some(ASSETS.last().unwrap().clone()), + 0, + ScoringRule::CPMM, + Some(0), + Some(vec![weight; 4]), + ), + crate::Error::::MaxTotalWeight, + ); + }); +} + fn alice_signed() -> Origin { Origin::signed(ALICE) }