aboutsummaryrefslogtreecommitdiffstats
path: root/packages/contracts
diff options
context:
space:
mode:
authorLeonid Logvinov <logvinov.leon@gmail.com>2018-01-19 21:07:00 +0800
committerLeonid Logvinov <logvinov.leon@gmail.com>2018-01-30 23:01:36 +0800
commiteb881b9729374c3eedb4914e5293535e890296af (patch)
treeeabdf68984ec747057cd07a74eaaf4ec8816d177 /packages/contracts
parent091ba473ff83ebd3239273b8e40671b9ccab5f47 (diff)
downloaddexon-sol-tools-eb881b9729374c3eedb4914e5293535e890296af.tar
dexon-sol-tools-eb881b9729374c3eedb4914e5293535e890296af.tar.gz
dexon-sol-tools-eb881b9729374c3eedb4914e5293535e890296af.tar.bz2
dexon-sol-tools-eb881b9729374c3eedb4914e5293535e890296af.tar.lz
dexon-sol-tools-eb881b9729374c3eedb4914e5293535e890296af.tar.xz
dexon-sol-tools-eb881b9729374c3eedb4914e5293535e890296af.tar.zst
dexon-sol-tools-eb881b9729374c3eedb4914e5293535e890296af.zip
Remove truffle from MultiSigWalletWithTimeLockExceptRemoveAuthAddr tests
Diffstat (limited to 'packages/contracts')
-rw-r--r--packages/contracts/test/ether_token.ts2
-rw-r--r--packages/contracts/test/multi_sig_with_time_lock_except_remove_auth_addr.ts44
2 files changed, 32 insertions, 14 deletions
diff --git a/packages/contracts/test/ether_token.ts b/packages/contracts/test/ether_token.ts
index a5a97a60a..e46d93fe6 100644
--- a/packages/contracts/test/ether_token.ts
+++ b/packages/contracts/test/ether_token.ts
@@ -20,7 +20,7 @@ const expect = chai.expect;
const web3: Web3 = (global as any).web3;
const blockchainLifecycle = new BlockchainLifecycle(constants.RPC_URL);
-describe.only('EtherToken', () => {
+describe('EtherToken', () => {
const web3Wrapper = new Web3Wrapper(web3.currentProvider);
let accounts: string[];
let account: string;
diff --git a/packages/contracts/test/multi_sig_with_time_lock_except_remove_auth_addr.ts b/packages/contracts/test/multi_sig_with_time_lock_except_remove_auth_addr.ts
index 82115418e..27b885438 100644
--- a/packages/contracts/test/multi_sig_with_time_lock_except_remove_auth_addr.ts
+++ b/packages/contracts/test/multi_sig_with_time_lock_except_remove_auth_addr.ts
@@ -1,4 +1,7 @@
+import { BlockchainLifecycle } from '@0xproject/dev-utils';
+import { Web3Wrapper } from '@0xproject/web3-wrapper';
import * as chai from 'chai';
+import * as Web3 from 'web3';
import * as tokenTransferProxyJSON from '../../build/contracts/TokenTransferProxy.json';
import { Artifacts } from '../util/artifacts';
@@ -13,29 +16,38 @@ const PROXY_ABI = (tokenTransferProxyJSON as any).abi;
chaiSetup.configure();
const expect = chai.expect;
-
-contract('MultiSigWalletWithTimeLockExceptRemoveAuthorizedAddress', (accounts: string[]) => {
- const owners = [accounts[0], accounts[1]];
+// In order to benefit from type-safety, we re-assign the global web3 instance injected by Truffle
+// with type `any` to a variable of type `Web3`.
+const web3: Web3 = (global as any).web3;
+const blockchainLifecycle = new BlockchainLifecycle(constants.RPC_URL);
+
+describe('MultiSigWalletWithTimeLockExceptRemoveAuthorizedAddress', () => {
+ const web3Wrapper = new Web3Wrapper(web3.currentProvider);
+ let accounts: string[];
+ let owners: string[];
const requiredApprovals = 2;
const SECONDS_TIME_LOCKED = 1000000;
// initialize fake addresses
- const authorizedAddress = `0x${crypto
- .solSHA3([accounts[0]])
- .slice(0, 20)
- .toString('hex')}`;
- const unauthorizedAddress = `0x${crypto
- .solSHA3([accounts[1]])
- .slice(0, 20)
- .toString('hex')}`;
+ let authorizedAddress: string;
+ let unauthorizedAddress: string;
let tokenTransferProxy: ContractInstance;
let multiSig: ContractInstance;
let multiSigWrapper: MultiSigWrapper;
let validDestination: string;
-
- beforeEach(async () => {
+ before(async () => {
+ accounts = await web3Wrapper.getAvailableAddressesAsync();
+ owners = [accounts[0], accounts[1]];
+ authorizedAddress = `0x${crypto
+ .solSHA3([accounts[0]])
+ .slice(0, 20)
+ .toString('hex')}`;
+ unauthorizedAddress = `0x${crypto
+ .solSHA3([accounts[1]])
+ .slice(0, 20)
+ .toString('hex')}`;
const initialOwner = accounts[0];
tokenTransferProxy = await TokenTransferProxy.new({ from: initialOwner });
await tokenTransferProxy.addAuthorizedAddress(authorizedAddress, {
@@ -53,6 +65,12 @@ contract('MultiSigWalletWithTimeLockExceptRemoveAuthorizedAddress', (accounts: s
multiSigWrapper = new MultiSigWrapper(multiSig);
validDestination = tokenTransferProxy.address;
});
+ beforeEach(async () => {
+ await blockchainLifecycle.startAsync();
+ });
+ afterEach(async () => {
+ await blockchainLifecycle.revertAsync();
+ });
describe('isFunctionRemoveAuthorizedAddress', () => {
it('should throw if data is not for removeAuthorizedAddress', async () => {