asmarques / chai-bignumber

Chai assertions for comparing arbitrary-precision decimals using the bignumber.js library
MIT License
14 stars 37 forks source link

Added compatibility with BN.js from web3 ^1.0.0 #9

Open kandrianov opened 5 years ago

kandrianov commented 5 years ago

Let's make it compatible with web3.utils.BN, because web3 ^1.0.0 uses BN.js

ameensol commented 5 years ago

I came here to add this, but found that it isn't that straightforward to get the tests working for BN.js because BN.js doesn't support decimals, but bignumber.js does.

Also when I copied the test file to run it separately for BN.js the way the method overwriting happens in chai-bignumber I was having trouble getting both tests to work. The BigNumber tests only work when I comment out this line in the BN test file:

chai.use(require('../chai-bignumber')(BN));

I think for this to be accepted we'd need to figure out how to:

  1. test both BigNumber and BN separately in different files without interference
  2. remove all decimal test cases from the BN test file