diff options
author | Leonid Logvinov <logvinov.leon@gmail.com> | 2017-06-09 22:09:55 +0800 |
---|---|---|
committer | Leonid Logvinov <logvinov.leon@gmail.com> | 2017-06-09 22:09:55 +0800 |
commit | 941df26dff802fc8a73ec289ce84d1e54451668e (patch) | |
tree | 3aba71e5423f45fe3d01c3d30d94d4f83720dc9c /test | |
parent | 14003dd1f3f19c841c5f6b740d5df0148faee4dc (diff) | |
download | dexon-sol-tools-941df26dff802fc8a73ec289ce84d1e54451668e.tar dexon-sol-tools-941df26dff802fc8a73ec289ce84d1e54451668e.tar.gz dexon-sol-tools-941df26dff802fc8a73ec289ce84d1e54451668e.tar.bz2 dexon-sol-tools-941df26dff802fc8a73ec289ce84d1e54451668e.tar.lz dexon-sol-tools-941df26dff802fc8a73ec289ce84d1e54451668e.tar.xz dexon-sol-tools-941df26dff802fc8a73ec289ce84d1e54451668e.tar.zst dexon-sol-tools-941df26dff802fc8a73ec289ce84d1e54451668e.zip |
Add tests for signedOrderSchema
Diffstat (limited to 'test')
-rw-r--r-- | test/schema_test.ts | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/test/schema_test.ts b/test/schema_test.ts index 392db1c3b..fb5aba321 100644 --- a/test/schema_test.ts +++ b/test/schema_test.ts @@ -158,6 +158,41 @@ describe('Schema', () => { validateAgainstSchema(testCases, orderSchema, true); }); }); + describe('#signedOrderSchema', () => { + const signedOrder = { + 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, + ecSignature: { + v: 27, + r: '0x61a3ed31b43c8780e905a260a35faefcc527be7516aa11c0256729b5b351bc33', + s: '0x40349190569279751135161d22529dc25add4f6069af05be04cacbda2ace2254', + }, + }; + it('should validate valid order', () => { + const testCases = [ + signedOrder, + ]; + validateAgainstSchema(testCases, orderSchema); + }); + it('should fail for invalid order', () => { + const testCases = [ + { + ...signedOrder, + ecSignature: undefined, + }, + ]; + validateAgainstSchema(testCases, orderSchema, true); + }); + }); describe('BigNumber serialization', () => { it('should correctly serialize BigNumbers', () => { const testCases = { |