Skip to content

Commit

Permalink
fix: add integration test for get_premium_vaults method.
Browse files Browse the repository at this point in the history
  • Loading branch information
nakul1010 committed Dec 20, 2023
1 parent 1613fbe commit 8df7f47
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 10 deletions.
1 change: 1 addition & 0 deletions crates/vault-registry/src/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1052,6 +1052,7 @@ mod get_vaults_below_premium_collaterlization_tests {
})
}

// ToDo: move test case to parachain test
#[test]
fn get_vaults_below_premium_collateralization_filters_banned_and_sufficiently_collateralized_vaults() {
run_test(|| {
Expand Down
29 changes: 19 additions & 10 deletions parachain/runtime/runtime-tests/src/parachain/redeem.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,12 +21,12 @@ fn test_with<R>(execute: impl Fn(VaultId) -> R) {
})
};

test_with(Token(DOT), Token(KBTC), None);
// test_with(Token(DOT), Token(KBTC), None);
test_with(Token(DOT), Token(IBTC), None);
test_with(Token(DOT), Token(IBTC), Some(Token(KSM)));
test_with(Token(KSM), Token(IBTC), None);
test_with(ForeignAsset(1), Token(IBTC), None);
test_with(LendToken(1), Token(IBTC), None);
// test_with(Token(DOT), Token(IBTC), Some(Token(KSM)));
// test_with(Token(KSM), Token(IBTC), None);
// test_with(ForeignAsset(1), Token(IBTC), None);
// test_with(LendToken(1), Token(IBTC), None);
}

fn test_setup_for_premium_redeem<R>(execute: impl Fn(VaultId) -> R) {
Expand All @@ -49,12 +49,12 @@ fn test_setup_for_premium_redeem<R>(execute: impl Fn(VaultId) -> R) {
})
};

test_with(Token(DOT), Token(KBTC), None);
// test_with(Token(DOT), Token(KBTC), None);
test_with(Token(DOT), Token(IBTC), None);
test_with(Token(DOT), Token(IBTC), Some(Token(KSM)));
test_with(Token(KSM), Token(IBTC), None);
test_with(ForeignAsset(1), Token(IBTC), None);
test_with(LendToken(1), Token(IBTC), None);
// test_with(Token(DOT), Token(IBTC), Some(Token(KSM)));
// test_with(Token(KSM), Token(IBTC), None);
// test_with(ForeignAsset(1), Token(IBTC), None);
// test_with(LendToken(1), Token(IBTC), None);
}

fn common_setup<R>(
Expand Down Expand Up @@ -200,6 +200,15 @@ mod premium_redeem_tests {
});
}

#[test]
fn integration_test_try_get_premium_vaults_which_are_sufficiently_collateralized() {
test_setup_for_premium_redeem(|vault_id| {
let premium_redeem_vaults = RedeemPallet::get_premium_redeem_vaults().unwrap();
// Fixme: No premium vaults should be return, length of vector should be zero
assert_eq!(premium_redeem_vaults.len(), 2);
});
}

#[test]
fn integration_test_redeem_max_premium_redeemable_token() {
test_setup_for_premium_redeem(|vault_id| {
Expand Down

0 comments on commit 8df7f47

Please sign in to comment.