Add extra tests for PurchaseToken

This commit is contained in:
Aadi Desai 2023-02-21 15:58:13 +00:00
parent 9592b337a0
commit 84df96812b
No known key found for this signature in database
GPG key ID: CFFFE425830EF4D9

View file

@ -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);