Reading from this post, one should not use toNumber() when working with uint256, so when writting the below test, I was expecting it to crash, but it does not, instead it runs to success! why ?
it("lottery amount should reflect previous two entries", async () => {
const result = await contract.totalAmount();
assert.equal(result, web3.utils.toWei("0.2")); // why we can compare BigNumber to string?
});
web3.utils.toWei("0.2") is string, where result is BigNumber. So how can we simply compare them in an assert?
BNobjects as far as I know. – goodvibration Nov 17 '20 at 16:46typeofto check,web3.utils.toWei("0.2")evaluates to string – Somjit Nov 17 '20 at 17:09