Skip to content

Commit

Permalink
skale test
Browse files Browse the repository at this point in the history
  • Loading branch information
zapaz committed Apr 30, 2024
1 parent fa76dc4 commit f95631e
Showing 1 changed file with 57 additions and 0 deletions.
57 changes: 57 additions & 0 deletions contracts/tests/OpenNFTsV4Skale/OpenNFTsV4SkaleTest.t.sol
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
// SPDX-License-Identifier: MITs
pragma solidity ^0.8.19;

import "forge-std/Test.sol";

import "src/OpenNFTsV4Skale.sol";

contract OpenNFTsV4SkaleTest is Test {
address owner = makeAddr("owner");
address minter = makeAddr("minter");
OpenNFTsV4Skale collection;
string constant TOKEN_URI = "ipfs://bafkreidfhassyaujwpbarjwtrc6vgn2iwfjmukw3v7hvgggvwlvdngzllm";

function setUp() public {
bool[] memory options = new bool[](1);
options[0] = true;

vm.startPrank(owner);
collection = new OpenNFTsV4Skale();
collection.initialize(
"SkaleTest", "SKTEST", owner, abi.encode(abi.encode(0, address(0), 0, options), address(0), 0)
);
vm.stopPrank();
}

function test_OpenNFTsV4Skale_cooldownPeriod(uint256 coolDownPeriod) public {
vm.assume(coolDownPeriod < 1e16);

vm.prank(owner);
collection.setCooldownPeriod(coolDownPeriod);

vm.startPrank(minter);
collection.mint(TOKEN_URI);

vm.warp(block.timestamp + coolDownPeriod);

vm.expectRevert();
collection.mint(TOKEN_URI);

vm.warp(block.timestamp + 1);

collection.mint(TOKEN_URI);
vm.stopPrank();
}

function test_OpenNFTsV4Skale_tokenUriMaxLength() public {
vm.prank(minter);
collection.mint(TOKEN_URI);

vm.prank(owner);
collection.setTokenUriMaxLength(64);

vm.prank(minter);
vm.expectRevert();
collection.mint(TOKEN_URI);
}
}

0 comments on commit f95631e

Please sign in to comment.