This repository has been archived by the owner on Sep 22, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
7 changed files
with
70 additions
and
18 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
import '@nomiclabs/hardhat-ethers'; | ||
import '../../../src/index'; | ||
|
||
export default { | ||
solidity: "0.7.3", | ||
networks: { | ||
hardhat: { | ||
chainId: 1, | ||
} | ||
} | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
import { resetHardhatContext } from 'hardhat/plugins-testing'; | ||
import { HardhatRuntimeEnvironment } from 'hardhat/types'; | ||
import path from 'path'; | ||
|
||
declare module 'mocha' { | ||
interface Context { | ||
env: HardhatRuntimeEnvironment; | ||
} | ||
} | ||
|
||
export function useEnvironment(fixtureProjectName: string, networkName = 'hardhat'): void { | ||
beforeEach('Loading hardhat environment', async function () { | ||
process.chdir(path.join(__dirname, 'fixture-projects', fixtureProjectName)); | ||
process.env.HARDHAT_NETWORK = networkName; | ||
|
||
this.env = require('hardhat'); | ||
}); | ||
|
||
afterEach('Resetting hardhat', function () { | ||
resetHardhatContext(); | ||
}); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
--require ts-node/register | ||
--require source-map-support/register | ||
--recursive test/**/*.test.ts | ||
--timeout 10000 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,21 @@ | ||
// import { assert } from 'chai'; | ||
import { assert } from 'chai'; | ||
|
||
describe("Integration tests examples", function () { | ||
describe("Hardhat Runtime Environment extension", function () { | ||
it("should get some tests later"); | ||
import { useEnvironment } from './helpers'; | ||
|
||
describe('Integration tests', function () { | ||
describe('Hardhat Runtime Environment extension', function () { | ||
useEnvironment('hardhat-project'); | ||
|
||
// EIP-2470 Deployer has pretty short ABI, and is deployed on most networks | ||
const testAddress = '0xce0042B868300000d44A59004Da54A005ffdcf9f'; | ||
const testABI = 'function deploy(bytes _initCode, bytes32 _salt) returns (address createdContract) @8500000'; | ||
|
||
it('should get the Contract ABI from Etherscan', async function () { | ||
// @ts-ignore | ||
const contract = await this.env.ethers.getVerifiedContractAt(testAddress); | ||
const abi = contract.interface.format() | ||
assert.equal(abi.length, 1); | ||
assert.equal(abi[0], testABI); | ||
}); | ||
}); | ||
}); |