The next step in our implementation is to test the code. We could do this by manually calling the functions in our contracts and checking for the expected outcome, but the better way is to write tests using Truffle's test framework, thereby allowing us to automate the testing process.
Note that we could have developed our contracts in a test-driven way, by first defining the expected behavior of our contracts, writing an initially-failing test to test that behavior, and then writing code to allow the test to pass. In our case, we haven't done this, but Test-Driven Development (TDD) is a popular option for developers using the Truffle framework.
Truffle allows tests to be written in both JavaScript and Solidity. For our implementation, we'll use JavaScript, which, under Truffle, uses the Mocha testing framework and Chai assertion library. If you...