Skip to content

Commit

Permalink
✅ test events
Browse files Browse the repository at this point in the history
  • Loading branch information
JaredBorders committed Aug 5, 2024
1 parent be6ff03 commit 7fc5527
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions test/MarginPaymaster.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,13 @@ import {ECDSA} from "@openzeppelin/contracts/utils/cryptography/ECDSA.sol";
import {console} from "forge-std/console.sol";

contract MarginPaymasterTest is Bootstrap {
/*//////////////////////////////////////////////////////////////
EVENTS
//////////////////////////////////////////////////////////////*/

event PercentageMarkupSet(uint256);
event AuthorizerSet(address, bool);

/*//////////////////////////////////////////////////////////////
STATE
//////////////////////////////////////////////////////////////*/
Expand Down Expand Up @@ -129,6 +136,12 @@ contract MarginPaymasterTest is Bootstrap {
assertFalse(marginPaymaster.authorizers(authorizer));
}

function testSetAuthorizerEvent(address authorizer, bool status) public {
vm.expectEmit(true, true, true, true);
emit AuthorizerSet(authorizer, status);
marginPaymaster.setAuthorizer(authorizer, status);
}

function testSetAuthorizerOnlyOwner() public {
address authorizer = address(0x123456);
bool status = true;
Expand Down Expand Up @@ -361,6 +374,12 @@ contract MarginPaymasterTest is Bootstrap {
assertEq(marginPaymaster.percentageMarkup(), newPercentageMarkup);
}

function testSetPercentageMarkup(uint256 markup) public {
vm.expectEmit(true, true, true, true);
emit PercentageMarkupSet(markup);
marginPaymaster.setPercentageMarkup(markup);
}

function testSetPercentageMarkup_onlyOwner() public {
uint256 newPercentageMarkup = 150; // 150%
// Attempt to set the percentage markup as a non-owner
Expand Down

0 comments on commit 7fc5527

Please sign in to comment.