diff options
author | Fabio Berger <me@fabioberger.com> | 2017-08-24 00:22:50 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-08-24 00:22:50 +0800 |
commit | 18f2a93950500e3efec7ae25e32ff644ebb7efcc (patch) | |
tree | 7447497305248c6ac6d061ce590f5ed5222f2aa0 /test | |
parent | bd7102efbee0833bd0274edbe248db27b53aa950 (diff) | |
parent | 98be7867649337a18441e517790c748c722ee730 (diff) | |
download | dexon-sol-tools-18f2a93950500e3efec7ae25e32ff644ebb7efcc.tar dexon-sol-tools-18f2a93950500e3efec7ae25e32ff644ebb7efcc.tar.gz dexon-sol-tools-18f2a93950500e3efec7ae25e32ff644ebb7efcc.tar.bz2 dexon-sol-tools-18f2a93950500e3efec7ae25e32ff644ebb7efcc.tar.lz dexon-sol-tools-18f2a93950500e3efec7ae25e32ff644ebb7efcc.tar.xz dexon-sol-tools-18f2a93950500e3efec7ae25e32ff644ebb7efcc.tar.zst dexon-sol-tools-18f2a93950500e3efec7ae25e32ff644ebb7efcc.zip |
Merge pull request #131 from 0xProject/addTokenRegistryMethod
Add public method to TokenRegistry
Diffstat (limited to 'test')
-rw-r--r-- | test/token_registry_wrapper_test.ts | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/test/token_registry_wrapper_test.ts b/test/token_registry_wrapper_test.ts index da436161c..6b5640c6c 100644 --- a/test/token_registry_wrapper_test.ts +++ b/test/token_registry_wrapper_test.ts @@ -38,4 +38,20 @@ describe('TokenRegistryWrapper', () => { }); }); }); + describe('#getTokenIfExistsAsync', () => { + it('should return the token added to the tokenRegistry during the migration', async () => { + const tokens = await zeroEx.tokenRegistry.getTokensAsync(); + const aToken = tokens[0]; + + const token = await zeroEx.tokenRegistry.getTokenIfExistsAsync(aToken.address); + const schemaValidator = new SchemaValidator(); + const validationResult = schemaValidator.validate(token, tokenSchema); + expect(validationResult.errors).to.have.lengthOf(0); + }); + it('should return return undefined when passed a token address not in the tokenRegistry', async () => { + const unregisteredTokenAddress = '0x5409ed021d9299bf6814279a6a1411a7e866a631'; + const tokenIfExists = await zeroEx.tokenRegistry.getTokenIfExistsAsync(unregisteredTokenAddress); + expect(tokenIfExists).to.be.undefined(); + }); + }); }); |