diff options
author | Leonid Logvinov <logvinov.leon@gmail.com> | 2017-07-04 12:59:42 +0800 |
---|---|---|
committer | Leonid Logvinov <logvinov.leon@gmail.com> | 2017-07-04 12:59:42 +0800 |
commit | 64cf47f297827a869120b85e734406db87b87db8 (patch) | |
tree | 2130a72b7a5cb45b75072124e1a6684fdca9a0f2 /test | |
parent | 7d7bef2b1a83a570be58c8c0c90c9e338c3b93f3 (diff) | |
download | dexon-sol-tools-64cf47f297827a869120b85e734406db87b87db8.tar dexon-sol-tools-64cf47f297827a869120b85e734406db87b87db8.tar.gz dexon-sol-tools-64cf47f297827a869120b85e734406db87b87db8.tar.bz2 dexon-sol-tools-64cf47f297827a869120b85e734406db87b87db8.tar.lz dexon-sol-tools-64cf47f297827a869120b85e734406db87b87db8.tar.xz dexon-sol-tools-64cf47f297827a869120b85e734406db87b87db8.tar.zst dexon-sol-tools-64cf47f297827a869120b85e734406db87b87db8.zip |
Add tests for subscriptionOptsSchema and blockParamSchema
Diffstat (limited to 'test')
-rw-r--r-- | test/schema_test.ts | 38 |
1 files changed, 38 insertions, 0 deletions
diff --git a/test/schema_test.ts b/test/schema_test.ts index b251a68f9..7f9a66ae3 100644 --- a/test/schema_test.ts +++ b/test/schema_test.ts @@ -12,6 +12,7 @@ import {orderFillOrKillRequestsSchema} from '../src/schemas/order_fill_or_kill_r import {ecSignatureParameterSchema, ecSignatureSchema} from '../src/schemas/ec_signature_schema'; import {orderCancellationRequestsSchema} from '../src/schemas/order_cancel_schema'; import {orderFillRequestsSchema} from '../src/schemas/order_fill_requests_schema'; +import {blockParamSchema, subscriptionOptsSchema} from '../src/schemas/subscription_opts_schema'; chai.config.includeStack = true; const expect = chai.expect; @@ -96,6 +97,43 @@ describe('Schema', () => { validateAgainstSchema(testCases, ecSignatureSchema, shouldFail); }); }); + describe('#blockParamSchema', () => { + it('should validate valid block param', () => { + const testCases = [ + 42, + 'latest', + 'pending', + 'earliest', + ]; + validateAgainstSchema(testCases, blockParamSchema); + }); + it('should fail for invalid block param', () => { + const testCases = [ + {}, + '42', + 'pemding', + ]; + const shouldFail = true; + validateAgainstSchema(testCases, blockParamSchema, shouldFail); + }); + }); + describe('#subscriptionOptsSchema', () => { + it('should validate valid subscription opts', () => { + const testCases = [ + {fromBlock: 42, toBlock: 'latest'}, + ]; + validateAgainstSchema(testCases, subscriptionOptsSchema); + }); + it('should fail for invalid subscription opts', () => { + const testCases = [ + {}, + {fromBlock: 42}, + {fromBlock: 42, to: 43}, + ]; + const shouldFail = true; + validateAgainstSchema(testCases, subscriptionOptsSchema, shouldFail); + }); + }); describe('#tokenSchema', () => { const token = { name: 'Zero Ex', |