Skip to content
Advertisement

Test an onlyOwner function in Javascript

I have this situation in my smart contract:

JavaScript

I’m using truffle and his test suite and then I wrote this case, that fails maybe because I’m not using the only owner method in the right way:

JavaScript

Can someone help me?

Advertisement

Answer

Assuming that you properly set the owner in the contract, write a getter for the owner in the contract:

JavaScript

in test.js

JavaScript
User contributions licensed under: CC BY-SA
5 People found this is helpful
Advertisement