diff options
author | Fabio Berger <me@fabioberger.com> | 2018-05-31 08:55:16 +0800 |
---|---|---|
committer | Fabio Berger <me@fabioberger.com> | 2018-05-31 08:55:16 +0800 |
commit | aa997f1be516f15e103cb9a3de9090764d6c5f1c (patch) | |
tree | e8b291bdfab0af91c6ec01e02e90a823168e08e3 /packages/order-utils/test | |
parent | 4eb58a70bb833af6a658c4e047d2a3ece92a5f44 (diff) | |
download | dexon-sol-tools-aa997f1be516f15e103cb9a3de9090764d6c5f1c.tar dexon-sol-tools-aa997f1be516f15e103cb9a3de9090764d6c5f1c.tar.gz dexon-sol-tools-aa997f1be516f15e103cb9a3de9090764d6c5f1c.tar.bz2 dexon-sol-tools-aa997f1be516f15e103cb9a3de9090764d6c5f1c.tar.lz dexon-sol-tools-aa997f1be516f15e103cb9a3de9090764d6c5f1c.tar.xz dexon-sol-tools-aa997f1be516f15e103cb9a3de9090764d6c5f1c.tar.zst dexon-sol-tools-aa997f1be516f15e103cb9a3de9090764d6c5f1c.zip |
Move isValidOrderHash to the order_hash_test file
Diffstat (limited to 'packages/order-utils/test')
-rw-r--r-- | packages/order-utils/test/order_hash_test.ts | 15 | ||||
-rw-r--r-- | packages/order-utils/test/signature_utils_test.ts | 15 |
2 files changed, 15 insertions, 15 deletions
diff --git a/packages/order-utils/test/order_hash_test.ts b/packages/order-utils/test/order_hash_test.ts index 21ae22589..d571fc62a 100644 --- a/packages/order-utils/test/order_hash_test.ts +++ b/packages/order-utils/test/order_hash_test.ts @@ -46,4 +46,19 @@ describe('Order hashing', () => { expect(() => orderHashUtils.getOrderHashHex(orderWithInvalidtakerFormat)).to.throw(expectedErrorMessage); }); }); + describe('#isValidOrderHash', () => { + it('returns false if the value is not a hex string', () => { + const isValid = orderHashUtils.isValidOrderHash('not a hex'); + expect(isValid).to.be.false(); + }); + it('returns false if the length is wrong', () => { + const isValid = orderHashUtils.isValidOrderHash('0xdeadbeef'); + expect(isValid).to.be.false(); + }); + it('returns true if order hash is correct', () => { + const orderHashLength = 65; + const isValid = orderHashUtils.isValidOrderHash('0x' + Array(orderHashLength).join('0')); + expect(isValid).to.be.true(); + }); + }); }); diff --git a/packages/order-utils/test/signature_utils_test.ts b/packages/order-utils/test/signature_utils_test.ts index 773a32a56..321e7313f 100644 --- a/packages/order-utils/test/signature_utils_test.ts +++ b/packages/order-utils/test/signature_utils_test.ts @@ -111,21 +111,6 @@ describe('Signature utils', () => { expect(salt.lessThan(twoPow256)).to.be.true(); }); }); - describe('#isValidOrderHash', () => { - it('returns false if the value is not a hex string', () => { - const isValid = orderHashUtils.isValidOrderHash('not a hex'); - expect(isValid).to.be.false(); - }); - it('returns false if the length is wrong', () => { - const isValid = orderHashUtils.isValidOrderHash('0xdeadbeef'); - expect(isValid).to.be.false(); - }); - it('returns true if order hash is correct', () => { - const orderHashLength = 65; - const isValid = orderHashUtils.isValidOrderHash('0x' + Array(orderHashLength).join('0')); - expect(isValid).to.be.true(); - }); - }); describe('#ecSignOrderHashAsync', () => { let stubs: Sinon.SinonStub[] = []; let makerAddress: string; |