Remove deployer from metacoin and contract tests

This commit is contained in:
Leonid Logvinov
2018-05-07 22:11:09 +02:00
parent c64ad1af28
commit 3d58b38e4e
28 changed files with 406 additions and 204 deletions

4
packages/metacoin/src/global.d.ts vendored Normal file
View File

@@ -0,0 +1,4 @@
declare module '*.json' {
const value: any;
export default value;
}

View File

@@ -1,15 +1,19 @@
import { ContractArtifact } from '@0xproject/deployer';
import { BlockchainLifecycle, devConstants } from '@0xproject/dev-utils';
import { LogWithDecodedArgs } from '@0xproject/types';
import { BigNumber } from '@0xproject/utils';
import { Web3Wrapper } from '@0xproject/web3-wrapper';
import * as chai from 'chai';
import * as MetacoinArtifact from '../artifacts/Metacoin.json';
import { MetacoinContract, TransferContractEventArgs } from '../src/contract_wrappers/metacoin';
import { chaiSetup } from './utils/chai_setup';
import { deployer } from './utils/deployer';
import { config } from './utils/config';
import { provider, web3Wrapper } from './utils/web3_wrapper';
const artifact: ContractArtifact = MetacoinArtifact as any;
chaiSetup.configure();
const { expect } = chai;
const blockchainLifecycle = new BlockchainLifecycle(web3Wrapper);
@@ -19,9 +23,8 @@ describe('Metacoin', () => {
const ownerAddress = devConstants.TESTRPC_FIRST_ADDRESS;
const INITIAL_BALANCE = new BigNumber(10000);
before(async () => {
const metacoinInstance = await deployer.deployAsync('Metacoin');
web3Wrapper.abiDecoder.addABI(metacoinInstance.abi);
metacoin = new MetacoinContract(metacoinInstance.abi, metacoinInstance.address, provider);
metacoin = await MetacoinContract.deploy0xArtifactAsync(artifact, provider, config.defaults);
web3Wrapper.abiDecoder.addABI(metacoin.abi);
});
beforeEach(async () => {
await blockchainLifecycle.startAsync();

View File

@@ -1,3 +1,4 @@
import { devConstants } from '@0xproject/dev-utils';
import * as path from 'path';
export const config = {
@@ -5,5 +6,8 @@ export const config = {
artifactsDir: path.resolve(__dirname, '../../artifacts'),
contractsDir: path.resolve(__dirname, '../../contracts'),
ganacheLogFile: 'ganache.log',
defaults: {
from: devConstants.TESTRPC_FIRST_ADDRESS,
},
mnemonic: 'concert load couple harbor equip island argue ramp clarify fence smart topic',
};

View File

@@ -1,17 +0,0 @@
import { Deployer } from '@0xproject/deployer';
import { devConstants } from '@0xproject/dev-utils';
import * as path from 'path';
import { config } from './config';
import { web3Wrapper } from './web3_wrapper';
const deployerOpts = {
provider: web3Wrapper.getProvider(),
artifactsDir: config.artifactsDir,
networkId: config.networkId,
defaults: {
from: devConstants.TESTRPC_FIRST_ADDRESS,
},
};
export const deployer = new Deployer(deployerOpts);