Skip to content

Commit

Permalink
split integration tests into multiple files
Browse files Browse the repository at this point in the history
  • Loading branch information
xklob committed Oct 13, 2021
1 parent 211eea8 commit 9660a67
Show file tree
Hide file tree
Showing 9 changed files with 1,805 additions and 1,607 deletions.
5 changes: 2 additions & 3 deletions hardhat.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ import 'solidity-coverage';
import 'tsconfig-paths/register';

import * as dotenv from 'dotenv';
import { ethers } from 'ethers';

dotenv.config();

Expand Down Expand Up @@ -54,7 +53,7 @@ export default {
chainId: 5777, // Any network (default: none)
forking: enableMainnetForking
? {
url: `https://eth-mainnet.alchemyapi.io/v2/${mainnetAlchemyApiKey}`,
url: `https://eth-mainnet.alchemyapi.io/v2/${mainnetAlchemyApiKey}`
//blockNumber: <set>
}
: undefined
Expand Down Expand Up @@ -116,4 +115,4 @@ export default {
governor: '0x0BEF27FEB58e857046d630B2c03dFb7bae567494',
votingToken: '0xc7283b66Eb1EB5FB86327f08e1B5816b0720212B'
}
} as HardhatUserConfig;
} as HardhatUserConfig;
16 changes: 14 additions & 2 deletions test/helpers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import chai from 'chai';
import CBN from 'chai-bn';
import { Core, Core__factory } from '@custom-types/contracts';
import { BigNumberish, Signer } from 'ethers';
import { env } from 'process';

// use default BigNumber
chai.use(CBN(ethers.BigNumber));
Expand Down Expand Up @@ -70,9 +71,19 @@ async function increaseTime(amount: number) {
}

async function resetTime() {
await resetFork();
}

async function resetFork() {
await hre.network.provider.request({
method: 'hardhat_reset',
params: []
params: [
{
forking: {
jsonRpcUrl: hre.config.networks.hardhat.forking.url
}
}
]
});
}

Expand Down Expand Up @@ -215,5 +226,6 @@ export {
deployDevelopmentWeth,
getImpersonatedSigner,
setNextBlockTimestamp,
resetTime
resetTime,
resetFork
};
Loading

0 comments on commit 9660a67

Please sign in to comment.