aboutsummaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
Diffstat (limited to 'test')
-rw-r--r--test/schema_test.ts36
1 files changed, 36 insertions, 0 deletions
diff --git a/test/schema_test.ts b/test/schema_test.ts
index a608e867d..392db1c3b 100644
--- a/test/schema_test.ts
+++ b/test/schema_test.ts
@@ -6,6 +6,7 @@ import promisify = require('es6-promisify');
import {constants} from './utils/constants';
import {SchemaValidator} from '../src/utils/schema_validator';
import {tokenSchema} from '../src/schemas/token_schema';
+import {orderSchema} from '../src/schemas/order_schemas';
import {addressSchema, numberSchema} from '../src/schemas/basic_type_schemas';
import {ecSignatureParameterSchema, ecSignatureSchema} from '../src/schemas/ec_signature_schema';
@@ -122,6 +123,41 @@ describe('Schema', () => {
validateAgainstSchema(testCases, tokenSchema, true);
});
});
+ describe('#orderSchema', () => {
+ const order = {
+ maker: constants.NULL_ADDRESS,
+ taker: constants.NULL_ADDRESS,
+ makerFee: 1,
+ takerFee: 2,
+ makerTokenAmount: 1,
+ takerTokenAmount: 2,
+ makerTokenAddress: constants.NULL_ADDRESS,
+ takerTokenAddress: constants.NULL_ADDRESS,
+ salt: 256,
+ feeRecipient: constants.NULL_ADDRESS,
+ expirationUnixTimestampSec: 42,
+ };
+ it('should validate valid order', () => {
+ const testCases = [
+ order,
+ ];
+ validateAgainstSchema(testCases, orderSchema);
+ });
+ it('should fail for invalid order', () => {
+ const testCases = [
+ {
+ ...order,
+ salt: undefined,
+ },
+ {
+ ...order,
+ salt: 'salt',
+ },
+ 'order',
+ ];
+ validateAgainstSchema(testCases, orderSchema, true);
+ });
+ });
describe('BigNumber serialization', () => {
it('should correctly serialize BigNumbers', () => {
const testCases = {