loomnetwork / erc721x

ERC721x is an extension of ERC721 that adds support for multi-fungible tokens and batch transfers, while being fully backward-compatible.
BSD 3-Clause "New" or "Revised" License
165 stars 54 forks source link

truffle test will not run #16

Closed dentropy closed 6 years ago

dentropy commented 6 years ago

When I run truffle test I get the following error

No secrets.json found. If you are trying to publish EPM this will fail. Otherwise, you can ignore this message!
Using network 'development'.

TypeError: Cannot destructure property `BN` of 'undefined' or 'null'.
    at Object.<anonymous> (/home/paul/gitClone/erc721x/test/ERC721X.test.js:5:21)
    at Module._compile (module.js:653:30)
    at Object.Module._extensions..js (module.js:664:10)
    at Module.load (module.js:566:32)
    at tryModuleLoad (module.js:506:12)
    at Function.Module._load (module.js:498:3)
    at Module.require (module.js:597:17)
    at require (internal/module.js:11:18)
    at /home/paul/.nvm/versions/node/v8.12.0/lib/node_modules/truffle/node_modules/mocha/lib/mocha.js:231:27
    at Array.forEach (<anonymous>)
    at Mocha.loadFiles (/home/paul/.nvm/versions/node/v8.12.0/lib/node_modules/truffle/node_modules/mocha/lib/mocha.js:228:14)
    at Mocha.run (/home/paul/.nvm/versions/node/v8.12.0/lib/node_modules/truffle/node_modules/mocha/lib/mocha.js:536:10)
    at /home/paul/.nvm/versions/node/v8.12.0/lib/node_modules/truffle/build/webpack:/packages/truffle-core/lib/test.js:125:1
    at <anonymous>
    at process._tickCallback (internal/process/next_tick.js:189:7)

I ran ganache-cli on port 7545 which truffle has configured to network develop. I also made sure to test deploying the scripts to the ganache blockchain which was successful.

I then tried changing line 5 from test/ERC721X.text.js from const { BN } = web3.utils to const { BN } = require("bn.js") which partially fixed the issue

Now when I run truffle test I get a lot of failing test which all have the same the error below on many tests Error: Invalid number of arguments to Solidity function

Some of these test cases include

  1. Should get the correct supply when minting both NFTs and FT
  2. Should return correct token uri for multiple NFT
  3. Should return correct token uri for 6-digit NFT
  4. And more
gakonst commented 6 years ago

You need truffle v5, https://github.com/loomnetwork/erc721x/blob/master/package.json#L33

Try doing node_modules/.bin/truffle test instead. If you still want to use truffle 4, you can use the truffle4 branch.