From the video: Creating wallet test.
When I do:
contract("Dex", accounts => {
it("Should only be possible for owner to add tokens", async ()=>{
let dex = await Dex.deployed();
let link = await Link.deployed();
await truffleAssert.passes(
await dex.addToken(web3.utils.fromUtf8("LINK"), link.address, {from: accounts[0]} )
);
await truffleAssert.reverts(
await dex.addToken(web3.utils.fromUtf8("AAVE"), link.address, {from: accounts[1]} )
);
} )
I don’t get a pass. I get:
Contract: Dex
1) Should only be possible for owner to add tokens
> No events were emitted
0 passing (6s)
1 failing
1) Contract: Dex
Should only be possible for owner to add tokens:
Error: Returned error: VM Exception while processing transaction: revert Ownable: caller is not the owner -- Reason given: Ownable: caller is not the owner.
at Context.<anonymous> (C:\Users\rapha\Documents\NFT\ETH201\DEX\test\wallettest.js:15:23)
at processTicksAndRejections (node:internal/process/task_queues:96:5)
The error message is correct. But I wanted it to revert.
Why does it behave differently than @filip’s code?
Also I get 0 passed. But the first test should have passed…