aboutsummaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorFabio Berger <me@fabioberger.com>2017-05-30 18:37:45 +0800
committerFabio Berger <me@fabioberger.com>2017-05-30 18:37:45 +0800
commite8a52ce1da454ab3a30b6f7d314aa85cf9534a05 (patch)
tree530fb9f1d2173d19b76b96ae48a6cff90bdc9925 /test
parentd15002a1109ea00f4d92c7ae6259b5b657f5e4b3 (diff)
parent911ab437b8f9371f70e835f680d799b7c62fb140 (diff)
downloaddexon-sol-tools-e8a52ce1da454ab3a30b6f7d314aa85cf9534a05.tar
dexon-sol-tools-e8a52ce1da454ab3a30b6f7d314aa85cf9534a05.tar.gz
dexon-sol-tools-e8a52ce1da454ab3a30b6f7d314aa85cf9534a05.tar.bz2
dexon-sol-tools-e8a52ce1da454ab3a30b6f7d314aa85cf9534a05.tar.lz
dexon-sol-tools-e8a52ce1da454ab3a30b6f7d314aa85cf9534a05.tar.xz
dexon-sol-tools-e8a52ce1da454ab3a30b6f7d314aa85cf9534a05.tar.zst
dexon-sol-tools-e8a52ce1da454ab3a30b6f7d314aa85cf9534a05.zip
Merge branch 'master' into dontReinstantiateContractInstances
Diffstat (limited to 'test')
-rw-r--r--test/token_registry_wrapper_test.ts43
1 files changed, 43 insertions, 0 deletions
diff --git a/test/token_registry_wrapper_test.ts b/test/token_registry_wrapper_test.ts
new file mode 100644
index 000000000..c91555d8b
--- /dev/null
+++ b/test/token_registry_wrapper_test.ts
@@ -0,0 +1,43 @@
+import * as _ from 'lodash';
+import 'mocha';
+import * as chai from 'chai';
+import chaiAsPromised = require('chai-as-promised');
+import * as Web3 from 'web3';
+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';
+
+const expect = chai.expect;
+chai.use(chaiAsPromised);
+const blockchainLifecycle = new BlockchainLifecycle();
+
+const TOKEN_REGISTRY_SIZE_AFTER_MIGRATION = 7;
+
+describe('TokenRegistryWrapper', () => {
+ let zeroEx: ZeroEx;
+ before(async () => {
+ const web3 = web3Factory.create();
+ zeroEx = new ZeroEx(web3);
+ });
+ beforeEach(async () => {
+ await blockchainLifecycle.startAsync();
+ });
+ afterEach(async () => {
+ await blockchainLifecycle.revertAsync();
+ });
+ describe('#getTokensAsync', () => {
+ it('should return all the tokens added to the tokenRegistry during the migration', async () => {
+ const tokens = await zeroEx.tokenRegistry.getTokensAsync();
+ expect(tokens).to.have.lengthOf(TOKEN_REGISTRY_SIZE_AFTER_MIGRATION);
+
+ const schemaValidator = new SchemaValidator();
+ _.each(tokens, token => {
+ const validationResult = schemaValidator.validate(token, tokenSchema);
+ expect(validationResult.errors).to.have.lengthOf(0);
+ });
+ });
+ });
+});