Update order-watcher to use new migrations functions
This commit is contained in:
		@@ -1,7 +1,6 @@
 | 
				
			|||||||
import { tokenUtils } from '@0xproject/contract-wrappers/lib/test/utils/token_utils';
 | 
					import { tokenUtils } from '@0xproject/contract-wrappers/lib/test/utils/token_utils';
 | 
				
			||||||
import { BlockchainLifecycle, callbackErrorReporter } from '@0xproject/dev-utils';
 | 
					import { BlockchainLifecycle, callbackErrorReporter } from '@0xproject/dev-utils';
 | 
				
			||||||
import { FillScenarios } from '@0xproject/fill-scenarios';
 | 
					import { FillScenarios } from '@0xproject/fill-scenarios';
 | 
				
			||||||
import { getContractAddresses } from '@0xproject/migrations';
 | 
					 | 
				
			||||||
import { assetDataUtils, orderHashUtils } from '@0xproject/order-utils';
 | 
					import { assetDataUtils, orderHashUtils } from '@0xproject/order-utils';
 | 
				
			||||||
import { DoneCallback } from '@0xproject/types';
 | 
					import { DoneCallback } from '@0xproject/types';
 | 
				
			||||||
import { BigNumber } from '@0xproject/utils';
 | 
					import { BigNumber } from '@0xproject/utils';
 | 
				
			||||||
@@ -14,6 +13,7 @@ import { ExpirationWatcher } from '../src/order_watcher/expiration_watcher';
 | 
				
			|||||||
import { utils } from '../src/utils/utils';
 | 
					import { utils } from '../src/utils/utils';
 | 
				
			||||||
 | 
					
 | 
				
			||||||
import { chaiSetup } from './utils/chai_setup';
 | 
					import { chaiSetup } from './utils/chai_setup';
 | 
				
			||||||
 | 
					import { migrateOnceAsync } from './utils/migrate';
 | 
				
			||||||
import { provider, web3Wrapper } from './utils/web3_wrapper';
 | 
					import { provider, web3Wrapper } from './utils/web3_wrapper';
 | 
				
			||||||
 | 
					
 | 
				
			||||||
chaiSetup.configure();
 | 
					chaiSetup.configure();
 | 
				
			||||||
