Skip to content
This repository was archived by the owner on Mar 11, 2025. It is now read-only.

Commit f390e12

Browse files
authored
Allow for fixed error mappings (#1541)
1 parent 936ecef commit f390e12

File tree

1 file changed

+19
-24
lines changed

1 file changed

+19
-24
lines changed

stake-pool/program/tests/initialize.rs

Lines changed: 19 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -545,18 +545,15 @@ async fn test_initialize_stake_pool_with_not_rent_exempt_pool() {
545545
],
546546
recent_blockhash,
547547
);
548-
assert_eq!(
549-
banks_client
550-
.process_transaction(transaction)
551-
.await
552-
.unwrap_err()
553-
.unwrap(),
554-
TransactionError::InstructionError(
555-
2,
556-
InstructionError::InvalidError,
557-
// should be InstructionError::AccountNotRentExempt, but the mapping
558-
// is wrong
559-
)
548+
let result = banks_client
549+
.process_transaction(transaction)
550+
.await
551+
.unwrap_err()
552+
.unwrap();
553+
assert!(
554+
result == TransactionError::InstructionError(2, InstructionError::InvalidError,)
555+
|| result
556+
== TransactionError::InstructionError(2, InstructionError::AccountNotRentExempt,)
560557
);
561558
}
562559

@@ -621,18 +618,16 @@ async fn test_initialize_stake_pool_with_not_rent_exempt_validator_list() {
621618
recent_blockhash,
622619
);
623620

624-
assert_eq!(
625-
banks_client
626-
.process_transaction(transaction)
627-
.await
628-
.unwrap_err()
629-
.unwrap(),
630-
TransactionError::InstructionError(
631-
2,
632-
InstructionError::InvalidError,
633-
// should be InstructionError::AccountNotRentExempt, but the mapping
634-
// is wrong
635-
)
621+
let result = banks_client
622+
.process_transaction(transaction)
623+
.await
624+
.unwrap_err()
625+
.unwrap();
626+
627+
assert!(
628+
result == TransactionError::InstructionError(2, InstructionError::InvalidError,)
629+
|| result
630+
== TransactionError::InstructionError(2, InstructionError::AccountNotRentExempt,)
636631
);
637632
}
638633

0 commit comments

Comments
 (0)