Skip to content

Commit

Permalink
chore(contracts): Add tests to cover the bulkRevoke function in Abstr…
Browse files Browse the repository at this point in the history
…actPortal and AbstractPortalV2
  • Loading branch information
alainncls committed Nov 26, 2024
1 parent 7f57adb commit 20e3bbe
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 0 deletions.
11 changes: 11 additions & 0 deletions contracts/test/DefaultPortal.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -323,6 +323,17 @@ contract DefaultPortalTest is Test {
defaultPortal.bulkRevoke(attestationsToRevoke);
}

function test_bulkRevoke_OnlyOwner() public {
bytes32[] memory attestationsToRevoke = new bytes32[](2);
attestationsToRevoke[0] = bytes32("1");
attestationsToRevoke[1] = bytes32("2");

// Revoke the attestation as a random user
vm.prank(makeAddr("random"));
vm.expectRevert(AbstractPortal.OnlyPortalOwner.selector);
defaultPortal.bulkRevoke(attestationsToRevoke);
}

function test_supportsInterface() public view {
bool isIERC165Supported = defaultPortal.supportsInterface(type(ERC165Upgradeable).interfaceId);
assertEq(isIERC165Supported, true);
Expand Down
11 changes: 11 additions & 0 deletions contracts/test/DefaultPortalV2.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -243,6 +243,17 @@ contract DefaultPortalV2Test is Test {
defaultPortal.bulkRevoke(attestationsToRevoke);
}

function test_bulkRevoke_OnlyOwner() public {
bytes32[] memory attestationsToRevoke = new bytes32[](2);
attestationsToRevoke[0] = bytes32("1");
attestationsToRevoke[1] = bytes32("2");

// Revoke the attestation as a random user
vm.prank(makeAddr("random"));
vm.expectRevert(AbstractPortalV2.OnlyPortalOwner.selector);
defaultPortal.bulkRevoke(attestationsToRevoke);
}

function test_supportsInterface() public view {
bool isIERC165Supported = defaultPortal.supportsInterface(type(ERC165Upgradeable).interfaceId);
assertEq(isIERC165Supported, true);
Expand Down

0 comments on commit 20e3bbe

Please sign in to comment.