test: updated permission manager tests for isInAnyRole, isInAllRoles

This commit is contained in:
The3D 2021-05-20 11:42:50 +02:00
parent 088d2733cf
commit 42c6123697

View File

@ -78,6 +78,24 @@ makeSuite('Permission manager', (testEnv: TestEnv) => {
expect(mappedPermissions.indexOf(LIQUIDATOR.toString())).to.be.gte(0); expect(mappedPermissions.indexOf(LIQUIDATOR.toString())).to.be.gte(0);
}); });
it('Checks isInAllRoles (positive test)', async () => {
const { users } = testEnv;
const result = await permissionManager.isInAllRoles(users[0].address, [DEPOSITOR, BORROWER, LIQUIDATOR])
expect(result).to.be.equal(true, "Invalid result for isInAllRoles");
});
it('Checks isInAnyRole (positive test)', async () => {
const { users } = testEnv;
const result = await permissionManager.isInAnyRole(users[0].address, [DEPOSITOR, BORROWER, LIQUIDATOR])
expect(result).to.be.equal(true, "Invalid result for isInAnyRole");
});
it('Removes the depositor', async () => { it('Removes the depositor', async () => {
const { users } = testEnv; const { users } = testEnv;
@ -92,6 +110,15 @@ makeSuite('Permission manager', (testEnv: TestEnv) => {
expect(isLiquidator).to.be.equal(true); expect(isLiquidator).to.be.equal(true);
}); });
it('Checks isInAllRoles (negative test)', async () => {
const { users } = testEnv;
const result = await permissionManager.isInAllRoles(users[0].address, [DEPOSITOR, BORROWER, LIQUIDATOR])
expect(result).to.be.equal(false, "Invalid result for isInAllRoles");
});
it('Removes the borrower', async () => { it('Removes the borrower', async () => {
const { users } = testEnv; const { users } = testEnv;
@ -106,6 +133,14 @@ makeSuite('Permission manager', (testEnv: TestEnv) => {
expect(isLiquidator).to.be.equal(true); expect(isLiquidator).to.be.equal(true);
}); });
it('Checks isInAnyRole (negative test)', async () => {
const { users } = testEnv;
const result = await permissionManager.isInAnyRole(users[0].address, [DEPOSITOR, BORROWER])
expect(result).to.be.equal(false, "Invalid result for isInAnyRole");
});
it('Removes the liquidator', async () => { it('Removes the liquidator', async () => {
const { users } = testEnv; const { users } = testEnv;