From 22547f419b09f49aac3ef81bb6af1db81f495fad Mon Sep 17 00:00:00 2001 From: Leonid Logvinov Date: Fri, 9 Jun 2017 16:57:51 +0200 Subject: Add tests for fillOrderRequests schema --- test/schema_test.ts | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/test/schema_test.ts b/test/schema_test.ts index bdafde915..43f6c6d38 100644 --- a/test/schema_test.ts +++ b/test/schema_test.ts @@ -11,6 +11,7 @@ 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'; +import {orderFillRequestsSchema} from '../src/schemas/order_fill_requests_schema'; chai.config.includeStack = true; const expect = chai.expect; @@ -237,6 +238,31 @@ describe('Schema', () => { validateAgainstSchema(testCases, orderCancellationRequestsSchema, true); }); }); + describe('#orderFillRequestsSchema', () => { + const orderFillRequests = [ + { + signedOrder, + takerTokenCancelAmount: 5, + }, + ]; + it('should validate valid order fill requests', () => { + const testCases = [ + orderFillRequests, + ]; + validateAgainstSchema(testCases, orderFillRequestsSchema); + }); + it('should fail for invalid order fill requests', () => { + const testCases = [ + [ + { + ...orderFillRequests[0], + takerTokenFillAmount: undefined, + }, + ], + ]; + validateAgainstSchema(testCases, orderFillRequestsSchema, true); + }); + }); }); }); describe('BigNumber serialization', () => { -- cgit