diff options
author | Leonid Logvinov <logvinov.leon@gmail.com> | 2017-06-09 20:35:03 +0800 |
---|---|---|
committer | Leonid Logvinov <logvinov.leon@gmail.com> | 2017-06-09 20:35:03 +0800 |
commit | d2df9bb314a1227640112791c6c29c9dd2c77301 (patch) | |
tree | 2b2550f17e4220a74a6c75accf2dce8cf8127bae /test | |
parent | 298c6a14b3aff0744989934aa86f1bf23a974a00 (diff) | |
download | dexon-sol-tools-d2df9bb314a1227640112791c6c29c9dd2c77301.tar dexon-sol-tools-d2df9bb314a1227640112791c6c29c9dd2c77301.tar.gz dexon-sol-tools-d2df9bb314a1227640112791c6c29c9dd2c77301.tar.bz2 dexon-sol-tools-d2df9bb314a1227640112791c6c29c9dd2c77301.tar.lz dexon-sol-tools-d2df9bb314a1227640112791c6c29c9dd2c77301.tar.xz dexon-sol-tools-d2df9bb314a1227640112791c6c29c9dd2c77301.tar.zst dexon-sol-tools-d2df9bb314a1227640112791c6c29c9dd2c77301.zip |
Add ecSignatureParameter test
Diffstat (limited to 'test')
-rw-r--r-- | test/schema_test.ts | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/test/schema_test.ts b/test/schema_test.ts index 42a47c332..657cd1aad 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 {addressSchema, numberSchema} from '../src/schemas/basic_type_schemas'; +import {ecSignatureParameter} from '../src/schemas/ec_signature_schema'; chai.config.includeStack = true; const expect = chai.expect; @@ -41,6 +42,25 @@ describe('Schema', () => { }); }); }); + describe('#ecSignatureParameter', () => { + describe('parameter regex', () => { + it('should validate valid parameters', () => { + const testCases = [ + '0x61a3ed31b43c8780e905a260a35faefcc527be7516aa11c0256729b5b351bc33', + '0X40349190569279751135161d22529dc25add4f6069af05be04cacbda2ace2254', + ]; + batchTestSchema(testCases, ecSignatureParameter); + }); + it('should fail for invalid parameters', () => { + const testCases = [ + '0x61a3ed31b43c8780e905a260a35faefcc527be7516aa11c0256729b5b351bc3', // shorter + '0xzzzz9190569279751135161d22529dc25add4f6069af05be04cacbda2ace2254', // invalid characters + '40349190569279751135161d22529dc25add4f6069af05be04cacbda2ace2254', // no 0x + ]; + batchTestSchema(testCases, ecSignatureParameter, true); + }); + }); + }); describe('BigNumber serialization', () => { it('should correctly serialize BigNumbers', () => { const testCases = { |