From 907f74c26b682e974318a9317943f24a197c6a13 Mon Sep 17 00:00:00 2001 From: Alex Rea Date: Wed, 8 Nov 2023 10:29:05 +0000 Subject: [PATCH] Tweak setupColony --- helpers/test-data-generator.js | 4 ++-- test/contracts-network/colony.js | 15 ++++++++------- 2 files changed, 10 insertions(+), 9 deletions(-) diff --git a/helpers/test-data-generator.js b/helpers/test-data-generator.js index 1d7df2a46d..b55b3d8c58 100644 --- a/helpers/test-data-generator.js +++ b/helpers/test-data-generator.js @@ -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; diff --git a/test/contracts-network/colony.js b/test/contracts-network/colony.js index d17148184b..0328433b3f 100755 --- a/test/contracts-network/colony.js +++ b/test/contracts-network/colony.js @@ -6,7 +6,13 @@ 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; @@ -14,7 +20,6 @@ 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"); @@ -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]);