Add test for getTokenAddressesAsync

This commit is contained in:
Leonid Logvinov
2017-08-23 20:12:58 +02:00
parent 82ef8b19f0
commit 0d7b75801a

View File

@@ -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();