Skip to content

Commit

Permalink
fix: tests
Browse files Browse the repository at this point in the history
  • Loading branch information
rachit77 committed Sep 17, 2024
1 parent bc4a1a4 commit 99e2c4c
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
2 changes: 1 addition & 1 deletion test/basic-e2e.bats
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ setup() {
# Trx will fail pre validation check on the node and will be dropped subsequently from the pool
# without recording it on the chain and hence nonce will not change
local sender_balance=$(rpcQuery "balance" "--ether" "$senderAddr") || return 1
local excessive_value=$(echo "$sender_balance + 1" | bc)ether
local excessive_value="$(echo "$sender_balance + 1" | bc)ether"
run sendTx "$private_key" "$receiver" "$excessive_value"
assert_failure

Expand Down
6 changes: 4 additions & 2 deletions test/helpers/common.bash
Original file line number Diff line number Diff line change
Expand Up @@ -149,6 +149,8 @@ function sendTx() {
return 1
fi

sleep 7

checkTransactionSuccess "$senderAddr" "$receiver" "$value_or_function_sig" "$tx_hash" "$sender_initial_balance" "$receiver_initial_balance"
if [[ $? -ne 0 ]]; then
echo "Error: Balance not updated correctly."
Expand Down Expand Up @@ -246,9 +248,9 @@ function checkTransactionSuccess() {
echo "Receiver balance changed by: `$receiver_balance_change` wei"

value_in_wei=$(cast --to-unit wei "$value_or_function_sig")
assert_equal "$receiver_balance_chang" "$value_in_wei" "Error: receiver balance updated incorrectly."
assert_equal "$receiver_balance_chang" "$value_in_wei" "Error receiver balance updated incorrectly"
fi

# Asserts sender's balance change is equal to the value transferred plus the gas fee
assert_equal "$sender_balance_change" "$(echo "$value_in_wei + $gas_fee" | bc)" "Error: sender balance updated incorrectly."
assert_equal "$sender_balance_change" "$(echo "$value_in_wei + $gas_fee" | bc)" "Error sender balance updated incorrectly"
}

0 comments on commit 99e2c4c

Please sign in to comment.