mirror of
https://github.com/colinear-labs/chain.git
synced 2026-03-04 20:34:26 -08:00
updated tests for unlocking & locked-fund queries
This commit is contained in:
1
Makefile
1
Makefile
@@ -3,6 +3,7 @@ SHELL = /bin/bash
|
||||
.PHONY: test
|
||||
|
||||
test:
|
||||
./tests/test_locking_funds.sh
|
||||
./tests/test_auction_flow.sh
|
||||
|
||||
utest:
|
||||
|
||||
@@ -1,11 +1,13 @@
|
||||
#!/bin/bash
|
||||
|
||||
# Tests the core auction flow
|
||||
|
||||
# import utilities
|
||||
HERE=$(cd $(dirname $BASH_SOURCE) && pwd)
|
||||
source $HERE/testutil.sh
|
||||
|
||||
colineard tx colinearcore lock-funds 400000000 -y --from alice \
|
||||
| expect_fail "Can't lock any amount below the minimum required (400 CLR)"
|
||||
colineard tx colinearcore unlock-all-funds -y --from alice \
|
||||
| swallow "Unlock all funds before proceeding"
|
||||
|
||||
colineard tx colinearcore new-auction asdf asdf 200 uusdc $(now + 3500) \
|
||||
-y --from bob \
|
||||
@@ -30,6 +32,9 @@ colineard tx colinearcore new-bid $(get_last_auction_index) 100 \
|
||||
colineard tx colinearcore lock-funds 550000000 -y --from alice \
|
||||
| expect_success "Can lock above the maximum (550 CLR)"
|
||||
|
||||
colineard tx colinearcore lock-funds 500000000 -y --from alice \
|
||||
| expect_success "Lock funds before bidding"
|
||||
|
||||
colineard tx colinearcore new-bid $(get_last_auction_index) 100 \
|
||||
-y --from alice \
|
||||
| expect_success "New bid is correctly created"
|
||||
|
||||
41
tests/test_locking_funds.sh
Executable file
41
tests/test_locking_funds.sh
Executable file
@@ -0,0 +1,41 @@
|
||||
#!/bin/bash
|
||||
|
||||
# Tests the behavior of provider CLR locking
|
||||
|
||||
# import utilities
|
||||
HERE=$(cd $(dirname $BASH_SOURCE) && pwd)
|
||||
source $HERE/testutil.sh
|
||||
|
||||
# We swallow this because with a fresh chain state there is nothing
|
||||
# locked to begin with
|
||||
colineard tx colinearcore unlock-all-funds -y --from alice \
|
||||
| swallow "Unlock all funds before proceeding"
|
||||
|
||||
colineard tx colinearcore lock-funds 400000000 -y --from alice \
|
||||
| expect_fail "Can't lock any amount below the minimum required (400 CLR)"
|
||||
|
||||
colineard tx colinearcore lock-funds 500000000 -y --from alice \
|
||||
| expect_success "Can lock at the min amount of CLR required"
|
||||
|
||||
colineard tx colinearcore lock-funds 100000000 -y --from alice \
|
||||
| expect_success "Can lock over the min amount of CLR required"
|
||||
|
||||
before=$(colineard q colinearcore locked-funds $ALICE \
|
||||
| jq -rM ".amount")
|
||||
|
||||
colineard tx colinearcore unlock-funds 150000000 -y --from alice \
|
||||
| expect_success "Unlock 150 CLR"
|
||||
|
||||
colineard q colinearcore locked-funds $ALICE \
|
||||
| jq -rM ".amount" \
|
||||
| expect_change -150000000 $before "New locked balance reflects unlock"
|
||||
|
||||
before=$(colineard q colinearcore locked-funds $ALICE \
|
||||
| jq -rM ".amount")
|
||||
|
||||
colineard tx colinearcore unlock-all-funds -y --from alice \
|
||||
| expect_success "Unlock all remaining funds"
|
||||
|
||||
colineard q colinearcore locked-funds $ALICE \
|
||||
| jq -rM ".amount" \
|
||||
| expect_change -450000000 $before "New locked balance reflects unlock"
|
||||
Reference in New Issue
Block a user