mirror of
https://github.com/Instadapp/dsa-connectors.git
synced 2024-07-29 22:37:00 +00:00
test: 💍 getRoleMember and getRoleMemberCount
This commit is contained in:
parent
fdb62fedd5
commit
66f1a7cc6e
|
@ -130,4 +130,44 @@ describe("Test InstaAccessControl contract", () => {
|
|||
false
|
||||
);
|
||||
});
|
||||
|
||||
it("should do role count properly", async () => {
|
||||
expect(await masterAccessControl.getRoleMemberCount(TEST_ROLE)).to.eq(0);
|
||||
|
||||
await masterAccessControl.grantRole(TEST_ROLE, account.address);
|
||||
|
||||
expect(await masterAccessControl.getRoleMemberCount(TEST_ROLE)).to.eq(1);
|
||||
|
||||
await masterAccessControl.grantRole(TEST_ROLE, instaMaster.address);
|
||||
|
||||
expect(await masterAccessControl.getRoleMemberCount(TEST_ROLE)).to.eq(2);
|
||||
|
||||
await masterAccessControl.revokeRole(TEST_ROLE, instaMaster.address);
|
||||
|
||||
expect(await masterAccessControl.getRoleMemberCount(TEST_ROLE)).to.eq(1);
|
||||
});
|
||||
|
||||
it("should get member correctly by index", async () => {
|
||||
await expect(
|
||||
masterAccessControl.getRoleMember(TEST_ROLE, 0)
|
||||
).to.rejectedWith(/EnumerableSet: index out of bounds/);
|
||||
|
||||
await masterAccessControl.grantRole(TEST_ROLE, account.address);
|
||||
|
||||
expect(await masterAccessControl.getRoleMember(TEST_ROLE, 0)).to.eq(
|
||||
account.address
|
||||
);
|
||||
|
||||
await masterAccessControl.grantRole(TEST_ROLE, instaMaster.address);
|
||||
|
||||
expect(await masterAccessControl.getRoleMember(TEST_ROLE, 1)).to.eq(
|
||||
instaMaster.address
|
||||
);
|
||||
|
||||
await masterAccessControl.revokeRole(TEST_ROLE, instaMaster.address);
|
||||
|
||||
await expect(
|
||||
masterAccessControl.getRoleMember(TEST_ROLE, 1)
|
||||
).to.rejectedWith(/EnumerableSet: index out of bounds/);
|
||||
});
|
||||
});
|
||||
|
|
Loading…
Reference in New Issue
Block a user