diff options
author | Leonid Logvinov <logvinov.leon@gmail.com> | 2017-06-05 19:07:26 +0800 |
---|---|---|
committer | Leonid Logvinov <logvinov.leon@gmail.com> | 2017-06-05 19:07:26 +0800 |
commit | 4dc9a14aaf1c01ba28326af575d1eaf6ac1d4606 (patch) | |
tree | e8f37097a87e1a63811575e954dead91abc62ea5 | |
parent | eb5c9ae70886cb1a14ae154f363f052a76b24479 (diff) | |
download | dexon-sol-tools-4dc9a14aaf1c01ba28326af575d1eaf6ac1d4606.tar dexon-sol-tools-4dc9a14aaf1c01ba28326af575d1eaf6ac1d4606.tar.gz dexon-sol-tools-4dc9a14aaf1c01ba28326af575d1eaf6ac1d4606.tar.bz2 dexon-sol-tools-4dc9a14aaf1c01ba28326af575d1eaf6ac1d4606.tar.lz dexon-sol-tools-4dc9a14aaf1c01ba28326af575d1eaf6ac1d4606.tar.xz dexon-sol-tools-4dc9a14aaf1c01ba28326af575d1eaf6ac1d4606.tar.zst dexon-sol-tools-4dc9a14aaf1c01ba28326af575d1eaf6ac1d4606.zip |
Add chai_setup
-rw-r--r-- | test/0x.js_test.ts | 9 | ||||
-rw-r--r-- | test/chai_setup.ts | 13 | ||||
-rw-r--r-- | test/exchange_wrapper_test.ts | 7 | ||||
-rw-r--r-- | test/token_registry_wrapper_test.ts | 7 | ||||
-rw-r--r-- | test/token_wrapper_test.ts | 3 |
5 files changed, 22 insertions, 17 deletions
diff --git a/test/0x.js_test.ts b/test/0x.js_test.ts index 8686b42eb..d2a36e1c4 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 './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/chai_setup.ts b/test/chai_setup.ts new file mode 100644 index 000000000..df71c960f --- /dev/null +++ b/test/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 class ChaiSetup { + public static configure(): void { + chai.config.includeStack = true; + chai.use(ChaiBigNumber()); + chai.use(dirtyChai); + chai.use(chaiAsPromised); + } +} diff --git a/test/exchange_wrapper_test.ts b/test/exchange_wrapper_test.ts index 4f3a48b26..ac0a2199e 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 './chai_setup'; import ChaiBigNumber = require('chai-bignumber'); import promisify = require('es6-promisify'); import {web3Factory} from './utils/web3_factory'; @@ -21,9 +20,7 @@ import { import {FillScenarios} from './utils/fill_scenarios'; import {TokenUtils} from './utils/token_utils'; -chai.config.includeStack = true; -chai.use(dirtyChai); -chai.use(ChaiBigNumber()); +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..cf2fa267b 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 './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 698ad5b6a..f9f231828 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 './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(); |