【发布时间】:2022-01-24 02:47:46
【问题描述】:
我想用 Javascript 在我的 mint 函数中测试这 3 个不同的需求。
function mint(uint256 _mintAmount) public payable {
require(_mintAmount > 0, "need to mint at least 1 NFT");
require(_mintAmount <= maxMintAmount, "max mint amount per session exceeded");
require(supply + _mintAmount <= maxSupply, "max NFT limit exceeded");
我对测试真的很陌生,所以我尝试了类似的方法。显然它是错误的,但我如何在这样的函数中测试 _mintAmount
it('mint amount', async () =>{
_mintAmount > 0;
_mintAmount <= maxMintAmount;
supply + _mintAmount <= maxSupply;
})
【问题讨论】:
-
我们需要有关您的合同和测试脚本的更多详细信息。您可以参考此文档:trufflesuite.com/docs/truffle/testing/… 如果您仍有问题,请使用更多信息更新您的问题
标签: javascript solidity truffle