Problem with truffle test - wrong number of arguments, wrong return types...

I'm currently trying to write some unit tests in Truffle. I keep running into some bizarre issues when trying to run the tests with Truffle. For example, I'm trying to use zeppelin-solidity/contracts/token/MintableToken.sol as a baseline for my token. I have a function

function mint(address _to, uint256 _amount) onlyOwner canMint public returns (bool) {

when I try to call it like

return token.mint(accounts[0], 100);

I get an error of

Uncaught Error: Invalid number of arguments to Solidity function

Which is rather weird - the function takes two parameters, and I'm passing it two parameters. So I decided to deconstruct the issue as much as possible. Here is my contract:

pragma solidity ^0.4.8; import 'zeppelin-solidity/contracts/token/MintableToken.sol'; contract Token is MintableToken { }

and after trying to test it with

var Token = artifacts.require("Token"); contract ("Token", function(accounts) { it("Should mint tokens properly", function() { return Token.deployed().then(function(token) { return token.mint(accounts[0], 100); }).then(function(isOK) { assert.equal(isOK, true, "Was not able to mint tokens"); }); }); });

I get an error of:

AssertionError: Was not able to mint tokens: expected { Object (tx, receipt, ...) } to equal true

So now the function accepts two arguments, but doesn't return bool - instead opting to return some weird object...

Anything I'm doing glaringly wrong here?
Sign In or Register to comment.