diff options
author | Leonid Logvinov <logvinov.leon@gmail.com> | 2017-05-25 23:24:29 +0800 |
---|---|---|
committer | Leonid Logvinov <logvinov.leon@gmail.com> | 2017-05-25 23:24:29 +0800 |
commit | f2f39d9eb2822b71aa7c5cf6f3b2ef006a83ad03 (patch) | |
tree | c2a474aebcbdc93834afc1374908fbf4677d2381 /test | |
parent | f7b8378a6eb4b4c6c3461ff677723869c67a4753 (diff) | |
download | dexon-sol-tools-f2f39d9eb2822b71aa7c5cf6f3b2ef006a83ad03.tar.gz dexon-sol-tools-f2f39d9eb2822b71aa7c5cf6f3b2ef006a83ad03.tar.zst dexon-sol-tools-f2f39d9eb2822b71aa7c5cf6f3b2ef006a83ad03.zip |
Port getOrderHash
Diffstat (limited to 'test')
-rw-r--r-- | test/0x.js.ts | 37 |
1 files changed, 37 insertions, 0 deletions
diff --git a/test/0x.js.ts b/test/0x.js.ts index a913fd6b5..07c58f1a5 100644 --- a/test/0x.js.ts +++ b/test/0x.js.ts @@ -3,12 +3,49 @@ import * as chai from 'chai'; import 'mocha'; import * as BigNumber from 'bignumber.js'; import ChaiBigNumber = require('chai-bignumber'); +import {constants} from '../src/ts/utils/constants'; // Use BigNumber chai add-on chai.use(ChaiBigNumber()); const expect = chai.expect; describe('ZeroEx library', () => { + describe('#getOrderHash', () => { + it('defaults takerAddress to NULL address', () => { + const orderHash = ZeroEx.getOrderHash( + constants.NULL_ADDRESS, + constants.NULL_ADDRESS, + '', + constants.NULL_ADDRESS, + constants.NULL_ADDRESS, + constants.NULL_ADDRESS, + new BigNumber(0), + new BigNumber(0), + new BigNumber(0), + new BigNumber(0), + new BigNumber(0), + new BigNumber(0), + ); + expect(orderHash).to.be.equal('0x103a5e97dab5dbeb8f385636f86a7d1e458a7ccbe1bd194727f0b2f85ab116c7'); + }); + it('calculates the order hash', () => { + const orderHash = ZeroEx.getOrderHash( + constants.NULL_ADDRESS, + constants.NULL_ADDRESS, + constants.NULL_ADDRESS, + constants.NULL_ADDRESS, + constants.NULL_ADDRESS, + constants.NULL_ADDRESS, + new BigNumber(0), + new BigNumber(0), + new BigNumber(0), + new BigNumber(0), + new BigNumber(0), + new BigNumber(0), + ); + expect(orderHash).to.be.equal('0x103a5e97dab5dbeb8f385636f86a7d1e458a7ccbe1bd194727f0b2f85ab116c7'); + }); + }); describe('#isValidSignature', () => { // This test data was borrowed from the JSON RPC documentation // Source: https://github.com/ethereum/wiki/wiki/JSON-RPC#eth_sign |