Skip to content

Commit

Permalink
fix: test case
Browse files Browse the repository at this point in the history
  • Loading branch information
nakul1010 committed Dec 13, 2023
1 parent e03b3df commit bb9960e
Showing 1 changed file with 8 additions and 7 deletions.
15 changes: 8 additions & 7 deletions crates/vault-registry/src/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -994,8 +994,9 @@ mod get_vaults_below_premium_collaterlization_tests {
super::run_test(|| {
VaultRegistry::_set_secure_collateral_threshold(DEFAULT_CURRENCY_PAIR, FixedU128::from_float(0.001));
VaultRegistry::_set_premium_redeem_threshold(DEFAULT_CURRENCY_PAIR, FixedU128::one());
ext::fee::premium_redeem_reward_rate::<Test>.mock_safe(move || MockResult::Return(1.into()));
ext::oracle::get_price::<Test>.mock_safe(move |_| MockResult::Return(Ok(1.into())));
ext::fee::premium_redeem_reward_rate::<Test>
.mock_safe(move || MockResult::Return(FixedU128::from_float(0.05)));
ext::oracle::get_price::<Test>.mock_safe(move |_| MockResult::Return(Ok(3.into())));
ext::fee::get_redeem_fee_value::<Test>.mock_safe(move || MockResult::Return(FixedU128::from_float(0.005)));

test()
Expand All @@ -1020,7 +1021,7 @@ mod get_vaults_below_premium_collaterlization_tests {
add_vault(vault_id(4), 50, 100);

assert_err!(
VaultRegistry::get_premium_redeem_vaults(0_u32),
VaultRegistry::get_premium_redeem_vaults(10_u32),
TestError::NoVaultUnderThePremiumRedeemThreshold
);
})
Expand All @@ -1045,8 +1046,8 @@ mod get_vaults_below_premium_collaterlization_tests {
VaultRegistry::_set_secure_collateral_threshold(DEFAULT_CURRENCY_PAIR, secure);

assert_eq!(
VaultRegistry::get_premium_redeem_vaults(0_u32),
Ok(vec![(id2, wrapped(52)), (id1, wrapped(51))])
VaultRegistry::get_premium_redeem_vaults(10_u32),
Ok(vec![(id1, wrapped(issue_tokens1)), (id2, wrapped(issue_tokens2))])
);
})
}
Expand Down Expand Up @@ -1079,8 +1080,8 @@ mod get_vaults_below_premium_collaterlization_tests {
VaultRegistry::_set_secure_collateral_threshold(DEFAULT_CURRENCY_PAIR, secure);

assert_eq!(
VaultRegistry::get_premium_redeem_vaults(0_u32),
Ok(vec!((id2, wrapped(51))))
VaultRegistry::get_premium_redeem_vaults(10_u32),
Ok(vec!((id2, wrapped(issue_tokens2))))
);
})
}
Expand Down

0 comments on commit bb9960e

Please sign in to comment.