aboutsummaryrefslogtreecommitdiffstats
path: root/packages
diff options
context:
space:
mode:
authorfragosti <francesco.agosti93@gmail.com>2018-08-02 04:27:01 +0800
committerfragosti <francesco.agosti93@gmail.com>2018-08-02 04:27:01 +0800
commit8351f5998ab3960461b255826778ff279991c184 (patch)
treeb199a55b61e34aa3ed48f912b9096abfca17ef64 /packages
parent86eafeb82623c40c621edaa3e1f59bd3b0eee4bb (diff)
downloaddexon-sol-tools-8351f5998ab3960461b255826778ff279991c184.tar
dexon-sol-tools-8351f5998ab3960461b255826778ff279991c184.tar.gz
dexon-sol-tools-8351f5998ab3960461b255826778ff279991c184.tar.bz2
dexon-sol-tools-8351f5998ab3960461b255826778ff279991c184.tar.lz
dexon-sol-tools-8351f5998ab3960461b255826778ff279991c184.tar.xz
dexon-sol-tools-8351f5998ab3960461b255826778ff279991c184.tar.zst
dexon-sol-tools-8351f5998ab3960461b255826778ff279991c184.zip
Add relayerApiOrdersResponseTest
Diffstat (limited to 'packages')
-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 = [