Skip to content

Commit

Permalink
Tweak setupColony
Browse files Browse the repository at this point in the history
  • Loading branch information
area committed Nov 8, 2023
1 parent 97734f0 commit 907f74c
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 9 deletions.
4 changes: 2 additions & 2 deletions helpers/test-data-generator.js
Original file line number Diff line number Diff line change
Expand Up @@ -289,8 +289,8 @@ exports.setupRandomColony = async function setupRandomColony(colonyNetwork, lock
return { colony, token };
};

exports.setupColony = async function setupColony(colonyNetwork, tokenAddress) {
const { logs } = await colonyNetwork.createColony(tokenAddress, 0, "", "");
exports.setupColony = async function setupColony(colonyNetwork, tokenAddress, version = 0) {
const { logs } = await colonyNetwork.createColony(tokenAddress, version, "", "");
const { colonyAddress } = logs.filter((x) => x.event === "ColonyAdded")[0].args;
const colony = await IColony.at(colonyAddress);
return colony;
Expand Down
15 changes: 8 additions & 7 deletions test/contracts-network/colony.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,20 @@ const { ethers } = require("ethers");

const { IPFS_HASH, UINT256_MAX, WAD, ADDRESS_ZERO, SPECIFICATION_HASH, GLOBAL_SKILL_ID, HASHZERO } = require("../../helpers/constants");
const { getTokenArgs, web3GetBalance, checkErrorRevert, expectNoEvent, expectAllEvents, expectEvent } = require("../../helpers/test-helper");
const { setupRandomColony, getMetaTransactionParameters, makeExpenditure, fundColonyWithTokens } = require("../../helpers/test-data-generator");
const {
setupRandomColony,
getMetaTransactionParameters,
makeExpenditure,
fundColonyWithTokens,
setupColony,
} = require("../../helpers/test-data-generator");
const { deployOldColonyVersion } = require("../../scripts/deployOldUpgradeableVersion");

const { expect } = chai;
chai.use(bnChai(web3.utils.BN));

const EtherRouter = artifacts.require("EtherRouter");
const IColonyNetwork = artifacts.require("IColonyNetwork");
const IColony = artifacts.require("IColony");
const TokenAuthority = artifacts.require("TokenAuthority");
const IReputationMiningCycle = artifacts.require("IReputationMiningCycle");
const TransferTest = artifacts.require("TransferTest");
Expand Down Expand Up @@ -436,11 +441,7 @@ contract("Colony", (accounts) => {
});

beforeEach(async () => {
await colonyNetwork.createColony(token.address, 13, "", "");

const colonyIdx = await colonyNetwork.getColonyCount();
const colonyAddress = await colonyNetwork.getColony(colonyIdx);
colony = await IColony.at(colonyAddress);
colony = await setupColony(colonyNetwork, token.address, 13);

const tokenLockingAddress = await colonyNetwork.getTokenLocking();
const tokenAuthority = await TokenAuthority.new(token.address, colony.address, [tokenLockingAddress]);
Expand Down

0 comments on commit 907f74c

Please sign in to comment.