diff options
author | Leonid Logvinov <logvinov.leon@gmail.com> | 2017-08-24 02:12:58 +0800 |
---|---|---|
committer | Leonid Logvinov <logvinov.leon@gmail.com> | 2017-08-24 15:59:10 +0800 |
commit | 0d7b75801a4594ebbf2d712441d04418473a51f5 (patch) | |
tree | 7d198369bd25a600cf9e7add598bc5e2035ad3d7 /test | |
parent | 82ef8b19f01644dee14894e8dc4ec5ef33e922e9 (diff) | |
download | dexon-0x-contracts-0d7b75801a4594ebbf2d712441d04418473a51f5.tar.gz dexon-0x-contracts-0d7b75801a4594ebbf2d712441d04418473a51f5.tar.zst dexon-0x-contracts-0d7b75801a4594ebbf2d712441d04418473a51f5.zip |
Add test for getTokenAddressesAsync
Diffstat (limited to 'test')
-rw-r--r-- | test/token_registry_wrapper_test.ts | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/test/token_registry_wrapper_test.ts b/test/token_registry_wrapper_test.ts index 6b5640c6c..2b0873245 100644 --- a/test/token_registry_wrapper_test.ts +++ b/test/token_registry_wrapper_test.ts @@ -7,6 +7,7 @@ import {ZeroEx} from '../src'; import {BlockchainLifecycle} from './utils/blockchain_lifecycle'; import {SchemaValidator} from '../src/utils/schema_validator'; import {tokenSchema} from '../src/schemas/token_schema'; +import {addressSchema} from '../src/schemas/basic_type_schemas'; chaiSetup.configure(); const expect = chai.expect; @@ -38,6 +39,19 @@ describe('TokenRegistryWrapper', () => { }); }); }); + describe('#getTokenAddressesAsync', () => { + it('should return all the token addresses added to the tokenRegistry during the migration', async () => { + const tokenAddresses = await zeroEx.tokenRegistry.getTokenAddressesAsync(); + expect(tokenAddresses).to.have.lengthOf(TOKEN_REGISTRY_SIZE_AFTER_MIGRATION); + + const schemaValidator = new SchemaValidator(); + _.each(tokenAddresses, tokenAddress => { + const validationResult = schemaValidator.validate(tokenAddress, addressSchema); + expect(validationResult.errors).to.have.lengthOf(0); + expect(tokenAddress).to.not.be.equal(ZeroEx.NULL_ADDRESS); + }); + }); + }); describe('#getTokenIfExistsAsync', () => { it('should return the token added to the tokenRegistry during the migration', async () => { const tokens = await zeroEx.tokenRegistry.getTokensAsync(); |