Skip to content

Commit

Permalink
Add manual wallet sanity test
Browse files Browse the repository at this point in the history
  • Loading branch information
mvines committed Jul 2, 2018
1 parent 9f57fdf commit bdad8fc
Showing 1 changed file with 35 additions and 0 deletions.
35 changes: 35 additions & 0 deletions multinode-demo/test/wallet-sanity.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
#!/bin/bash -e
#
# Wallet sanity test
#

here=$(dirname "$0")
cd "$here"

wallet="../wallet.sh $1"

# Tokens transferred to this address are lost forever...
garbage_address=vS3ngn1TfQmpsW1Z4NkLuqNAQFF3dYQw8UZ6TCx9bmq

check_balance_output() {
declare expected_output="$1"
exec 42>&1
output=$($wallet balance | tee >(cat - >&42))
if [[ ! "$output" =~ $expected_output ]]; then
echo "Balance is incorrect. Expected: $expected_output"
exit 1
fi
}

# Ensure a fresh client configuration every time
rm -rf config-client

$wallet address
check_balance_output "No account found! Request an airdrop to get started"
$wallet airdrop --tokens 100
check_balance_output "Your balance is: 100"
$wallet pay --to $garbage_address --tokens 100
check_balance_output "Your balance is: 0"

echo PASS
exit 0

0 comments on commit bdad8fc

Please sign in to comment.