-
Notifications
You must be signed in to change notification settings - Fork 0
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
27 additions
and
11 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 |
---|---|---|
@@ -1,21 +1,37 @@ | ||
// SPDX-License-Identifier: UNLICENSED | ||
pragma solidity ^0.8.19; | ||
// SPDX-License-Identifier: MIT | ||
pragma solidity ^0.8.9; | ||
|
||
import "forge-std/Test.sol"; | ||
import "../src/FDemo.sol"; | ||
import "../src/MyToken.sol"; | ||
|
||
contract FoundryDemoTest is Test { | ||
FDemo instance; | ||
contract MyTokenTest is Test { | ||
MyTokens internal myToken; | ||
|
||
function setUp() public { | ||
instance = new FDemo(); | ||
function beforeEach() public override { | ||
myToken = new MyToken(); | ||
} | ||
|
||
function testMint() public { | ||
string memory dummyTokenUri = "ipfs://metadata_url"; | ||
uint256 tokenId = instance.mint(dummyTokenUri); | ||
function testTokenName() public { | ||
string memory name = myToken.name(); | ||
assert.equal(name, "MyToken", "Incorrect token name"); | ||
} | ||
|
||
function testTokenSymbol() public { | ||
string memory symbol = myToken.symbol(); | ||
assert.equal(symbol, "MTK", "Incorrect token symbol"); | ||
} | ||
|
||
assertEq(dummyTokenUri, instance.tokenURI(tokenId)); | ||
function testTokenDecimals() public { | ||
uint8 decimals = myToken.decimals(); | ||
assert.equal(decimals, 18, "Incorrect token decimals"); | ||
} | ||
|
||
// Add more test cases for other functions | ||
|
||
function runTests() public { | ||
testTokenName(); | ||
testTokenSymbol(); | ||
testTokenDecimals(); | ||
// TODO: Add more test functions to run | ||
} | ||
} |