Skip to content

Commit

Permalink
Consolidate test files
Browse files Browse the repository at this point in the history
  • Loading branch information
kronosapiens committed Jun 18, 2024
1 parent a4241e3 commit a5c0967
Show file tree
Hide file tree
Showing 9 changed files with 37 additions and 204 deletions.
8 changes: 4 additions & 4 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -204,7 +204,7 @@ jobs:
sed -i "s/000000000000000000000000000000deadbeef18/$(parity account new --chain ./parity-genesis.json --keys-path ./keys --password ./parityPassword)/g" ./parity-genesis.json
- run:
name: "Running gas cost tests"
command: pnpm run test:contracts:gasCosts && npx codechecks
command: pnpm run test:contracts:gas && npx codechecks
- run:
name: "Running ganache upgrade tests"
command: pnpm run test:contracts:upgrade:ganache
Expand Down Expand Up @@ -241,7 +241,7 @@ jobs:
root: ./
paths:
- coverage-contracts
coverage-test-upgrade:
coverage-test/upgrade:
<<: *job_common
steps:
- checkout
Expand Down Expand Up @@ -506,7 +506,7 @@ workflows:
context: dockerhub-credentials
- coverage-test-chainid:
context: dockerhub-credentials
- coverage-test-upgrade:
- coverage-test/upgrade:
context: dockerhub-credentials
- coverage-test-bridging:
context: dockerhub-credentials
Expand All @@ -517,5 +517,5 @@ workflows:
- coverage-test-extensions
- coverage-test-reputation
- coverage-test-chainid
- coverage-test-upgrade
- coverage-test/upgrade
- coverage-test-bridging
16 changes: 8 additions & 8 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -40,20 +40,20 @@
"pretest:contracts:extensions": "pnpm run stop:blockchain:client",
"test:contracts": "pnpm run start:blockchain:client && npx hardhat test ./test/contracts-network/* ./test/packages/* --network development",
"test:contracts:extensions": "pnpm run start:blockchain:client && npx hardhat test ./test/extensions/* --network development",
"test:contracts:upgrade:parity": "pnpm run clean:test:contracts | pnpm run start:blockchain:client parity & pnpm run generate:test:contracts && npx hardhat test ./test-upgrade/* --network integration",
"test:contracts:upgrade:ganache": "pnpm run clean:test:contracts | pnpm run start:blockchain:client ganache & pnpm run generate:test:contracts && npx hardhat test ./test-upgrade/* --network development",
"test:contracts:gasCosts": "pnpm run start:blockchain:client && npx hardhat test test-gas-costs/gasCosts.js --network development",
"test:contracts:upgrade:parity": "pnpm run clean:test:contracts | pnpm run start:blockchain:client parity & pnpm run generate:test:contracts && npx hardhat test ./test/upgrade/* --network integration",
"test:contracts:upgrade:ganache": "pnpm run clean:test:contracts | pnpm run start:blockchain:client ganache & pnpm run generate:test:contracts && npx hardhat test ./test/upgrade/* --network development",
"test:contracts:gas": "pnpm run start:blockchain:client && npx hardhat test test/misc/gas-costs.js --network development",
"test:contracts:patricia": "pnpm run start:blockchain:client ganache && npx hardhat test packages/reputation-miner/patricia-test.js --network integration",
"test:contracts:bridging:1": "CHAIN_ID_1=265669100 CHAIN_ID_2=265669101 pnpm run start:blockchain:client:both && HARDHAT_FOREIGN=false MINING_CHAIN_ID=265669100 npx hardhat test ./test/cross-chain/* --network development",
"test:contracts:bridging:2": "CHAIN_ID_1=265669101 CHAIN_ID_2=265669100 pnpm run start:blockchain:client:both && HARDHAT_FOREIGN=true MINING_CHAIN_ID=265669100 CHAIN_ID=265669101 npx hardhat test ./test/cross-chain/* --network development",
"test:contracts:chainid": "pnpm run start:blockchain:client && npx hardhat test ./test-chainid/*",
"test:contracts:e2e": "pnpm run start:blockchain:client && npx hardhat test test-system/end-to-end.js --network development",
"test:contracts:chainid": "pnpm run start:blockchain:client && npx hardhat test ./test/misc/chainid.js",
"test:contracts:e2e": "pnpm run start:blockchain:client && npx hardhat test test/misc/end-to-end.js --network development",
"test:contracts:coverage": "npx hardhat coverage --temp build-coverage --testfiles './test/contracts-network/*'",
"test:contracts:extensions:coverage": "npx hardhat compile && NODE_OPTIONS='--max-old-space-size=6144' npx hardhat coverage --solcoverjs ./.solcover.extensions.js --temp build-coverage --testfiles './test/extensions/*'",
"test:contracts:bridging:1:coverage": "CHAIN_ID=265669101 pnpm run start:blockchain:client:2 && HARDHAT_FOREIGN=false MINING_CHAIN_ID=265669100 npx hardhat --show-stack-traces coverage --solcoverjs ./.solcover.crosschain.js --temp build-coverage --testfiles './test/cross-chain/**/*'",
"test:contracts:bridging:2:coverage": "CHAIN_ID=265669100 pnpm run start:blockchain:client:2 && HARDHAT_FOREIGN=true MINING_CHAIN_ID=265669100 CHAIN_ID=265669101 npx hardhat coverage --solcoverjs ./.solcover.crosschain.js --temp build-coverage --testfiles './test/cross-chain/**/*'",
"test:contracts:chainid:coverage": "npx hardhat coverage --solcoverjs ./.solcover.chainid.js --temp build-coverage --testfiles './test-chainid/**/*'",
"test:contracts:upgrade:coverage": "pnpm run generate:test:contracts && npx hardhat coverage --solcoverjs ./.solcover.upgrade.js --temp build-coverage --testfiles './test-upgrade/*'",
"test:contracts:chainid:coverage": "npx hardhat coverage --solcoverjs ./.solcover.chainid.js --temp build-coverage --testfiles './test/misc/chainid.js'",
"test:contracts:upgrade:coverage": "pnpm run generate:test:contracts && npx hardhat coverage --solcoverjs ./.solcover.upgrade.js --temp build-coverage --testfiles './test/upgrade/*'",
"test:reputation:1": "pnpm run start:blockchain:client && npx hardhat test ./test/reputation-system/*.js --network development",
"test:reputation:2": "pnpm run start:blockchain:client && npx hardhat test ./test/reputation-system/reputation-mining-client/* --network development",
"test:reputation:1:anotherChain": "CHAIN_ID=101010101 pnpm run start:blockchain:client && MINING_CHAIN_ID=101010101 CHAIN_ID=101010101 npx hardhat test ./test/reputation-system/*.js --network development",
Expand All @@ -64,7 +64,7 @@
"posttest:contracts:extensions": "pnpm run stop:blockchain:client",
"posttest:contracts:upgrade:parity": "pnpm run clean:test:contracts | pnpm run stop:blockchain:client",
"posttest:contracts:upgrade:ganache": "pnpm run clean:test:contracts | pnpm run stop:blockchain:client",
"posttest:contracts:gasCosts": "pnpm run stop:blockchain:client",
"posttest:contracts:gas": "pnpm run stop:blockchain:client",
"posttest:contracts:patricia": "pnpm run stop:blockchain:client",
"viz:bootstrap": "pnpm run start:blockchain:client && HARDHAT_NETWORK=development npx hardhat run scripts/viz-bootstrap.js",
"kyc:bootstrap": "pnpm run start:blockchain:client && HARDHAT_NETWORK=development npx hardhat run scripts/kyc-bootstrap.js"
Expand Down
167 changes: 0 additions & 167 deletions test-smoke/colony-storage-consistent.js

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,14 @@ const bnChai = require("bn-chai");
const BN = require("bn.js");
const ethers = require("ethers");

