diff options
author | Leonid <logvinov.leon@gmail.com> | 2017-06-06 20:05:01 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-06-06 20:05:01 +0800 |
commit | 2eb99f46f53984c1a54315f87059ef18b9d06349 (patch) | |
tree | 15258b1412d7658e1844f54954c84d2fc2c6865a /test | |
parent | 0b700deb01ea044d53ae80ee483aa75262dcff07 (diff) | |
parent | fee0e5bfc7338f368f83f1e22a19d56943bd421b (diff) | |
download | dexon-0x-contracts-2eb99f46f53984c1a54315f87059ef18b9d06349.tar.gz dexon-0x-contracts-2eb99f46f53984c1a54315f87059ef18b9d06349.tar.zst dexon-0x-contracts-2eb99f46f53984c1a54315f87059ef18b9d06349.zip |
Merge pull request #35 from 0xProject/chai-setup
Add chai_setup
Diffstat (limited to 'test')
-rw-r--r-- | test/0x.js_test.ts | 9 | ||||
-rw-r--r-- | test/exchange_wrapper_test.ts | 8 | ||||
-rw-r--r-- | test/token_registry_wrapper_test.ts | 7 | ||||
-rw-r--r-- | test/token_wrapper_test.ts | 3 | ||||
-rw-r--r-- | test/utils/chai_setup.ts | 13 |
5 files changed, 22 insertions, 18 deletions
diff --git a/test/0x.js_test.ts b/test/0x.js_test.ts index 8686b42eb..42dbeee9f 100644 --- a/test/0x.js_test.ts +++ b/test/0x.js_test.ts @@ -1,18 +1,15 @@ import * as _ from 'lodash'; import * as chai from 'chai'; +import {chaiSetup} from './utils/chai_setup'; import 'mocha'; import * as BigNumber from 'bignumber.js'; -import ChaiBigNumber = require('chai-bignumber'); -import * as dirtyChai from 'dirty-chai'; import * as Sinon from 'sinon'; import {ZeroEx} from '../src/0x.js'; import {constants} from './utils/constants'; import {web3Factory} from './utils/web3_factory'; -import {Order, DoneCallback} from '../src/types'; +import {Order} from '../src/types'; -chai.config.includeStack = true; -chai.use(ChaiBigNumber()); -chai.use(dirtyChai); +chaiSetup.configure(); const expect = chai.expect; describe('ZeroEx library', () => { diff --git a/test/exchange_wrapper_test.ts b/test/exchange_wrapper_test.ts index b680c015b..def6d6902 100644 --- a/test/exchange_wrapper_test.ts +++ b/test/exchange_wrapper_test.ts @@ -1,9 +1,8 @@ import 'mocha'; -import * as _ from 'lodash'; import * as chai from 'chai'; import * as Web3 from 'web3'; import * as BigNumber from 'bignumber.js'; -import * as dirtyChai from 'dirty-chai'; +import {chaiSetup} from './utils/chai_setup'; import ChaiBigNumber = require('chai-bignumber'); import * as chaiAsPromised from 'chai-as-promised'; import promisify = require('es6-promisify'); @@ -22,10 +21,7 @@ import { import {FillScenarios} from './utils/fill_scenarios'; import {TokenUtils} from './utils/token_utils'; -chai.config.includeStack = true; -chai.use(dirtyChai); -chai.use(ChaiBigNumber()); -chai.use(chaiAsPromised); +chaiSetup.configure(); const expect = chai.expect; const blockchainLifecycle = new BlockchainLifecycle(); diff --git a/test/token_registry_wrapper_test.ts b/test/token_registry_wrapper_test.ts index 195b2f205..33c4a8054 100644 --- a/test/token_registry_wrapper_test.ts +++ b/test/token_registry_wrapper_test.ts @@ -1,18 +1,15 @@ import * as _ from 'lodash'; import 'mocha'; import * as chai from 'chai'; -import chaiAsPromised = require('chai-as-promised'); -import * as Web3 from 'web3'; +import {chaiSetup} from './utils/chai_setup'; import {web3Factory} from './utils/web3_factory'; import {ZeroEx} from '../src/0x.js'; import {BlockchainLifecycle} from './utils/blockchain_lifecycle'; -import {Token} from '../src/types'; import {SchemaValidator} from '../src/utils/schema_validator'; import {tokenSchema} from '../src/schemas/token_schema'; -chai.config.includeStack = true; +chaiSetup.configure(); const expect = chai.expect; -chai.use(chaiAsPromised); const blockchainLifecycle = new BlockchainLifecycle(); const TOKEN_REGISTRY_SIZE_AFTER_MIGRATION = 7; diff --git a/test/token_wrapper_test.ts b/test/token_wrapper_test.ts index ffe3db983..243d918ed 100644 --- a/test/token_wrapper_test.ts +++ b/test/token_wrapper_test.ts @@ -1,5 +1,6 @@ import 'mocha'; import * as chai from 'chai'; +import {chaiSetup} from './utils/chai_setup'; import * as Web3 from 'web3'; import * as BigNumber from 'bignumber.js'; import promisify = require('es6-promisify'); @@ -8,7 +9,7 @@ import {ZeroEx} from '../src/0x.js'; import {ZeroExError, Token} from '../src/types'; import {BlockchainLifecycle} from './utils/blockchain_lifecycle'; -chai.config.includeStack = true; +chaiSetup.configure(); const expect = chai.expect; const blockchainLifecycle = new BlockchainLifecycle(); diff --git a/test/utils/chai_setup.ts b/test/utils/chai_setup.ts new file mode 100644 index 000000000..c18988106 --- /dev/null +++ b/test/utils/chai_setup.ts @@ -0,0 +1,13 @@ +import * as chai from 'chai'; +import * as dirtyChai from 'dirty-chai'; +import ChaiBigNumber = require('chai-bignumber'); +import chaiAsPromised = require('chai-as-promised'); + +export const chaiSetup = { + configure() { + chai.config.includeStack = true; + chai.use(ChaiBigNumber()); + chai.use(dirtyChai); + chai.use(chaiAsPromised); + }, +}; |