I'm writing tests for my smart-contract, mostly everything work as expected. However, there's one thing that does not and I can't understand why (I'm far from being a javascript expert, so please bear with me if I'm doing something stupid)
Code to reproduce
// This is a tracker on the default account
let senderTracker = await balance.tracker(defaultSender, "ether");
// later
console.log(`*** Before payment: ${await senderTracker.get() }`);
//call the payWinners function in my contract, it should also send a fee to default sender account
let sharedPot = await forecast.payWinners([accounts[2]]);
let fee = await senderTracker.delta();
console.log(`*** is BN: ${ Web3.utils.isBN(fee) }`);
console.log(`*** After payment: ${ await senderTracker.get() }`);
console.log(`*** Fee: ${ Web3.utils.fromWei(fee, "milliether") }`);
And in the console I get:
Pay Winners
*** Before payment: 99818042788
*** is BN: true
*** After payment: 99818484256
1) should pay the winner6 passing (1s)
1 failing
- Pay Winners
should pay the winner:
Error: [number-to-bn] while converting number "3fffffff81afa7c" to BN.js instance, error: invalid number value. Value must be an integer, hex string, BN or BigNumber instance. Note, decimals are not supported.
If the isBN() function returns true, how is it possible that I get this error saying that the value should be BN?
