Here's the function that's supposed to return a uint256
function initializeToken(string memory name, string memory symbol) public returns (uint256) {
// _creatorIds is a @openzeppelin counter
address creator = msg.sender;
_creatorIds.increment();
newId = _creatorIds.current();
Token token = new Token(symbol, name, creator);
_tokens[newId] = address(token);
return newId;
}
I followed the testing instructions given here
The when I console.log() the result in a test file and run it with hardhat it returns a
{ Object (hash, blockHash, ...) }
instead of a
{ BigNumber (_hex, _isBigNumber) }
So I can't do any equality tests.
There's probably a really easy answer to this, but I've tried recompiling multiple times, and it still doesn't work.
edit:
Here's the test code as requested:
const { expect } = require('chai');
describe("TokenDistributor contract", function() {
it("Deployment should return a Token with name Test Token and symbol TTN", async function() {
const [distributor] = await ethers.getSigners();
const TokenDistributor = await ethers.getContractFactory("TokenDistributor");
const instance = await TokenDistributor.deploy();
await instance.deployed();
var tokenId = await instance.initializeToken("Test Token","TTN");
console.log(tokenId); //This is where I did the console.log to see what was wrong
expect(tokenId).to.equal(1); //this is where the test fails
});
});