Skip to content

Commit 191aab8

Browse files
committed
add tests
1 parent 28e8282 commit 191aab8

1 file changed

Lines changed: 14 additions & 4 deletions

File tree

contracts/test/unit/registry/PermissionedRegistry.t.sol

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,9 @@ pragma solidity >=0.8.13;
33

44
// solhint-disable no-console, private-vars-leading-underscore, state-visibility, func-name-mixedcase, namechain/ordering, one-contract-per-file
55

6-
import {Test} from "forge-std/Test.sol";
7-
import {Vm} from "forge-std/Vm.sol";
6+
import {Vm, Test} from "forge-std/Test.sol";
87

8+
import {NameCoder} from "@ens/contracts/utils/NameCoder.sol";
99
import {IERC1155} from "@openzeppelin/contracts/token/ERC1155/IERC1155.sol";
1010
import {ERC1155Holder} from "@openzeppelin/contracts/token/ERC1155/utils/ERC1155Holder.sol";
1111

@@ -367,6 +367,17 @@ contract PermissionedRegistryTest is Test, ERC1155Holder {
367367
);
368368
}
369369

370+
function test_Revert_register_tooShort() external {
371+
vm.expectRevert(abi.encodeWithSelector(NameCoder.LabelIsEmpty.selector));
372+
registry.register("", user1, registry, address(0), DEFAULT_ROLE_BITMAP, _after(86400));
373+
}
374+
375+
function test_Revert_register_tooLong() external {
376+
string memory label = new string(256);
377+
vm.expectRevert(abi.encodeWithSelector(NameCoder.LabelIsTooLong.selector, label));
378+
registry.register(label, user1, registry, address(0), DEFAULT_ROLE_BITMAP, _after(86400));
379+
}
380+
370381
function test_Revert_cannot_mint_duplicates() public {
371382
registry.register(
372383
"test2",
@@ -1298,8 +1309,7 @@ contract PermissionedRegistryTest is Test, ERC1155Holder {
12981309
);
12991310

13001311
// Query for multiple roles where only SET_RESOLVER has assignees
1301-
uint256 queryBitmap = RegistryRolesLib.ROLE_SET_RESOLVER |
1302-
RegistryRolesLib.ROLE_RENEW;
1312+
uint256 queryBitmap = RegistryRolesLib.ROLE_SET_RESOLVER | RegistryRolesLib.ROLE_RENEW;
13031313
(uint256 counts, ) = registry.getAssigneeCount(tokenId, queryBitmap);
13041314

13051315
// Only SET_RESOLVER should have 1 assignee

0 commit comments

Comments
 (0)