Skip to content

Commit d92590d

Browse files
committed
add test
1 parent 38f16b0 commit d92590d

File tree

1 file changed

+22
-14
lines changed

1 file changed

+22
-14
lines changed

test/ZNSRootRegistrar.test.ts

+22-14
Original file line numberDiff line numberDiff line change
@@ -408,6 +408,12 @@ describe("ZNSRootRegistrar", () => {
408408
).to.be.reverted;
409409
});
410410

411+
it("#isOwnerOf() should revert if wrong enum value is passed", async () => {
412+
await expect(
413+
zns.rootRegistrar.isOwnerOf(ethers.ZeroHash, user.address, 3)
414+
).to.be.reverted;
415+
});
416+
411417
it("#setSubRegistrar() should revert if called by address without ADMIN_ROLE", async () => {
412418
const isAdmin = await zns.accessController.hasRole(ADMIN_ROLE, randomUser.address);
413419
expect(isAdmin).to.be.false;
@@ -1353,23 +1359,25 @@ describe("ZNSRootRegistrar", () => {
13531359
});
13541360
});
13551361

1356-
it("#setRootPricer() should set the rootPricer correctly", async () => {
1357-
const newPricer = zns.fixedPricer.target;
1358-
await zns.rootRegistrar.connect(admin).setRootPricer(newPricer);
1362+
describe("#setRootPricer", () => {
1363+
it("#setRootPricer() should set the rootPricer correctly", async () => {
1364+
const newPricer = zns.fixedPricer.target;
1365+
await zns.rootRegistrar.connect(admin).setRootPricer(newPricer);
13591366

1360-
expect(await zns.rootRegistrar.rootPricer()).to.eq(newPricer);
1367+
expect(await zns.rootRegistrar.rootPricer()).to.eq(newPricer);
13611368

1362-
// set back
1363-
await zns.rootRegistrar.connect(admin).setRootPricer(zns.curvePricer.target);
1364-
});
1369+
// set back
1370+
await zns.rootRegistrar.connect(admin).setRootPricer(zns.curvePricer.target);
1371+
});
13651372

1366-
it("#setRootPricer() should NOT let set 0x0 address as the new pricer", async () => {
1367-
await expect(
1368-
zns.rootRegistrar.connect(admin).setRootPricer(ethers.ZeroAddress)
1369-
).to.be.revertedWithCustomError(
1370-
zns.subRegistrar,
1371-
ZERO_ADDRESS_ERR
1372-
);
1373+
it("#setRootPricer() should NOT let set 0x0 address as the new pricer", async () => {
1374+
await expect(
1375+
zns.rootRegistrar.connect(admin).setRootPricer(ethers.ZeroAddress)
1376+
).to.be.revertedWithCustomError(
1377+
zns.subRegistrar,
1378+
ZERO_ADDRESS_ERR
1379+
);
1380+
});
13731381
});
13741382
});
13751383

0 commit comments

Comments
 (0)