diff options
author | Fabio Berger <me@fabioberger.com> | 2017-06-01 23:38:09 +0800 |
---|---|---|
committer | Fabio Berger <me@fabioberger.com> | 2017-06-01 23:38:09 +0800 |
commit | 24a745092e0f7a626f5cbcfaef2e56567f0ace1d (patch) | |
tree | 04593ccd79ce1a7657c5c858fc54608dc2c68986 /test/0x.js_test.ts | |
parent | 7ff0f677a12386a119bcadbdabd0721f9fc4cbce (diff) | |
download | dexon-sol-tools-24a745092e0f7a626f5cbcfaef2e56567f0ace1d.tar dexon-sol-tools-24a745092e0f7a626f5cbcfaef2e56567f0ace1d.tar.gz dexon-sol-tools-24a745092e0f7a626f5cbcfaef2e56567f0ace1d.tar.bz2 dexon-sol-tools-24a745092e0f7a626f5cbcfaef2e56567f0ace1d.tar.lz dexon-sol-tools-24a745092e0f7a626f5cbcfaef2e56567f0ace1d.tar.xz dexon-sol-tools-24a745092e0f7a626f5cbcfaef2e56567f0ace1d.tar.zst dexon-sol-tools-24a745092e0f7a626f5cbcfaef2e56567f0ace1d.zip |
Stop passing exchangeAddress into getOrderHash and instead get it from the artifacts
Diffstat (limited to 'test/0x.js_test.ts')
-rw-r--r-- | test/0x.js_test.ts | 43 |
1 files changed, 22 insertions, 21 deletions
diff --git a/test/0x.js_test.ts b/test/0x.js_test.ts index f2bb40d75..8c5e9c929 100644 --- a/test/0x.js_test.ts +++ b/test/0x.js_test.ts @@ -43,27 +43,6 @@ describe('ZeroEx library', () => { expect((tokenRegistryWeb3WrapperProvider as any).zeroExTestId).to.be.a('number'); }); }); - describe('#getOrderHash', () => { - const expectedOrderHash = '0x103a5e97dab5dbeb8f385636f86a7d1e458a7ccbe1bd194727f0b2f85ab116c7'; - const order: Order = { - maker: constants.NULL_ADDRESS, - taker: constants.NULL_ADDRESS, - feeRecipient: constants.NULL_ADDRESS, - makerTokenAddress: constants.NULL_ADDRESS, - takerTokenAddress: constants.NULL_ADDRESS, - salt: new BigNumber(0), - makerFee: new BigNumber(0), - takerFee: new BigNumber(0), - makerTokenAmount: new BigNumber(0), - takerTokenAmount: new BigNumber(0), - expirationUnixTimestampSec: new BigNumber(0), - }; - const exchangeAddress = constants.NULL_ADDRESS; - it('calculates the order hash', () => { - const orderHash = ZeroEx.getOrderHashHex(exchangeAddress, order); - expect(orderHash).to.be.equal(expectedOrderHash); - }); - }); describe('#isValidSignature', () => { // This test data was borrowed from the JSON RPC documentation // Source: https://github.com/ethereum/wiki/wiki/JSON-RPC#eth_sign @@ -174,6 +153,28 @@ describe('ZeroEx library', () => { expect(baseUnitAmount).to.be.bignumber.equal(expectedUnitAmount); }); }); + describe('#getOrderHashAsync', () => { + const expectedOrderHash = '0x103a5e97dab5dbeb8f385636f86a7d1e458a7ccbe1bd194727f0b2f85ab116c7'; + const order: Order = { + maker: constants.NULL_ADDRESS, + taker: constants.NULL_ADDRESS, + feeRecipient: constants.NULL_ADDRESS, + makerTokenAddress: constants.NULL_ADDRESS, + takerTokenAddress: constants.NULL_ADDRESS, + salt: new BigNumber(0), + makerFee: new BigNumber(0), + takerFee: new BigNumber(0), + makerTokenAmount: new BigNumber(0), + takerTokenAmount: new BigNumber(0), + expirationUnixTimestampSec: new BigNumber(0), + }; + it('calculates the order hash', async () => { + const web3 = web3Factory.create(); + const zeroEx = new ZeroEx(web3); + const orderHash = await zeroEx.getOrderHashHexAsync(order); + expect(orderHash).to.be.equal(expectedOrderHash); + }); + }); describe('#signOrderHashAsync', () => { let stubs: Sinon.SinonStub[] = []; afterEach(() => { |