0
let result = await instance.joinQuiz({
    from: accounts[1],
    value: web3.utils.toWei(10, "wei")
});
2

The signature of the toWei method is (can be found in the docs.

web3.utils.toWei(number [, unit])

number - String|BN: The value.
unit - String (optional, defaults to "ether"): The ether to convert from.

So you should provide the number as either a String or a BigNumber (Web3 0.2x) / BN (Web3 1.x).

Your code should then be:

let result = await instance.joinQuiz({
    from: accounts[1], 
    value: web3.utils.toWei("10", "wei")
});

However, in your code you're converting from wei to wei, which might not be what you want, so keep in mind that the second parameter is the unit you're converting from.

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Not the answer you're looking for? Browse other questions tagged or ask your own question.