Created
November 11, 2018 19:04
-
-
Save vitiko/0dcba8b396bf802cb167d737fe1489c8 to your computer and use it in GitHub Desktop.
erc20test.go
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Describe("ERC-20 transfer", func() { | |
It("Disallow to transfer token to same account", func() { | |
expectcc.ResponseError( | |
erc20fs.From(actors[`token_owner`]).Invoke( | |
`transfer`, actors[`token_owner`].GetMSPID(), actors[`token_owner`].GetID(), 100), | |
ErrForbiddenToTransferToSameAccount) | |
}) | |
It("Disallow token holder with zero balance to transfer tokens", func() { | |
expectcc.ResponseError( | |
erc20fs.From(actors[`account_holder1`]).Invoke( | |
`transfer`, actors[`token_owner`].GetMSPID(), actors[`token_owner`].GetID(), 100), | |
ErrNotEnoughFunds) | |
}) | |
It("Allow token holder with non zero balance to transfer tokens", func() { | |
expectcc.PayloadInt( | |
erc20fs.From(actors[`token_owner`]).Invoke( | |
`transfer`, actors[`account_holder1`].GetMSPID(), actors[`account_holder1`].GetID(), 100), | |
TotalSupply-100) | |
expectcc.PayloadInt( | |
erc20fs.Query( | |
`balanceOf`, actors[`token_owner`].GetMSPID(), actors[`token_owner`].GetID()), TotalSupply-100) | |
expectcc.PayloadInt( | |
erc20fs.Query( | |
`balanceOf`, actors[`account_holder1`].GetMSPID(), actors[`account_holder1`].GetID()), 100) | |
}) | |
}) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment