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.
Contract
Options
1
# create dir
2
mkdir eosio-contract; cd eosio-contract
3
# create zeus-box.json/package.json default
4
zeus box create
5
# unbox unit testing associated boxes
6
zeus unbox seed-tests
7
# create your own contract
8
zeus create contract mycontract --template=simplecontract
9
# compile
10
zeus compile mycontract
11
# start local env and test
12
zeus test mycontract
Copied!
1
zeus create contract <contractname>
2
​
3
generates an empty contract
4
​
5
Options:
6
--version Show version number [boolean]
7
--storage-path path for persistent storage [default: "/home/ubuntu/.zeus"]
8
--rc-file use rc file to load options from
9
[default: "/home/ubuntu/.zeus/zeusrc.json"]
10
--rc-ignore ignore rc file [default: false]
11
--verbose, -v [default: false]
12
-h, --help Show help [boolean]
13
--chain [default: "eos"]
14
--language [default: "cpp"]
15
--template [default: "emptycontract"]
16
​
17
Examples:
18
zeus create contract testcontract --chain=eos --language=cpp
19
--template=emptycontract
Copied!
If you get the error TypeError: lookups.flatMap is not a function, update nodejs to v14 or above, link to stack issue​
Files created:
  • ./contracts/eos/mycontract/mycontract.cpp basic of basic contracts with a simple action
  • ./test/mycontract.spec.js basic unit test
Copy link