loaders unit tests

This commit is contained in:
Hardhat Chad
2024-03-24 20:51:47 +00:00
parent 0836c40f89
commit 0aeb60edb9
3 changed files with 983 additions and 128 deletions

View File

@@ -105,6 +105,23 @@ async fn test_reset() {
assert_eq!(treasury_tokens.close_authority, COption::None);
}
#[tokio::test]
async fn test_reset_bad_key() {
// Setup
let (mut banks, payer, _, blockhash) = setup_program_test_env(ClockState::Normal).await;
// Bad addresses
let bad_pda = Pubkey::find_program_address(&[b"t"], &ore::id());
for i in 1..13 {
let mut ix = ore::instruction::reset(payer.pubkey());
ix.accounts[i].pubkey = bad_pda.0;
let tx =
Transaction::new_signed_with_payer(&[ix], Some(&payer.pubkey()), &[&payer], blockhash);
let res = banks.process_transaction(tx).await;
assert!(res.is_err());
}
}
#[tokio::test]
async fn test_reset_busses_out_of_order_fail() {
// Setup