diff options
author | Leonid <logvinov.leon@gmail.com> | 2017-06-23 23:17:06 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-06-23 23:17:06 +0800 |
commit | d5ed5865ca7ca5697795896d1853e313093d327a (patch) | |
tree | 603aa56a29cfe7e52d50ed372c422e561cab2b0c | |
parent | 0c5ba2a68e7f8b1aa2d7138022749976a751a374 (diff) | |
parent | 75ae305a6e95a775497c971b4d40c1757abba25f (diff) | |
download | dexon-0x-contracts-d5ed5865ca7ca5697795896d1853e313093d327a.tar.gz dexon-0x-contracts-d5ed5865ca7ca5697795896d1853e313093d327a.tar.zst dexon-0x-contracts-d5ed5865ca7ca5697795896d1853e313093d327a.zip |
Merge pull request #79 from 0xProject/integration-tests
Add kovan integration tests
-rw-r--r-- | package.json | 1 | ||||
-rw-r--r-- | src/globals.d.ts | 8 | ||||
-rw-r--r-- | test/artifacts_test.ts | 28 | ||||
-rw-r--r-- | test/utils/constants.ts | 1 | ||||
-rw-r--r-- | yarn.lock | 40 |
5 files changed, 74 insertions, 4 deletions
diff --git a/package.json b/package.json index f3b8a933d..c69700bc1 100644 --- a/package.json +++ b/package.json @@ -79,6 +79,7 @@ "shx": "^0.2.2", "sinon": "^2.3.2", "source-map-support": "^0.4.15", + "truffle-hdwallet-provider": "^0.0.3", "tslint": "^5.3.2", "tslint-config-0xproject": "^0.0.2", "typedoc": "^0.7.1", diff --git a/src/globals.d.ts b/src/globals.d.ts index 15ebe03d0..4a0a3fb04 100644 --- a/src/globals.d.ts +++ b/src/globals.d.ts @@ -86,3 +86,11 @@ declare module 'es6-promisify' { declare module 'ethereumjs-abi' { const soliditySHA3: (argTypes: string[], args: any[]) => Buffer; } + +// truffle-hdwallet-provider declarations +declare class HDWalletProvider { + constructor(mnemonic: string, rpcUrl: string); +} +declare module 'truffle-hdwallet-provider' { + export = HDWalletProvider; +} diff --git a/test/artifacts_test.ts b/test/artifacts_test.ts new file mode 100644 index 000000000..d71b45567 --- /dev/null +++ b/test/artifacts_test.ts @@ -0,0 +1,28 @@ +import * as fs from 'fs'; +import HDWalletProvider = require('truffle-hdwallet-provider'); +import {ZeroEx} from '../src'; +import {web3Factory} from './utils/web3_factory'; +import {constants} from './utils/constants'; + +// 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 = constants.KOVAN_RPC_URL; + const packageJSONContent = fs.readFileSync('package.json', 'utf-8'); + const packageJSON = JSON.parse(packageJSONContent); + const mnemonic = packageJSON.config.mnemonic; + const web3Provider = new HDWalletProvider(mnemonic, kovanRpcUrl); + const zeroEx = new ZeroEx(web3Provider); + it('token registry contract is deployed', async () => { + await (zeroEx.tokenRegistry as any)._getTokenRegistryContractAsync(); + }).timeout(TIMEOUT); + it('proxy contract is deployed', async () => { + await (zeroEx.token as any)._getProxyAddressAsync(); + }).timeout(TIMEOUT); + it('exchange contract is deployed', async () => { + await (zeroEx.exchange as any)._getExchangeContractAsync(); + }).timeout(TIMEOUT); + }); +}); diff --git a/test/utils/constants.ts b/test/utils/constants.ts index aa1967f88..9b150b5c1 100644 --- a/test/utils/constants.ts +++ b/test/utils/constants.ts @@ -2,4 +2,5 @@ export const constants = { NULL_ADDRESS: '0x0000000000000000000000000000000000000000', RPC_HOST: 'localhost', RPC_PORT: 8545, + KOVAN_RPC_URL: 'https://kovan.0xproject.com', }; @@ -42,10 +42,14 @@ version "2.2.41" resolved "https://registry.yarnpkg.com/@types/mocha/-/mocha-2.2.41.tgz#e27cf0817153eb9f2713b2d3f6c68f1e1c3ca608" -"@types/node@*", "@types/node@^7.0.22": +"@types/node@*": version "7.0.23" resolved "https://registry.yarnpkg.com/@types/node/-/node-7.0.23.tgz#ededfd92e61046c32fcad56ea7e1101733fad4a4" +"@types/node@^8.0.1": + version "8.0.1" + resolved "https://registry.yarnpkg.com/@types/node/-/node-8.0.1.tgz#89c271e0c3b9ebb6a3756dd601336970b6228b77" + "@types/shelljs@^0.7.0": version "0.7.1" resolved "https://registry.yarnpkg.com/@types/shelljs/-/shelljs-0.7.1.tgz#30fe144e3bdd37c11c174445bc54190cb7992a45" @@ -716,7 +720,7 @@ bindings@^1.2.1: version "1.2.1" resolved "https://registry.yarnpkg.com/bindings/-/bindings-1.2.1.tgz#14ad6113812d2d37d72e67b4cacb4bb726505f11" -bip39@~2.2.0: +bip39@^2.2.0, bip39@~2.2.0: version "2.2.0" resolved "https://registry.yarnpkg.com/bip39/-/bip39-2.2.0.tgz#40e73f70674c267f148cdbf8374f2a50be166b0d" dependencies: @@ -1548,7 +1552,7 @@ ethereumjs-vm@^2.0.2, ethereumjs-vm@~2.0.1: functional-red-black-tree "^1.0.1" merkle-patricia-tree "^2.1.2" -ethereumjs-wallet@~0.6.0: +ethereumjs-wallet@^0.6.0, ethereumjs-wallet@~0.6.0: version "0.6.0" resolved "https://registry.yarnpkg.com/ethereumjs-wallet/-/ethereumjs-wallet-0.6.0.tgz#82763b1697ee7a796be7155da9dfb49b2f98cfdb" dependencies: @@ -4247,6 +4251,15 @@ truffle-contract@^2.0.1: truffle-contract-schema "0.0.5" web3 "^0.18.0" +truffle-hdwallet-provider@^0.0.3: + version "0.0.3" + resolved "https://registry.yarnpkg.com/truffle-hdwallet-provider/-/truffle-hdwallet-provider-0.0.3.tgz#0e1de02104b73d3875e1cf7093305b4ea8a2d843" + dependencies: + bip39 "^2.2.0" + ethereumjs-wallet "^0.6.0" + web3 "^0.18.2" + web3-provider-engine "^8.4.0" + tslib@^1.7.1: version "1.7.1" resolved "https://registry.yarnpkg.com/tslib/-/tslib-1.7.1.tgz#bc8004164691923a79fe8378bbeb3da2017538ec" @@ -4448,6 +4461,25 @@ web3-provider-engine@^13.0.1: xhr "^2.2.0" xtend "^4.0.1" +web3-provider-engine@^8.4.0: + version "8.6.1" + resolved "https://registry.yarnpkg.com/web3-provider-engine/-/web3-provider-engine-8.6.1.tgz#4d86e19e30caaf97df351511ec0f60136e5b30eb" + dependencies: + async "^2.1.2" + clone "^2.0.0" + ethereumjs-block "^1.2.2" + ethereumjs-tx "^1.2.0" + ethereumjs-util "^5.0.1" + ethereumjs-vm "^2.0.2" + isomorphic-fetch "^2.2.0" + request "^2.67.0" + semaphore "^1.0.3" + solc "^0.4.2" + tape "^4.4.0" + web3 "^0.16.0" + xhr "^2.2.0" + xtend "^4.0.1" + web3-provider-engine@~8.1.0: version "8.1.19" resolved "https://registry.yarnpkg.com/web3-provider-engine/-/web3-provider-engine-8.1.19.tgz#3ccae95adecef55632e2a73bf3bee64b7e62fcf7" @@ -4482,7 +4514,7 @@ web3@^0.16.0, web3@~0.16.0: utf8 "^2.1.1" xmlhttprequest "*" -web3@^0.18.0: +web3@^0.18.0, web3@^0.18.2: version "0.18.4" resolved "https://registry.yarnpkg.com/web3/-/web3-0.18.4.tgz#81ec1784145491f2eaa8955b31c06049e07c5e7d" dependencies: |