-
-
Notifications
You must be signed in to change notification settings - Fork 44
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
41 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
pragma solidity ^0.8.0; | ||
|
||
import "https://github.com/OpenZeppelin/openzeppelin-solidity/contracts/test/ERC721Test.sol"; | ||
import "../smart-contracts/ethereum/erc721.sol"; | ||
|
||
contract ERC721Test is ERC721Test { | ||
ERC721 private erc721; | ||
|
||
function setUp() public { | ||
erc721 = new ERC721(); | ||
} | ||
|
||
function testMint() public { | ||
address alice = address(0x123); | ||
uint256 tokenId = 1; | ||
string memory tokenURI = "https://example.com/token/1"; | ||
|
||
erc721.mint(alice, tokenId, tokenURI); | ||
assertEq(erc721.ownerOf(tokenId), alice); | ||
} | ||
|
||
function testTransfer() public { | ||
address alice = address(0x123); | ||
address bob = address(0x456); | ||
uint256 tokenId = 1; | ||
|
||
erc721.mint(alice, tokenId, ""); | ||
erc721.transfer(bob, tokenId); | ||
assertEq(erc721.ownerOf(tokenId), bob); | ||
} | ||
|
||
function testApprove() public { | ||
address alice = address(0x123); | ||
address bob = address(0x456); | ||
uint256 tokenId = 1; | ||
|
||
erc721.mint(alice, tokenId, ""); | ||
erc721.approve(bob, tokenId); | ||
assertEq(erc721.getApproved(tokenId), bob); | ||
} | ||
} |