@@ -35,8 +35,8 @@ describe('ExpirationWatcher', () => {
 | 
				
			|||||||
    let timer: Sinon.SinonFakeTimers;
 | 
					    let timer: Sinon.SinonFakeTimers;
 | 
				
			||||||
    let expirationWatcher: ExpirationWatcher;
 | 
					    let expirationWatcher: ExpirationWatcher;
 | 
				
			||||||
    before(async () => {
 | 
					    before(async () => {
 | 
				
			||||||
 | 
					        const contractAddresses = await migrateOnceAsync();
 | 
				
			||||||
        await blockchainLifecycle.startAsync();
 | 
					        await blockchainLifecycle.startAsync();
 | 
				
			||||||
        const contractAddresses = getContractAddresses();
 | 
					 | 
				
			||||||
        userAddresses = await web3Wrapper.getAvailableAddressesAsync();
 | 
					        userAddresses = await web3Wrapper.getAvailableAddressesAsync();
 | 
				
			||||||
        fillScenarios = new FillScenarios(
 | 
					        fillScenarios = new FillScenarios(
 | 
				
			||||||
            provider,
 | 
					            provider,
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -1,16 +1,6 @@
 | 
				
			|||||||
import { devConstants } from '@0xproject/dev-utils';
 | 
					before('set up mocha', async function(): Promise<void> {
 | 
				
			||||||
import { runMigrationsAsync } from '@0xproject/migrations';
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
import { provider } from './utils/web3_wrapper';
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
before('migrate contracts', async function(): Promise<void> {
 | 
					 | 
				
			||||||
    // HACK: Since the migrations take longer then our global mocha timeout limit
 | 
					    // HACK: Since the migrations take longer then our global mocha timeout limit
 | 
				
			||||||
    // we manually increase it for this before hook.
 | 
					    // we manually increase it for this before hook.
 | 
				
			||||||
    const mochaTestTimeoutMs = 25000;
 | 
					    const mochaTestTimeoutMs = 25000;
 | 
				
			||||||
    this.timeout(mochaTestTimeoutMs); // tslint:disable-line:no-invalid-this
 | 
					    this.timeout(mochaTestTimeoutMs); // tslint:disable-line:no-invalid-this
 | 
				
			||||||
    const txDefaults = {
 | 
					 | 
				
			||||||
        gas: devConstants.GAS_LIMIT,
 | 
					 | 
				
			||||||
        from: devConstants.TESTRPC_FIRST_ADDRESS,
 | 
					 | 
				
			||||||
    };
 | 
					 | 
				
			||||||
    await runMigrationsAsync(provider, txDefaults);
 | 
					 | 
				
			||||||
});
 | 
					});
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -3,7 +3,6 @@ import { ContractWrappers } from '@0xproject/contract-wrappers';
 | 
				
			|||||||
import { tokenUtils } from '@0xproject/contract-wrappers/lib/test/utils/token_utils';
 | 
					import { tokenUtils } from '@0xproject/contract-wrappers/lib/test/utils/token_utils';
 | 
				
			||||||
import { BlockchainLifecycle, callbackErrorReporter } from '@0xproject/dev-utils';
 | 
					import { BlockchainLifecycle, callbackErrorReporter } from '@0xproject/dev-utils';
 | 
				
			||||||
import { FillScenarios } from '@0xproject/fill-scenarios';
 | 
					import { FillScenarios } from '@0xproject/fill-scenarios';
 | 
				
			||||||
import { getContractAddresses } from '@0xproject/migrations';
 | 
					 | 
				
			||||||
import { assetDataUtils, orderHashUtils } from '@0xproject/order-utils';
 | 
					import { assetDataUtils, orderHashUtils } from '@0xproject/order-utils';
 | 
				
			||||||
import {
 | 
					import {
 | 
				
			||||||
    DoneCallback,
 | 
					    DoneCallback,
 | 
				
			||||||
@@ -28,6 +27,7 @@ import { OrderWatcherError } from '../src/types';
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
import { chaiSetup } from './utils/chai_setup';
 | 
					import { chaiSetup } from './utils/chai_setup';
 | 
				
			||||||
import { constants } from './utils/constants';
 | 
					import { constants } from './utils/constants';
 | 
				
			||||||
 | 
					import { migrateOnceAsync } from './utils/migrate';
 | 
				
			||||||
import { provider, web3Wrapper } from './utils/web3_wrapper';
 | 
					import { provider, web3Wrapper } from './utils/web3_wrapper';
 | 
				
			||||||
 | 
					
 | 
				
			||||||
const TIMEOUT_MS = 150;
 | 
					const TIMEOUT_MS = 150;
 | 
				
			||||||
@@ -54,9 +54,9 @@ describe('OrderWatcher', () => {
 | 
				
			|||||||
    const decimals = constants.ZRX_DECIMALS;
 | 
					    const decimals = constants.ZRX_DECIMALS;
 | 
				
			||||||
    const fillableAmount = Web3Wrapper.toBaseUnitAmount(new BigNumber(5), decimals);
 | 
					    const fillableAmount = Web3Wrapper.toBaseUnitAmount(new BigNumber(5), decimals);
 | 
				
			||||||
    before(async () => {
 | 
					    before(async () => {
 | 
				
			||||||
 | 
					        const contractAddresses = await migrateOnceAsync();
 | 
				
			||||||
        await blockchainLifecycle.startAsync();
 | 
					        await blockchainLifecycle.startAsync();
 | 
				
			||||||
        const networkId = constants.TESTRPC_NETWORK_ID;
 | 
					        const networkId = constants.TESTRPC_NETWORK_ID;
 | 
				
			||||||
        const contractAddresses = getContractAddresses();
 | 
					 | 
				
			||||||
        const config = {
 | 
					        const config = {
 | 
				
			||||||
            networkId,
 | 
					            networkId,
 | 
				
			||||||
            contractAddresses,
 | 
					            contractAddresses,
 | 
				
			||||||
 
 | 
				
			|||||||
							
								
								
									
										13
									
								
								packages/order-watcher/test/utils/migrate.ts
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										13
									
								
								packages/order-watcher/test/utils/migrate.ts
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,13 @@
 | 
				
			|||||||
 | 
					import { devConstants } from '@0xproject/dev-utils';
 | 
				
			||||||
 | 
					import { runMigrationsOnceAsync } from '@0xproject/migrations';
 | 
				
			||||||
 | 
					import { ContractAddresses } from '@0xproject/types';
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					import { provider } from './web3_wrapper';
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					export async function migrateOnceAsync(): Promise<ContractAddresses> {
 | 
				
			||||||
 | 
					    const txDefaults = {
 | 
				
			||||||
 | 
					        gas: devConstants.GAS_LIMIT,
 | 
				
			||||||
 | 
					        from: devConstants.TESTRPC_FIRST_ADDRESS,
 | 
				
			||||||
 | 
					    };
 | 
				
			||||||
 | 
					    return runMigrationsOnceAsync(provider, txDefaults);
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
		Reference in New Issue
	
	Block a user