diff --git a/program/tests/processor.rs b/program/tests/processor.rs index 9fca2b8..50ba970 100644 --- a/program/tests/processor.rs +++ b/program/tests/processor.rs @@ -19,27 +19,6 @@ use spl_token::{error::TokenError, instruction::initialize_mint, state::Mint}; type InstructionPack<'a> = (Instruction, Vec<&'a SolanaAccount>); -fn do_process_instruction( - instruction: Instruction, - accounts: Vec<&SolanaAccount>, - checks: &[Check], -) -> InstructionResult { - let accounts = instruction - .accounts - .iter() - .zip(accounts) - .map(|(account_meta, account)| { - ( - account_meta.pubkey, - AccountSharedData::from(account.clone()), - ) - }) - .collect::>(); - - let mollusk = Mollusk::new(&spl_token::id(), "spl_token"); - mollusk.process_and_validate_instruction(&instruction, accounts.as_slice(), checks) -} - fn do_process_instructions( instructions: &[InstructionPack], checks: &[Check], @@ -96,18 +75,22 @@ fn test_initialize_mint() { let rent_sysvar = rent_sysvar(); // mint is not rent exempt - do_process_instruction( - initialize_mint(&program_id, &mint_key, &owner_key, None, 2).unwrap(), - vec![&mint_account, &rent_sysvar], + do_process_instructions( + &[( + initialize_mint(&program_id, &mint_key, &owner_key, None, 2).unwrap(), + vec![&mint_account, &rent_sysvar], + )], &[Check::err(TokenError::NotRentExempt.into())], ); mint_account.lamports = mint_minimum_balance(); // create new mint - do_process_instruction( - initialize_mint(&program_id, &mint_key, &owner_key, None, 2).unwrap(), - vec![&mint_account, &rent_sysvar], + do_process_instructions( + &[( + initialize_mint(&program_id, &mint_key, &owner_key, None, 2).unwrap(), + vec![&mint_account, &rent_sysvar], + )], &[Check::success()], ); @@ -127,9 +110,11 @@ fn test_initialize_mint() { ); // create another mint that can freeze - do_process_instruction( - initialize_mint(&program_id, &mint2_key, &owner_key, Some(&owner_key), 2).unwrap(), - vec![&mint2_account, &rent_sysvar], + do_process_instructions( + &[( + initialize_mint(&program_id, &mint2_key, &owner_key, Some(&owner_key), 2).unwrap(), + vec![&mint2_account, &rent_sysvar], + )], &[ // Account successfully re-initialized. Check::success(),