Skip to content

Commit

Permalink
Allow for fixed error mappings (#1541)
Browse files Browse the repository at this point in the history
  • Loading branch information
jackcmay authored Mar 31, 2021
1 parent 936ecef commit f390e12
Showing 1 changed file with 19 additions and 24 deletions.
43 changes: 19 additions & 24 deletions stake-pool/program/tests/initialize.rs
Original file line number Diff line number Diff line change
Expand Up @@ -545,18 +545,15 @@ async fn test_initialize_stake_pool_with_not_rent_exempt_pool() {
],
recent_blockhash,
);
assert_eq!(
banks_client
.process_transaction(transaction)
.await
.unwrap_err()
.unwrap(),
TransactionError::InstructionError(
2,
InstructionError::InvalidError,
// should be InstructionError::AccountNotRentExempt, but the mapping
// is wrong
)
let result = banks_client
.process_transaction(transaction)
.await
.unwrap_err()
.unwrap();
assert!(
result == TransactionError::InstructionError(2, InstructionError::InvalidError,)
|| result
== TransactionError::InstructionError(2, InstructionError::AccountNotRentExempt,)
);
}

Expand Down Expand Up @@ -621,18 +618,16 @@ async fn test_initialize_stake_pool_with_not_rent_exempt_validator_list() {
recent_blockhash,
);

assert_eq!(
banks_client
.process_transaction(transaction)
.await
.unwrap_err()
.unwrap(),
TransactionError::InstructionError(
2,
InstructionError::InvalidError,
// should be InstructionError::AccountNotRentExempt, but the mapping
// is wrong
)
let result = banks_client
.process_transaction(transaction)
.await
.unwrap_err()
.unwrap();

assert!(
result == TransactionError::InstructionError(2, InstructionError::InvalidError,)
|| result
== TransactionError::InstructionError(2, InstructionError::AccountNotRentExempt,)
);
}

Expand Down

0 comments on commit f390e12

Please sign in to comment.