diff --git a/Week16/my-create-web3-dapp/contract/test/MyToken.t.sol b/Week16/my-create-web3-dapp/contract/test/MyToken.t.sol index df95ac55..a9cae8d5 100644 --- a/Week16/my-create-web3-dapp/contract/test/MyToken.t.sol +++ b/Week16/my-create-web3-dapp/contract/test/MyToken.t.sol @@ -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 + } } \ No newline at end of file