How to test with Mocha and Chai that a call at the
kill() function of a Smart Contract (i.e., which does the
selfdestruct) has gone right?
You can confirm that the bytecode has been zeroed out. Use the
web3.eth.getCode(yourContractAddress) explained here.
selfdestruct, you get the proper code, like
selfdestruct, you get
Of course, as mentioned by Ignacio and Badr, you can, and should, also test that the side actions have been executed correctly:
- the expected event was emitted
- the correct recipient received the balance
You can check if the funds of the contract have been sent to the given address.