testfolder under the location of your contract go file and add tests there.
erc20.gois the contract implementation,
token_init_test.goholds some testing code which we explore later, and
balanceOfuser1.jsonholds the gamma-cli query payload, which is executed over the Orbs blockchain (gamma) and runs the test.
token_init_test.gowe can see the following:
gammapackage, which is the wrapping of gamma-cli inside go code. Using
Start()tells it to run gamma and wait for it to start, which can take several seconds to complete.
Run()function is exactly the same as you would execute from within the command line, as this is wrapping gamma execution directly.
Transferevent, as the ERC20 implementation performs a transfer in its
_init()function, and the ERC20 spec requires an event on transfer
user1is as expected. This is more of a sanity check on the deploy, to make sure that indeed the blockchain was updated correctly and that the contract initiated everything as expected. The payload inside
OrbsERC20is executed with the argument specified, which is the key for user1 (the user which was used to sign the deploy transaction)