aboutsummaryrefslogtreecommitdiffstats
path: root/packages/contracts
diff options
context:
space:
mode:
authorLeonid Logvinov <logvinov.leon@gmail.com>2018-01-19 21:25:18 +0800
committerLeonid Logvinov <logvinov.leon@gmail.com>2018-01-30 23:01:36 +0800
commit8269610a5c16cebda268c2497fae0adf692e4838 (patch)
treeb428e7bb9741d7a4c5a7170face23a128fc90143 /packages/contracts
parent20c88a46d9d87835bd9ddc30374309d615a9cf9f (diff)
downloaddexon-sol-tools-8269610a5c16cebda268c2497fae0adf692e4838.tar.gz
dexon-sol-tools-8269610a5c16cebda268c2497fae0adf692e4838.tar.zst
dexon-sol-tools-8269610a5c16cebda268c2497fae0adf692e4838.zip
Remove truffle from UnlimitedAllowanceToken tests
Diffstat (limited to 'packages/contracts')
-rw-r--r--packages/contracts/test/multi_sig_with_time_lock.ts7
-rw-r--r--packages/contracts/test/unlimited_allowance_token.ts24
2 files changed, 26 insertions, 5 deletions
diff --git a/packages/contracts/test/multi_sig_with_time_lock.ts b/packages/contracts/test/multi_sig_with_time_lock.ts
index d41aae38b..03914786c 100644
--- a/packages/contracts/test/multi_sig_with_time_lock.ts
+++ b/packages/contracts/test/multi_sig_with_time_lock.ts
@@ -22,6 +22,7 @@ const expect = chai.expect;
// 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('MultiSigWalletWithTimeLock', () => {
const web3Wrapper = new Web3Wrapper(web3.currentProvider);
@@ -47,6 +48,12 @@ describe('MultiSigWalletWithTimeLock', () => {
const rpcUrl = `http://${truffleConf.networks.development.host}:${truffleConf.networks.development.port}`;
rpc = new RPC(rpcUrl);
});
+ beforeEach(async () => {
+ await blockchainLifecycle.startAsync();
+ });
+ afterEach(async () => {
+ await blockchainLifecycle.revertAsync();
+ });
describe('changeTimeLock', () => {
it('should throw when not called by wallet', async () => {
diff --git a/packages/contracts/test/unlimited_allowance_token.ts b/packages/contracts/test/unlimited_allowance_token.ts
index 1b8abd510..ca8ce4c50 100644
--- a/packages/contracts/test/unlimited_allowance_token.ts
+++ b/packages/contracts/test/unlimited_allowance_token.ts
@@ -1,5 +1,7 @@
import { ZeroEx } from '0x.js';
+import { BlockchainLifecycle } from '@0xproject/dev-utils';
import { BigNumber } from '@0xproject/utils';
+import { Web3Wrapper } from '@0xproject/web3-wrapper';
import * as chai from 'chai';
import * as Web3 from 'web3';
@@ -10,28 +12,40 @@ import { ContractInstance } from '../util/types';
import { chaiSetup } from './utils/chai_setup';
const { DummyToken } = new Artifacts(artifacts);
+// 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;
chaiSetup.configure();
const expect = chai.expect;
+const blockchainLifecycle = new BlockchainLifecycle(constants.RPC_URL);
-contract('UnlimitedAllowanceToken', (accounts: string[]) => {
+describe('UnlimitedAllowanceToken', () => {
+ const web3Wrapper = new Web3Wrapper(web3.currentProvider);
+ let owner: string;
+ let spender: string;
const config = {
networkId: constants.TESTRPC_NETWORK_ID,
};
const zeroEx = new ZeroEx(web3.currentProvider, config);
- const owner = accounts[0];
- const spender = accounts[1];
const MAX_MINT_VALUE = new BigNumber(100000000000000000000);
let tokenAddress: string;
let token: ContractInstance;
- beforeEach(async () => {
+ before(async () => {
+ const accounts = await web3Wrapper.getAvailableAddressesAsync();
+ owner = accounts[0];
+ spender = accounts[1];
token = await DummyToken.new({ from: owner });
await token.mint(MAX_MINT_VALUE, { from: owner });
tokenAddress = token.address;
});
-
+ beforeEach(async () => {
+ await blockchainLifecycle.startAsync();
+ });
+ afterEach(async () => {
+ await blockchainLifecycle.revertAsync();
+ });
describe('transfer', () => {
it('should transfer balance from sender to receiver', async () => {
const receiver = spender;