fix(cucumber): fix claim burn ownership proof validation in cucumber tests#1981
fix(cucumber): fix claim burn ownership proof validation in cucumber tests#1981Stackwyre wants to merge 1 commit intotari-project:developmentfrom
Conversation
|
If you're new to commit signing, there are different ways to set it up: Sign commits with
|
There was a problem hiding this comment.
Code Review
This pull request refactors the wallet daemon integration tests, replacing legacy step definitions with updated implementations that utilize the JSON-RPC client and improved error handling. Feedback focuses on replacing several instances of .unwrap() with proper error propagation using the ? operator to prevent potential panics during test execution, specifically when accessing validator nodes or performing type conversions for amounts.
| .validator_nodes | ||
| .values() | ||
| .next() | ||
| .unwrap() |
There was a problem hiding this comment.
| from_account: from_account.account.address, | ||
| to_account: to_account.account.address, | ||
| max_fee: None, | ||
| amount: Amount::new(amount.try_into().unwrap()), |
There was a problem hiding this comment.
The use of .unwrap() here can cause the test to panic if the u64 amount cannot be converted to an i64. It's safer to propagate the error using the ? operator, as this function already returns a Result.
| amount: Amount::new(amount.try_into().unwrap()), | |
| amount: Amount::new(amount.try_into()?), |
| _ => panic!("Expected gt, gte, lt, lte or eq, got {}", operator), | ||
| let req = AccountsCreateFreeTestCoinsRequest { | ||
| account: None, | ||
| amount: Amount::new(amount.try_into().unwrap()), |
There was a problem hiding this comment.
The use of .unwrap() here can cause the test to panic if the u64 amount cannot be converted to an i64. It's safer to propagate the error using the ? operator, as this function already returns a Result.
| amount: Amount::new(amount.try_into().unwrap()), | |
| amount: Amount::new(amount.try_into()?), |
| .cloned() | ||
| .unwrap_or_default(); | ||
|
|
||
| if balance.balance < Amount::new(amount.try_into().unwrap()) { |
There was a problem hiding this comment.
The use of .unwrap() here can cause the test to panic if the u64 amount cannot be converted to an i64. It's safer to propagate the error using the ? operator, as this function already returns a Result.
| if balance.balance < Amount::new(amount.try_into().unwrap()) { | |
| if balance.balance < Amount::new(amount.try_into()?) { |
| .cloned() | ||
| .unwrap_or_default(); | ||
|
|
||
| if balance.balance != Amount::new(amount.try_into().unwrap()) { |
There was a problem hiding this comment.
The use of .unwrap() here can cause the test to panic if the u64 amount cannot be converted to an i64. It's safer to propagate the error using the ? operator, as this function already returns a Result.
| if balance.balance != Amount::new(amount.try_into().unwrap()) { | |
| if balance.balance != Amount::new(amount.try_into()?) { |
Resolves #1974
Changes
integration_tests/tests/steps/wallet_daemon.rsFixes #1974
Generated by JARVIS AI — reviewed and tested