mirror of
https://github.com/supleed2/COMP70017-PoDL-CW.git
synced 2024-11-09 09:59:31 +00:00
Add extra tests for PurchaseToken
This commit is contained in:
parent
9592b337a0
commit
84df96812b
|
@ -30,10 +30,22 @@ contract PurchaseTokenTest is Test {
|
|||
assertEq(token.symbol(), "PT");
|
||||
}
|
||||
|
||||
function testAllowance() public {
|
||||
assertEq(token.allowance(alice, bob), 0);
|
||||
}
|
||||
|
||||
function testBalanceOf() public {
|
||||
assertEq(token.balanceOf(alice), 0);
|
||||
}
|
||||
|
||||
function testDecimals() public {
|
||||
assertEq(token.decimals(), 18);
|
||||
}
|
||||
|
||||
function testTotalSupply() public {
|
||||
assertEq(token.totalSupply(), 0);
|
||||
}
|
||||
|
||||
function testMint() public {
|
||||
vm.deal(alice, 1 ether);
|
||||
assertEq(token.balanceOf(alice), 0);
|
||||
|
@ -46,6 +58,12 @@ contract PurchaseTokenTest is Test {
|
|||
assertEq(token.totalSupply(), 1e19);
|
||||
}
|
||||
|
||||
function testMintInvalid() public {
|
||||
vm.prank(address(0));
|
||||
vm.expectRevert("ERC20: mint to the zero address");
|
||||
token.mint();
|
||||
}
|
||||
|
||||
function testMintInsufficientFunds() public {
|
||||
vm.deal(alice, 0.01 ether);
|
||||
assertEq(token.balanceOf(alice), 0);
|
||||
|
|
Loading…
Reference in a new issue