Skip to content

Commit

Permalink
Review changes:
Browse files Browse the repository at this point in the history
- zero address from ethers
- typo fixes
- removing unnecessary before
  • Loading branch information
MilGard91 authored and shark0der committed Jan 5, 2023
1 parent c44ca29 commit b46fa6b
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 17 deletions.
4 changes: 2 additions & 2 deletions contracts/mocks/MasterMock.sol
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ import "../modules/capital/Pool.sol";
contract MasterMock {

enum Role {
UnAssigned,
AdvisoryBord,
Unassigned,
AdvisoryBoard,
Member,
Owner
}
Expand Down
28 changes: 13 additions & 15 deletions test/unit/MemberRoles/changeDependentContractAddress.js
Original file line number Diff line number Diff line change
@@ -1,29 +1,27 @@
const { InternalContractsIDs } = require('../utils').constants;
const { expect } = require('chai');
const { hex } = require('../../../lib/helpers');
const { ZERO_ADDRESS } = require('../../../lib/constants');
const {
constants: { AddressZero },
} = require('ethers');

describe('changeDependentContractAddress', function () {
before(async function () {
const { quotationData, memberRoles } = this.contracts;
it('should change authorized address for the role', async function () {
const { quotationData, memberRoles, master } = this.contracts;
const { governanceContracts, defaultSender } = this.accounts;
await quotationData.connect(governanceContracts[0]).setKycAuthAddress(defaultSender.address);
await memberRoles.connect(governanceContracts[0]).setKycAuthAddress(quotationData.address);
});

it('should change authorized address for the role', async function () {
const { memberRoles, master } = this.contracts;

const tkAddressBefore = await memberRoles.internalContracts(InternalContractsIDs.TK);
const tcAddressBefore = await memberRoles.internalContracts(InternalContractsIDs.TC);
const p1AddressBefore = await memberRoles.internalContracts(InternalContractsIDs.P1);
const coAddressBefore = await memberRoles.internalContracts(InternalContractsIDs.CO);

await Promise.all([
master.setLatestAddress(hex('CO'), ZERO_ADDRESS),
master.setTokenAddress(ZERO_ADDRESS),
master.setLatestAddress(hex('TC'), ZERO_ADDRESS),
master.setLatestAddress(hex('P1'), ZERO_ADDRESS),
master.setLatestAddress(hex('CO'), AddressZero),
master.setTokenAddress(AddressZero),
master.setLatestAddress(hex('TC'), AddressZero),
master.setLatestAddress(hex('P1'), AddressZero),
]);

await memberRoles.changeDependentContractAddress();
Expand All @@ -37,9 +35,9 @@ describe('changeDependentContractAddress', function () {
expect(tcAddressAfter).not.to.be.equal(p1AddressBefore);
expect(coAddressAfter).not.to.be.equal(coAddressBefore);

expect(tkAddressAfter).to.be.equal(ZERO_ADDRESS);
expect(tcAddressAfter).to.be.equal(ZERO_ADDRESS);
expect(p1AddressAfter).to.be.equal(ZERO_ADDRESS);
expect(coAddressAfter).to.be.equal(ZERO_ADDRESS);
expect(tkAddressAfter).to.be.equal(AddressZero);
expect(tcAddressAfter).to.be.equal(AddressZero);
expect(p1AddressAfter).to.be.equal(AddressZero);
expect(coAddressAfter).to.be.equal(AddressZero);
});
});

0 comments on commit b46fa6b

Please sign in to comment.