Contract/Unit Test

Creates a basic unit test and EOSIO smart contract.

To test a basic EOSIO contract without DAPP Network services, run the following:

This will create your new working directory, create your zeus-box.json (package.json), install the necessary zeus_boxes (node_modules) dependencies, create the example contract and unit test, compile the contract, start the local environment, and run the example unit tests.

# create dir
mkdir eosio-contract; cd eosio-contract
# create zeus-box.json/package.json default
zeus box create
# unbox unit testing associated boxes
zeus unbox seed-tests
# create your own contract
zeus create contract mycontract --template=simplecontract # if using an old cdt --legacy-cdt
# compile
zeus compile mycontract # if using an old cdt --legacy-cdt
# start local env and test
zeus test mycontract

Files created:

  • ./contracts/eos/mycontract/mycontract.cpp basic of basic contracts with a simple action

  • ./test/mycontract.spec.js basic unit test

Last updated