@@ -14,7 +14,9 @@ contract FaucetTest is Test {
1414 Faucet internal faucet;
1515 Vm.Wallet internal wallet;
1616 Vm.Wallet internal chain;
17+ address owner;
1718 address constant tester = address (0x1804c8AB1F12E6bbf3894d4083f33e07309d1f38 );
19+ string constant key = "test " ;
1820 uint256 constant mintAmount = 1000 * 10 ** 18 ;
1921
2022 function setUp () public virtual {
@@ -23,31 +25,37 @@ contract FaucetTest is Test {
2325 wallet = vm.createWallet ("user " );
2426 FaucetDeployer faucetDeployer = new FaucetDeployer ();
2527 faucet = faucetDeployer.run ("local " , mintAmount / 2 );
28+ owner = faucet.owner ();
2629 assertEq (faucet.supply (), mintAmount / 2 );
2730 }
2831
2932 function test_DripTransfer () public {
3033 assertEq (wallet.addr.balance, 0 );
3134
32- faucet.drip (payable (wallet.addr));
35+ vm.prank (owner);
36+ faucet.drip (payable (wallet.addr), key);
3337
3438 assertEq (faucet.supply (), mintAmount / 2 - faucet.dripAmount ());
3539 assertEq (wallet.addr.balance, faucet.dripAmount ());
3640 }
3741
3842 function test_DripTransferNoDelayFail () public {
39- faucet.drip (payable (wallet.addr));
43+ vm.prank (owner);
44+ faucet.drip (payable (wallet.addr), key);
4045
4146 vm.expectRevert (TryLater.selector );
42- faucet.drip (payable (wallet.addr));
47+ vm.prank (owner);
48+ faucet.drip (payable (wallet.addr), key);
4349 }
4450
4551 function test_DripTransferDelay () public {
46- faucet.drip (payable (wallet.addr));
52+ vm.startPrank (owner);
53+ faucet.drip (payable (wallet.addr), key);
4754
4855 vm.warp (block .timestamp + (5 minutes));
49-
50- faucet.drip (payable (wallet.addr));
56+
57+ faucet.drip (payable (wallet.addr), key);
58+ vm.stopPrank ();
5159
5260 assertEq (wallet.addr.balance, 2 * faucet.dripAmount ());
5361 }
0 commit comments