LESSON 12: Unit Test Error - Constructor #1984
Replies: 4 comments 5 replies
-
The complete code for |
Beta Was this translation helpful? Give feedback.
-
@DorianDaSilva : your INITIAL_SUPPLY should be in WEI. Convert your INITIAL_SUPPLY into WEI means : "10000000" Tokens = "10000000000000000000000000" WEI Tokens Because you have a function decimals() with 18 decimal places, So, it means your : INITIAL_SUPPLY + 18 - zero's = "10000000000000000000000000". Just change your INITIAL_SUPPLY from "10000000" to "10000000000000000000000000" in your HELPER Your Tokens supply will still be "10000000" when you deploy the contract. Hopefully it will resolve the issue! |
Beta Was this translation helpful? Give feedback.
-
Try this describe("constructor", async function () {
it("Has correct initial supply of our token", async function () {
const totalSupply = await token.totalSupply()
assert.equal(totalSupply.toString(),parseInt(INITIAL_SUPPLY) *multiplier)
}) As is constructor you did set the decimal places to 10**18 here: totalSupply = initialSupply * 10**uint256(decimals); //total supply w/decimals |
Beta Was this translation helpful? Give feedback.
-
@adityabhattad2021 Not exactly...but for now it is not presenting an issue. I am currently struggling with this #1997 |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
ERROR
So far 3 out of 4 pass - test breaks when checking for
initialSupply
=================================================================================
Below are the scripts:
UNIT TEST
MANUALTOKEN CONTRACT
HELPER
===================================================================================
Thank you!
Beta Was this translation helpful? Give feedback.
All reactions