aboutsummaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorLeonid Logvinov <logvinov.leon@gmail.com>2017-06-23 05:36:43 +0800
committerLeonid Logvinov <logvinov.leon@gmail.com>2017-06-23 05:36:43 +0800
commitdcd08e40e61f5d98f03d71dc588e379f44817758 (patch)
treefb9924f67479a4d4fc3d0facb0ad9e8fef096bfa /test
parent438b82183514322d696bfcbae53f4eae4cda0bcf (diff)
downloaddexon-sol-tools-dcd08e40e61f5d98f03d71dc588e379f44817758.tar
dexon-sol-tools-dcd08e40e61f5d98f03d71dc588e379f44817758.tar.gz
dexon-sol-tools-dcd08e40e61f5d98f03d71dc588e379f44817758.tar.bz2
dexon-sol-tools-dcd08e40e61f5d98f03d71dc588e379f44817758.tar.lz
dexon-sol-tools-dcd08e40e61f5d98f03d71dc588e379f44817758.tar.xz
dexon-sol-tools-dcd08e40e61f5d98f03d71dc588e379f44817758.tar.zst
dexon-sol-tools-dcd08e40e61f5d98f03d71dc588e379f44817758.zip
Add kovan integration tests
Diffstat (limited to 'test')
-rw-r--r--test/artifacts_test.ts54
1 files changed, 54 insertions, 0 deletions
diff --git a/test/artifacts_test.ts b/test/artifacts_test.ts
new file mode 100644
index 000000000..937d2674d
--- /dev/null
+++ b/test/artifacts_test.ts
@@ -0,0 +1,54 @@
+import * as _ from 'lodash';
+import * as chai from 'chai';
+import * as BigNumber from 'bignumber.js';
+import HDWalletProvider = require('truffle-hdwallet-provider');
+import {chaiSetup} from './utils/chai_setup';
+import {ZeroEx, Order} from '../src';
+import {web3Factory} from './utils/web3_factory';
+import {FillScenarios} from './utils/fill_scenarios';
+
+chaiSetup.configure();
+const expect = chai.expect;
+
+// Those tests are slower cause they're talking to a remote node
+const TIMEOUT = 10000;
+
+describe('Artifacts', () => {
+ describe('contracts are deployed on kovan', () => {
+ const kovanRpcUrl = 'https://kovan.0xproject.com';
+ const mnemonic = 'concert load couple harbor equip island argue ramp clarify fence smart topic';
+ const web3Provider = new HDWalletProvider(mnemonic, kovanRpcUrl);
+ const zeroEx = new ZeroEx(web3Provider);
+ it('token registry contract is deployed', async () => {
+ const tokens = await zeroEx.tokenRegistry.getTokensAsync();
+ }).timeout(TIMEOUT);
+ it('proxy contract is deployed', async () => {
+ const [token] = await zeroEx.tokenRegistry.getTokensAsync();
+ const allowance = await zeroEx.token.getProxyAllowanceAsync(token.address, ZeroEx.NULL_ADDRESS);
+ expect(allowance).to.be.bignumber.equal(0);
+ }).timeout(TIMEOUT);
+ it('exchange contract is deployed', async () => {
+ const userAddreses = await zeroEx.getAvailableAddressesAsync();
+ const tokens = await zeroEx.tokenRegistry.getTokensAsync();
+ const makerTokenAddress = tokens[0].address;
+ const takerTokenAddress = tokens[1].address;
+ // Unused anyway
+ const zrxTokenAddress = ZeroEx.NULL_ADDRESS;
+ const fillScenarios = new FillScenarios(zeroEx, userAddreses, tokens, zrxTokenAddress);
+ const order: Order = {
+ maker: userAddreses[0],
+ taker: userAddreses[0],
+ makerFee: new BigNumber(0),
+ takerFee: new BigNumber(0),
+ makerTokenAmount: new BigNumber(0),
+ takerTokenAmount: new BigNumber(0),
+ makerTokenAddress,
+ takerTokenAddress,
+ salt: ZeroEx.generatePseudoRandomSalt(),
+ feeRecipient: ZeroEx.NULL_ADDRESS,
+ expirationUnixTimestampSec: new BigNumber(2524604400),
+ };
+ const orderHash = await zeroEx.getOrderHashHexAsync(order);
+ }).timeout(TIMEOUT);
+ });
+});