August 2019
Intermediate to advanced
486 pages
13h 52m
English
You can write JavaScript test cases using the Mocha framework and Chai for assertions. You write your test cases for the contract using Mocha, as we can write test cases for other projects, and include it in the .js file. These files must be kept in the test folder of the project. There is a difference for the Truffle tests when writing tests using Mocha: instead of using the describe() function, you should use the contract() function. For example, you can see the JavaScript test case file, DepositContract.test.js, written for DepositContract and present in the test folder of the project.
Truffle has a clean-room environment feature you can use:
Read now
Unlock full access