cudoventures / cudos-node

CUDOS blockchain node
GNU General Public License v3.0
29 stars 20 forks source link

test: add unit test for admin and cudoMint modules #118

Closed tuantran1702 closed 9 months ago

tuantran1702 commented 9 months ago

Test Descriptions

Test for admin module

KeeperTest

Scenario Withdrawal Amount Initial Fee Pool Balance Expected Remaining Fee Pool Balance Error?
Sufficient funds 30 40 10 false
Insufficient funds 50 40 40 true
Full withdrawal 40 40 0 false
Zero withdrawal 0 40 40 false
Withdraw nothing from empty fee pool 0 0 0 false
Withdraw any amount from empty fee pool 10 0 0 true

MsgServerTest

Name Sender Withdraw Amount CP Balance Expected Remaining CP Balance Expected Error
Available community pool: 40, withdraw: 30 Admin 30 40 10 false
Available community pool: 40, withdraw: 50 Admin 50 40 40 true
Available community pool: 40, withdraw: 40 Admin 40 40 0 false
Available community pool: 40, withdraw: 0 Admin 0 40 40 false
Available community pool: 0, withdraw: 0 Admin 0 0 0 false
Available community pool: 30, withdraw 20, not admin Not Admin 20 30 30 true
Available community pool: 30, withdraw 40, not admin Not Admin 40 30 30 true

MsgTest

Initiator To Address Coins Expected Error
Valid address Valid address 123acudos None
Valid address Valid address 123acudos,123eth None
Purposefully long address Valid address 123acudos None
Valid address Purposefully long address 123acudos None
Empty address Valid address 123acudos Invalid sender address (empty address string is not allowed)
Valid address Empty address 123acudos Invalid recipient address (empty address string is not allowed)
Valid address Valid address 0acudos Invalid coins: Amount cannot be zero
Valid address Valid address 123acudos,0eth Invalid coins: 123acudos,0eth (zero amount for ETH)

Test for cudoMint module

KeeperTest

chainID mintCoins feeCollectorAccount expectedBalance
cudos-app 100000acudos, 1000cudosAdmin fee collector account 100000acudos, 1000cudosAdmin
cudos-app no coins fee collector account 0acudos, 0cudosAdmin