Hello,
Having a littlebit of trouble with big numbers in OpenZeppelin's test helpers. I would apprecaiate a little bit of help.
I am trying to test 2 big numbers are equal,
My contract is the one from the hardhat tutorial, but I changed solidity's version to 0.8.2 and added test-helpers from Open Zeppelin
const { expect } = require('chai');
const {
BN, // Big Number support
constants, // Common constants, like the zero address and largest integers
expectEvent, // Assertions for emitted events
expectRevert, // Assertions for transactions that should fail
} = require('@openzeppelin/test-helpers');
(TEstin gbasic equality between Big Numbers)
it("big numbers should be equal", async function () {
const total = await hardhatToken.totalSupply();
console.log('total->', total);
expect(total).to.be.bignumber.equal(total);
});
the error is:
3) Token contract
Deployment
big numbers should be equal:
AssertionError: expected { Object (_hex, _isBigNumber) } to be an instance of BN or string
and
console.log('total->', total);
gives:
total-> BigNumber { _hex: '0x0f4240', _isBigNumber: true }