November 2018
Intermediate to advanced
528 pages
13h 21m
English
Everything is ready to build our Truffle test.
First off, create a test.js file within Truffle's test/ folder, then paste in the following code:
var Cplayer = artifacts.require("Cplayer");var Ctontine = artifacts.require("Ctontine");contract('Cplayer', function(accounts) {});contract('Ctontine', function(accounts) {});As you guessed, artifacts.require references the contract to use in the test script. Then, for each contract we need to test, we define a contract() function to create a test suite, as follows:
contract(Cplayer, function(accounts) { });
Here, the contract() function is similar to the describe() function in Mocha, which holds a collection of tests. Its first parameter is an array with the accounts coming ...
Read now
Unlock full access