Exercise: Implementing Tests
Practice implementing tests using the Truffle Framework.
We'll cover the following
In this exercise, we'll practice writing tests for smart contracts using the Truffle Framework. We'll have to write a new test for the Auction
smart contract in which we test that the ownership of the item on sale will go to the highest bidder.
Test to implement
We still haven't tested what happens if an auction ends successfully and we have a winner.
To test this, we need to write a test where two accounts place bids, with the second account placing a larger bid than the first. Then, we need to finish the auction and try to withdraw the failed bid for the first account. We expect the ownership of the contract to be transferred to the higher bidder and the first account to receive the withdrawn bid.
Get hands-on with 1400+ tech skills courses.