diff options
author | Leonid Logvinov <logvinov.leon@gmail.com> | 2017-06-09 22:56:00 +0800 |
---|---|---|
committer | Leonid Logvinov <logvinov.leon@gmail.com> | 2017-06-09 22:56:00 +0800 |
commit | e74f03b087ab811f76b7aff1452cc2cadd680358 (patch) | |
tree | 40dbb677e0611b8a9492d8982247b5d29f012272 /test/schema_test.ts | |
parent | 7741f7729d289b9206b89af7687c37e26dc3141b (diff) | |
download | dexon-0x-contracts-e74f03b087ab811f76b7aff1452cc2cadd680358.tar dexon-0x-contracts-e74f03b087ab811f76b7aff1452cc2cadd680358.tar.gz dexon-0x-contracts-e74f03b087ab811f76b7aff1452cc2cadd680358.tar.bz2 dexon-0x-contracts-e74f03b087ab811f76b7aff1452cc2cadd680358.tar.lz dexon-0x-contracts-e74f03b087ab811f76b7aff1452cc2cadd680358.tar.xz dexon-0x-contracts-e74f03b087ab811f76b7aff1452cc2cadd680358.tar.zst dexon-0x-contracts-e74f03b087ab811f76b7aff1452cc2cadd680358.zip |
Add tests for orderCancellationRequestsSchema
Diffstat (limited to 'test/schema_test.ts')
-rw-r--r-- | test/schema_test.ts | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/test/schema_test.ts b/test/schema_test.ts index f44e52290..bdafde915 100644 --- a/test/schema_test.ts +++ b/test/schema_test.ts @@ -10,6 +10,7 @@ import {orderSchema, signedOrderSchema} from '../src/schemas/order_schemas'; import {addressSchema, numberSchema} from '../src/schemas/basic_type_schemas'; import {orderFillOrKillRequestsSchema} from '../src/schemas/order_fill_or_kill_requests_schema'; import {ecSignatureParameterSchema, ecSignatureSchema} from '../src/schemas/ec_signature_schema'; +import {orderCancellationRequestsSchema} from '../src/schemas/order_cancel_schema'; chai.config.includeStack = true; const expect = chai.expect; @@ -211,6 +212,31 @@ describe('Schema', () => { validateAgainstSchema(testCases, orderFillOrKillRequestsSchema, true); }); }); + describe('#orderCancellationRequestsSchema', () => { + const orderCancellationRequests = [ + { + order, + takerTokenCancelAmount: 5, + }, + ]; + it('should validate valid order cancellation requests', () => { + const testCases = [ + orderCancellationRequests, + ]; + validateAgainstSchema(testCases, orderCancellationRequestsSchema); + }); + it('should fail for invalid order cancellation requests', () => { + const testCases = [ + [ + { + ...orderCancellationRequests[0], + takerTokenCancelAmount: undefined, + }, + ], + ]; + validateAgainstSchema(testCases, orderCancellationRequestsSchema, true); + }); + }); }); }); describe('BigNumber serialization', () => { |