From 84df96812b97194cff62a8e0b4c3de7494233610 Mon Sep 17 00:00:00 2001 From: Aadi Desai <21363892+supleed2@users.noreply.github.com> Date: Tue, 21 Feb 2023 15:58:13 +0000 Subject: [PATCH] Add extra tests for PurchaseToken --- test/PurchaseToken.t.sol | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/test/PurchaseToken.t.sol b/test/PurchaseToken.t.sol index 363c955..01d76ca 100644 --- a/test/PurchaseToken.t.sol +++ b/test/PurchaseToken.t.sol @@ -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);