const { setupENSRegistrar } = require("../helpers/upgradable-contracts");
const { setupENSRegistrar } = require("../../helpers/upgradable-contracts");
const {
setupColonyNetwork,
setupMetaColonyWithLockedCLNYToken,
giveUserCLNYTokens,
giveUserCLNYTokensAndStake,
unlockCLNYToken,
} = require("../helpers/test-data-generator");
} = require("../../helpers/test-data-generator");
const {
forwardTime,
getActiveRepCycle,
Expand All @@ -23,8 +23,8 @@ const {
isMainnet,
isXdai,
getChainId,
} = require("../helpers/test-helper");
const { MINING_CYCLE_DURATION, MIN_STAKE, CHALLENGE_RESPONSE_WINDOW_DURATION, WAD, DEFAULT_STAKE, XDAI_CHAINID } = require("../helpers/constants");
} = require("../../helpers/test-helper");
const { MINING_CYCLE_DURATION, MIN_STAKE, CHALLENGE_RESPONSE_WINDOW_DURATION, WAD, DEFAULT_STAKE, XDAI_CHAINID } = require("../../helpers/constants");

const { expect } = chai;
const ENSRegistry = artifacts.require("ENSRegistry");
Expand Down
12 changes: 6 additions & 6 deletions test-system/end-to-end.js → test/misc/end-to-end.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ const chai = require("chai");
const bnChai = require("bn-chai");
const ethers = require("ethers");

