diff options
author | fragosti <francesco.agosti93@gmail.com> | 2018-10-10 09:25:14 +0800 |
---|---|---|
committer | fragosti <francesco.agosti93@gmail.com> | 2018-10-10 09:25:14 +0800 |
commit | 2bd8cbb80cadc922ca13582a1f15d63815118205 (patch) | |
tree | f81ae5e91e720fe228d83b0e8af0fc676f35b7c5 /packages/order-utils/test/order_hash_test.ts | |
parent | 941448d65cc42870a93e0430158bfd7ab52fd2cd (diff) | |
parent | afb34da72978b5272cfb5a235498e483c72556bc (diff) | |
download | dexon-sol-tools-2bd8cbb80cadc922ca13582a1f15d63815118205.tar dexon-sol-tools-2bd8cbb80cadc922ca13582a1f15d63815118205.tar.gz dexon-sol-tools-2bd8cbb80cadc922ca13582a1f15d63815118205.tar.bz2 dexon-sol-tools-2bd8cbb80cadc922ca13582a1f15d63815118205.tar.lz dexon-sol-tools-2bd8cbb80cadc922ca13582a1f15d63815118205.tar.xz dexon-sol-tools-2bd8cbb80cadc922ca13582a1f15d63815118205.tar.zst dexon-sol-tools-2bd8cbb80cadc922ca13582a1f15d63815118205.zip |
Merge branch 'development' of https://github.com/0xProject/0x-monorepo into feature/instant/redux-styles-container
Diffstat (limited to 'packages/order-utils/test/order_hash_test.ts')
-rw-r--r-- | packages/order-utils/test/order_hash_test.ts | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/packages/order-utils/test/order_hash_test.ts b/packages/order-utils/test/order_hash_test.ts index 3fdbbad21..fe44218d6 100644 --- a/packages/order-utils/test/order_hash_test.ts +++ b/packages/order-utils/test/order_hash_test.ts @@ -35,6 +35,20 @@ describe('Order hashing', () => { const orderHash = orderHashUtils.getOrderHashHex(order); expect(orderHash).to.be.equal(expectedOrderHash); }); + it('calculates the order hash if amounts are strings', async () => { + // It's common for developers using javascript to provide the amounts + // as strings. Since we eventually toString() the BigNumber + // before encoding we should result in the same orderHash in this scenario + // tslint:disable-next-line:no-unnecessary-type-assertion + const orderHash = orderHashUtils.getOrderHashHex({ + ...order, + makerAssetAmount: '0', + takerAssetAmount: '0', + makerFee: '0', + takerFee: '0', + } as any); + expect(orderHash).to.be.equal(expectedOrderHash); + }); it('throws a readable error message if taker format is invalid', async () => { const orderWithInvalidtakerFormat = { ...order, |