diff options
author | fragosti <francesco.agosti93@gmail.com> | 2018-08-02 04:27:01 +0800 |
---|---|---|
committer | fragosti <francesco.agosti93@gmail.com> | 2018-08-02 04:27:01 +0800 |
commit | 8351f5998ab3960461b255826778ff279991c184 (patch) | |
tree | b199a55b61e34aa3ed48f912b9096abfca17ef64 | |
parent | 86eafeb82623c40c621edaa3e1f59bd3b0eee4bb (diff) | |
download | dexon-0x-contracts-8351f5998ab3960461b255826778ff279991c184.tar dexon-0x-contracts-8351f5998ab3960461b255826778ff279991c184.tar.gz dexon-0x-contracts-8351f5998ab3960461b255826778ff279991c184.tar.bz2 dexon-0x-contracts-8351f5998ab3960461b255826778ff279991c184.tar.lz dexon-0x-contracts-8351f5998ab3960461b255826778ff279991c184.tar.xz dexon-0x-contracts-8351f5998ab3960461b255826778ff279991c184.tar.zst dexon-0x-contracts-8351f5998ab3960461b255826778ff279991c184.zip |
Add relayerApiOrdersResponseTest
-rw-r--r-- | packages/json-schemas/test/schema_test.ts | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/packages/json-schemas/test/schema_test.ts b/packages/json-schemas/test/schema_test.ts index 0af948df7..119c13388 100644 --- a/packages/json-schemas/test/schema_test.ts +++ b/packages/json-schemas/test/schema_test.ts @@ -5,6 +5,7 @@ import forEach = require('lodash.foreach'); import 'mocha'; import { schemas, SchemaValidator } from '../src/index'; +import { validate } from 'jsonschema'; chai.config.includeStack = true; chai.use(dirtyChai); @@ -216,6 +217,10 @@ describe('Schema', () => { order, remainingFillableAmount: '50000000000000', }; + const relayerApiOrdersResponse = { + ...paginatedResponse, + records: [relayerApiOrder, relayerApiOrder], + }; describe('#orderSchema', () => { it('should validate valid order', () => { const testCases = [order]; @@ -589,6 +594,34 @@ describe('Schema', () => { validateAgainstSchema(testCases, relayerApiAssetDataPairsResponseSchema, shouldFail); }); }); + describe('#relayerApiOrdersResponseSchema', () => { + it('should validate valid orders responses', () => { + const testCases = [ + relayerApiOrdersResponse, + { + ...paginatedResponse, + records: [], + }, + ]; + validateAgainstSchema(testCases, relayerApiOrdersResponseSchema); + }); + it('should fail for invalid orders responses', () => { + const testCases = [ + { + records: [relayerApiOrder, relayerApiOrder], + }, + { + ...paginatedResponse, + }, + { + ...paginatedResponse, + records: [{}, relayerApiOrder], + }, + ]; + const shouldFail = true; + validateAgainstSchema(testCases, relayerApiOrdersResponseSchema, shouldFail); + }); + }); describe('#relayerApiOrderBookResponseSchema', () => { it('should validate valid order book responses', () => { const testCases = [ |