const { TruffleLoader } = require("../packages/package-utils");
const { TruffleLoader } = require("../../packages/package-utils");
const {
submitAndForwardTimeToDispute,
getActiveRepCycle,
Expand All @@ -16,7 +16,7 @@ const {
makeReputationValue,
removeSubdomainLimit,
getChainId,
} = require("../helpers/test-helper");
} = require("../../helpers/test-helper");

const {
giveUserCLNYTokensAndStake,
Expand All @@ -25,12 +25,12 @@ const {
setupColonyNetwork,
setupMetaColonyWithLockedCLNYToken,
setupClaimedExpenditure,
} = require("../helpers/test-data-generator");
} = require("../../helpers/test-data-generator");

const { DEFAULT_STAKE, INITIAL_FUNDING } = require("../helpers/constants");
const { DEFAULT_STAKE, INITIAL_FUNDING } = require("../../helpers/constants");

const ReputationMinerTestWrapper = require("../packages/reputation-miner/test/ReputationMinerTestWrapper");
const MaliciousReputationMinerExtraRep = require("../packages/reputation-miner/test/MaliciousReputationMinerExtraRep");
const ReputationMinerTestWrapper = require("../../packages/reputation-miner/test/ReputationMinerTestWrapper");
const MaliciousReputationMinerExtraRep = require("../../packages/reputation-miner/test/MaliciousReputationMinerExtraRep");

const { expect } = chai;
chai.use(bnChai(web3.utils.BN));
Expand Down
16 changes: 8 additions & 8 deletions test-gas-costs/gasCosts.js → test/misc/gas-costs.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ const {
INITIAL_FUNDING,
MINING_CYCLE_DURATION,
CHALLENGE_RESPONSE_WINDOW_DURATION,
} = require("../helpers/constants");
} = require("../../helpers/constants");

const {
getTokenArgs,
Expand All @@ -27,14 +27,14 @@ const {
advanceMiningCycleNoContest,
submitAndForwardTimeToDispute,
accommodateChallengeAndInvalidateHash,
} = require("../helpers/test-helper");
} = require("../../helpers/test-helper");

const { giveUserCLNYTokensAndStake, fundColonyWithTokens, setupRandomColony } = require("../helpers/test-data-generator");
const { giveUserCLNYTokensAndStake, fundColonyWithTokens, setupRandomColony } = require("../../helpers/test-data-generator");

const { TruffleLoader } = require("../packages/package-utils");
const PatriciaTree = require("../packages/reputation-miner/patricia");
const ReputationMinerTestWrapper = require("../packages/reputation-miner/test/ReputationMinerTestWrapper");
const MaliciousReputationMinerExtraRep = require("../packages/reputation-miner/test/MaliciousReputationMinerExtraRep");
const { TruffleLoader } = require("../../packages/package-utils");
const PatriciaTree = require("../../packages/reputation-miner/patricia");
const ReputationMinerTestWrapper = require("../../packages/reputation-miner/test/ReputationMinerTestWrapper");
const MaliciousReputationMinerExtraRep = require("../../packages/reputation-miner/test/MaliciousReputationMinerExtraRep");

const Token = artifacts.require("Token");
const IColony = artifacts.require("IColony");
Expand All @@ -50,7 +50,7 @@ const IVotingReputation = artifacts.require("IVotingReputation");
const REAL_PROVIDER_PORT = 8545;

const contractLoader = new TruffleLoader({
contractRoot: path.resolve(__dirname, "..", "artifacts", "contracts"),
contractRoot: path.resolve(__dirname, "..", "..", "artifacts", "contracts"),
});

contract("All", function (accounts) {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/* globals artifacts */
const { setupRandomColony } = require("../helpers/test-data-generator");
const { setupRandomColony } = require("../../helpers/test-data-generator");

const IColonyNetwork = artifacts.require("IColonyNetwork");
const EtherRouter = artifacts.require("EtherRouter");
Expand Down
Loading

0 comments on commit a5c0967

Please sign in to comment.