more test updates

master
michael 2022-09-04 00:59:37 +00:00
parent 8db387eab7
commit be1c427ba7
2 changed files with 17 additions and 8 deletions

View File

@ -4,7 +4,7 @@
HERE=$(cd $(dirname $BASH_SOURCE) && pwd)
source $HERE/testutil.sh
cosmos-testd tx cosmostest new-auction asdf asdf 500 token 1662155879 \
cosmos-testd tx cosmostest new-auction asdf asdf 500 token $(now + 100) \
-y --from bob \
| expect_success "New auction is created"
@ -12,6 +12,10 @@ cosmos-testd tx cosmostest new-bid $(get_last_auction_index) 100 \
-y --from alice \
| expect_success "New bid is correctly created"
cosmos-testd tx cosmostest new-bid $(get_last_auction_index) 90 \
-y --from alice \
| expect_success "Can bid below price ceiling"
cosmos-testd tx cosmostest new-bid $(get_last_auction_index) 100 \
-y --from alice \
| expect_fail "Can't create duplicate bids"
@ -28,9 +32,13 @@ cosmos-testd tx cosmostest new-bid $(get_last_auction_index) 0 \
-y --from alice \
| expect_fail "Can't bid 0 tokens"
cosmos-testd q cosmostest auction-bids $(get_last_auction_index) \
| jq -M ".bids | length" \
| assert_eq 2 "Number of auction bids"
log_info "Waiting until auction expires..."
sleep 10
cosmos-testd tx cosmostest new-bid $(get_last_auction_index) 100 \
cosmos-testd tx cosmostest new-bid $(get_last_auction_index) 50 \
-y --from alice \
| expect_fail "Can't add bids after auction expiry"

View File

@ -7,13 +7,14 @@ cosmos-testd config output json
# Compares $1 & $2, exiting with $3 (label) if not eq
function assert_eq {
if [[ $1 = $2 ]]; then
log_fail
echo Expected $3 to equal $2, instead got $1.
exit 1
else
read -r out
if [[ $out = $1 ]]; then
log_ok
echo $3 correctly equals $2
echo $2 correctly equals $1
else
log_fail
echo $2 should equal $1, instead got $out.
exit 1
fi
}