aboutsummaryrefslogtreecommitdiffstats
path: root/packages/json-schemas/test/schema_test.ts
diff options
context:
space:
mode:
Diffstat (limited to 'packages/json-schemas/test/schema_test.ts')
-rw-r--r--packages/json-schemas/test/schema_test.ts33
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 = [