aboutsummaryrefslogtreecommitdiffstats
path: root/test/schema_test.ts
diff options
context:
space:
mode:
authorLeonid Logvinov <logvinov.leon@gmail.com>2017-07-04 13:32:24 +0800
committerLeonid Logvinov <logvinov.leon@gmail.com>2017-07-05 01:05:45 +0800
commitf39a2134b946ab2c7f24b9fcc49f95156e7682d5 (patch)
tree964403241e02bd074f619a8b2427f2bc9eebd253 /test/schema_test.ts
parent551b6db35e07907ad4dec767c8e76953fe98bb72 (diff)
downloaddexon-sol-tools-f39a2134b946ab2c7f24b9fcc49f95156e7682d5.tar
dexon-sol-tools-f39a2134b946ab2c7f24b9fcc49f95156e7682d5.tar.gz
dexon-sol-tools-f39a2134b946ab2c7f24b9fcc49f95156e7682d5.tar.bz2
dexon-sol-tools-f39a2134b946ab2c7f24b9fcc49f95156e7682d5.tar.lz
dexon-sol-tools-f39a2134b946ab2c7f24b9fcc49f95156e7682d5.tar.xz
dexon-sol-tools-f39a2134b946ab2c7f24b9fcc49f95156e7682d5.tar.zst
dexon-sol-tools-f39a2134b946ab2c7f24b9fcc49f95156e7682d5.zip
Add tests for order hash Schema
Diffstat (limited to 'test/schema_test.ts')
-rw-r--r--test/schema_test.ts21
1 files changed, 20 insertions, 1 deletions
diff --git a/test/schema_test.ts b/test/schema_test.ts
index 7f9a66ae3..4746c7949 100644
--- a/test/schema_test.ts
+++ b/test/schema_test.ts
@@ -6,7 +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, signedOrderSchema} from '../src/schemas/order_schemas';
+import {orderSchema, signedOrderSchema, orderHashSchema} from '../src/schemas/order_schemas';
import {addressSchema, numberSchema} from '../src/schemas/basic_type_schemas';
import {orderFillOrKillRequestsSchema} from '../src/schemas/order_fill_or_kill_requests_schema';
import {ecSignatureParameterSchema, ecSignatureSchema} from '../src/schemas/ec_signature_schema';
@@ -97,6 +97,25 @@ describe('Schema', () => {
validateAgainstSchema(testCases, ecSignatureSchema, shouldFail);
});
});
+ describe('#orderHashSchema', () => {
+ it('should validate valid order hash', () => {
+ const testCases = [
+ '0x61a3ed31B43c8780e905a260a35faefEc527be7516aa11c0256729b5b351bc33',
+ '0x40349190569279751135161d22529dc25add4f6069af05be04cacbda2ace2254',
+ ];
+ validateAgainstSchema(testCases, orderHashSchema);
+ });
+ it('should fail for invalid order hash', () => {
+ const testCases = [
+ {},
+ '0x',
+ '0x8b0292B11a196601eD2ce54B665CaFEca0347D42',
+ '61a3ed31B43c8780e905a260a35faefEc527be7516aa11c0256729b5b351bc33',
+ ];
+ const shouldFail = true;
+ validateAgainstSchema(testCases, orderHashSchema, shouldFail);
+ });
+ });
describe('#blockParamSchema', () => {
it('should validate valid block param', () => {
const testCases = [