diff options
Diffstat (limited to 'packages/json-schemas/test')
-rw-r--r-- | packages/json-schemas/test/schema_test.ts | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/packages/json-schemas/test/schema_test.ts b/packages/json-schemas/test/schema_test.ts index 03c0e950b..e8ccd4ec6 100644 --- a/packages/json-schemas/test/schema_test.ts +++ b/packages/json-schemas/test/schema_test.ts @@ -5,6 +5,8 @@ import forEach = require('lodash.foreach'); import 'mocha'; import { schemas, SchemaValidator } from '../src/index'; +import { validate } from 'jsonschema'; +import { relayerApiOrderSchema } from '../schemas/relayer_api_order_schema'; chai.config.includeStack = true; chai.use(dirtyChai); @@ -211,6 +213,10 @@ describe('Schema', () => { exchangeAddress: NULL_ADDRESS, expirationTimeSeconds: '42', }; + const relayerApiOrder = { + order, + remainingFillableAmount: '50000000000000', + }; describe('#orderSchema', () => { it('should validate valid order', () => { const testCases = [order]; @@ -232,6 +238,17 @@ describe('Schema', () => { validateAgainstSchema(testCases, orderSchema, shouldFail); }); }); + describe('relayerApiOrderSchema', () => { + it('should validate valid relayer api order', () => { + const testCases = [relayerApiOrder]; + validateAgainstSchema(testCases, relayerApiOrderSchema); + }); + it('should fail for invalid relayer api orders', () => { + const testCases = [{}, order, { order }, { order, remainingFillableAmount: 5 }]; + const shouldFail = true; + validateAgainstSchema(testCases, shouldFail); + }); + }); describe('signed order including schemas', () => { const signedOrder = { ...order, |