aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFabio Berger <me@fabioberger.com>2017-06-01 23:49:53 +0800
committerFabio Berger <me@fabioberger.com>2017-06-01 23:49:53 +0800
commit69a596352d47502e810adc10ffd0c89b7fa2d1d0 (patch)
tree7cf3267941e4ff28ed3e5a75aca976c8bbd19304
parent29955d3606f836a14bd491a8779f6a607d5fa469 (diff)
downloaddexon-sol-tools-69a596352d47502e810adc10ffd0c89b7fa2d1d0.tar
dexon-sol-tools-69a596352d47502e810adc10ffd0c89b7fa2d1d0.tar.gz
dexon-sol-tools-69a596352d47502e810adc10ffd0c89b7fa2d1d0.tar.bz2
dexon-sol-tools-69a596352d47502e810adc10ffd0c89b7fa2d1d0.tar.lz
dexon-sol-tools-69a596352d47502e810adc10ffd0c89b7fa2d1d0.tar.xz
dexon-sol-tools-69a596352d47502e810adc10ffd0c89b7fa2d1d0.tar.zst
dexon-sol-tools-69a596352d47502e810adc10ffd0c89b7fa2d1d0.zip
Fix getOrderHashAsync test
-rw-r--r--test/0x.js_test.ts13
1 files changed, 13 insertions, 0 deletions
diff --git a/test/0x.js_test.ts b/test/0x.js_test.ts
index 8c5e9c929..efc703ea1 100644
--- a/test/0x.js_test.ts
+++ b/test/0x.js_test.ts
@@ -154,6 +154,7 @@ describe('ZeroEx library', () => {
});
});
describe('#getOrderHashAsync', () => {
+ const exchangeContractAddress = constants.NULL_ADDRESS;
const expectedOrderHash = '0x103a5e97dab5dbeb8f385636f86a7d1e458a7ccbe1bd194727f0b2f85ab116c7';
const order: Order = {
maker: constants.NULL_ADDRESS,
@@ -168,9 +169,21 @@ describe('ZeroEx library', () => {
takerTokenAmount: new BigNumber(0),
expirationUnixTimestampSec: new BigNumber(0),
};
+ let stubs: Sinon.SinonStub[] = [];
+ afterEach(() => {
+ // clean up any stubs after the test has completed
+ _.each(stubs, s => s.restore());
+ stubs = [];
+ });
it('calculates the order hash', async () => {
const web3 = web3Factory.create();
const zeroEx = new ZeroEx(web3);
+
+ stubs = [
+ Sinon.stub((zeroEx as any), 'getExchangeAddressAsync')
+ .returns(Promise.resolve(exchangeContractAddress)),
+ ];
+
const orderHash = await zeroEx.getOrderHashHexAsync(order);
expect(orderHash).to.be.equal(expectedOrderHash);
});