diff options
author | Leonid Logvinov <logvinov.leon@gmail.com> | 2017-06-09 22:07:00 +0800 |
---|---|---|
committer | Leonid Logvinov <logvinov.leon@gmail.com> | 2017-06-09 22:07:00 +0800 |
commit | 14003dd1f3f19c841c5f6b740d5df0148faee4dc (patch) | |
tree | 1589ec0e26b77686685c2f8e992754479382fa57 /test | |
parent | 47be6a0c3007f139999bb0009e46cbd1be9e3d3f (diff) | |
download | dexon-sol-tools-14003dd1f3f19c841c5f6b740d5df0148faee4dc.tar dexon-sol-tools-14003dd1f3f19c841c5f6b740d5df0148faee4dc.tar.gz dexon-sol-tools-14003dd1f3f19c841c5f6b740d5df0148faee4dc.tar.bz2 dexon-sol-tools-14003dd1f3f19c841c5f6b740d5df0148faee4dc.tar.lz dexon-sol-tools-14003dd1f3f19c841c5f6b740d5df0148faee4dc.tar.xz dexon-sol-tools-14003dd1f3f19c841c5f6b740d5df0148faee4dc.tar.zst dexon-sol-tools-14003dd1f3f19c841c5f6b740d5df0148faee4dc.zip |
Add tests for order schema
Diffstat (limited to 'test')
-rw-r--r-- | test/schema_test.ts | 36 |
1 files changed, 36 insertions, 0 deletions
diff --git a/test/schema_test.ts b/test/schema_test.ts index a608e867d..392db1c3b 100644 --- a/test/schema_test.ts +++ b/test/schema_test.ts @@ -6,6 +6,7 @@ import promisify = require('es6-promisify'); import {constants} from './utils/constants'; import {SchemaValidator} from '../src/utils/schema_validator'; import {tokenSchema} from '../src/schemas/token_schema'; +import {orderSchema} from '../src/schemas/order_schemas'; import {addressSchema, numberSchema} from '../src/schemas/basic_type_schemas'; import {ecSignatureParameterSchema, ecSignatureSchema} from '../src/schemas/ec_signature_schema'; @@ -122,6 +123,41 @@ describe('Schema', () => { validateAgainstSchema(testCases, tokenSchema, true); }); }); + describe('#orderSchema', () => { + const order = { + maker: constants.NULL_ADDRESS, + taker: constants.NULL_ADDRESS, + makerFee: 1, + takerFee: 2, + makerTokenAmount: 1, + takerTokenAmount: 2, + makerTokenAddress: constants.NULL_ADDRESS, + takerTokenAddress: constants.NULL_ADDRESS, + salt: 256, + feeRecipient: constants.NULL_ADDRESS, + expirationUnixTimestampSec: 42, + }; + it('should validate valid order', () => { + const testCases = [ + order, + ]; + validateAgainstSchema(testCases, orderSchema); + }); + it('should fail for invalid order', () => { + const testCases = [ + { + ...order, + salt: undefined, + }, + { + ...order, + salt: 'salt', + }, + 'order', + ]; + validateAgainstSchema(testCases, orderSchema, true); + }); + }); describe('BigNumber serialization', () => { it('should correctly serialize BigNumbers', () => { const testCases = { |