diff options
Diffstat (limited to 'packages/contracts/test/ts/multi_sig_with_time_lock.ts')
-rw-r--r-- | packages/contracts/test/ts/multi_sig_with_time_lock.ts | 36 |
1 files changed, 20 insertions, 16 deletions
diff --git a/packages/contracts/test/ts/multi_sig_with_time_lock.ts b/packages/contracts/test/ts/multi_sig_with_time_lock.ts index 6dd4dc3b2..ea939a758 100644 --- a/packages/contracts/test/ts/multi_sig_with_time_lock.ts +++ b/packages/contracts/test/ts/multi_sig_with_time_lock.ts @@ -1,18 +1,18 @@ -import {promisify} from '@0xproject/utils'; -import {BigNumber} from 'bignumber.js'; +import { RPC } from '@0xproject/dev-utils'; +import { BigNumber, promisify } from '@0xproject/utils'; import * as chai from 'chai'; import Web3 = require('web3'); import * as multiSigWalletJSON from '../../build/contracts/MultiSigWalletWithTimeLock.json'; -import {Artifacts} from '../../util/artifacts'; -import {constants} from '../../util/constants'; -import {MultiSigWrapper} from '../../util/multi_sig_wrapper'; -import {RPC} from '../../util/rpc'; -import {ContractInstance} from '../../util/types'; +import * as truffleConf from '../../truffle.js'; +import { Artifacts } from '../../util/artifacts'; +import { constants } from '../../util/constants'; +import { MultiSigWrapper } from '../../util/multi_sig_wrapper'; +import { ContractInstance } from '../../util/types'; -import {chaiSetup} from './utils/chai_setup'; +import { chaiSetup } from './utils/chai_setup'; -const {MultiSigWalletWithTimeLock} = new Artifacts(artifacts); +const { MultiSigWalletWithTimeLock } = new Artifacts(artifacts); const MULTI_SIG_ABI = (multiSigWalletJSON as any).abi; chaiSetup.configure(); @@ -38,13 +38,15 @@ contract('MultiSigWalletWithTimeLock', (accounts: string[]) => { const secondsTimeLocked = await multiSig.secondsTimeLocked.call(); initialSecondsTimeLocked = secondsTimeLocked.toNumber(); - rpc = new RPC(); + const rpcUrl = `http://${truffleConf.networks.development.host}:${truffleConf.networks.development.port}`; + rpc = new RPC(rpcUrl); }); describe('changeTimeLock', () => { it('should throw when not called by wallet', async () => { - return expect(multiSig.changeTimeLock(SECONDS_TIME_LOCKED, {from: owners[0]})) - .to.be.rejectedWith(constants.INVALID_OPCODE); + return expect(multiSig.changeTimeLock(SECONDS_TIME_LOCKED, { from: owners[0] })).to.be.rejectedWith( + constants.REVERT, + ); }); it('should throw without enough confirmations', async () => { @@ -58,11 +60,11 @@ contract('MultiSigWalletWithTimeLock', (accounts: string[]) => { const subRes = await multiSigWrapper.submitTransactionAsync(destination, from, dataParams); txId = subRes.logs[0].args.transactionId.toNumber(); - return expect(multiSig.executeTransaction(txId)).to.be.rejectedWith(constants.INVALID_OPCODE); + return expect(multiSig.executeTransaction(txId)).to.be.rejectedWith(constants.REVERT); }); it('should set confirmation time with enough confirmations', async () => { - const res = await multiSig.confirmTransaction(txId, {from: owners[1]}); + const res = await multiSig.confirmTransaction(txId, { from: owners[1] }); expect(res.logs).to.have.length(2); const blockNum = await promisify<number>(web3.eth.getBlockNumber)(); const blockInfo = await promisify<Web3.BlockWithoutTransactionData>(web3.eth.getBlock)(blockNum); @@ -94,10 +96,12 @@ contract('MultiSigWalletWithTimeLock', (accounts: string[]) => { const subRes = await multiSigWrapper.submitTransactionAsync(destination, from, dataParams); txId = subRes.logs[0].args.transactionId.toNumber(); - const confRes = await multiSig.confirmTransaction(txId, {from: owners[1]}); + const confRes = await multiSig.confirmTransaction(txId, { + from: owners[1], + }); expect(confRes.logs).to.have.length(2); - return expect(multiSig.executeTransaction(txId)).to.be.rejectedWith(constants.INVALID_OPCODE); + return expect(multiSig.executeTransaction(txId)).to.be.rejectedWith(constants.REVERT); }); it('should execute if it has enough confirmations and is past the time lock', async () => { |