From bac6833436960d2a7eb50d89e94fed226a16008b Mon Sep 17 00:00:00 2001 From: Leonid Logvinov Date: Mon, 5 Jun 2017 16:22:56 +0200 Subject: Make methods accept senderAccount --- test/0x.js_test.ts | 22 ++++++++++------------ 1 file changed, 10 insertions(+), 12 deletions(-) (limited to 'test/0x.js_test.ts') diff --git a/test/0x.js_test.ts b/test/0x.js_test.ts index 8686b42eb..a82ec45ba 100644 --- a/test/0x.js_test.ts +++ b/test/0x.js_test.ts @@ -191,6 +191,13 @@ describe('ZeroEx library', () => { }); describe('#signOrderHashAsync', () => { let stubs: Sinon.SinonStub[] = []; + let makerAccount: string; + const web3 = web3Factory.create(); + const zeroEx = new ZeroEx(web3); + before('get maker account', async () => { + const availableAccounts = await zeroEx.getAvailableAccountsAsync(); + makerAccount = availableAccounts[0]; + }); afterEach(() => { // clean up any stubs after the test has completed _.each(stubs, s => s.restore()); @@ -203,10 +210,7 @@ describe('ZeroEx library', () => { r: '0x61a3ed31b43c8780e905a260a35faefcc527be7516aa11c0256729b5b351bc33', s: '0x40349190569279751135161d22529dc25add4f6069af05be04cacbda2ace2254', }; - - const web3 = web3Factory.create(); - const zeroEx = new ZeroEx(web3); - const ecSignature = await zeroEx.signOrderHashAsync(orderHash); + const ecSignature = await zeroEx.signOrderHashAsync(orderHash, makerAccount); expect(ecSignature).to.deep.equal(expectedECSignature); }); it ('should return the correct ECSignature on Parity > V1.6.6', async () => { @@ -219,9 +223,6 @@ describe('ZeroEx library', () => { r: '0x22109d11d79cb8bf96ed88625e1cd9558800c4073332a9a02857499883ee5ce3', s: '0x050aa3cc1f2c435e67e114cdce54b9527b4f50548342401bc5d2b77adbdacb02', }; - - const web3 = web3Factory.create(); - const zeroEx = new ZeroEx(web3); stubs = [ Sinon.stub((zeroEx as any).web3Wrapper, 'getNodeVersionAsync') .returns(Promise.resolve(newParityNodeVersion)), @@ -230,7 +231,7 @@ describe('ZeroEx library', () => { Sinon.stub(ZeroEx, 'isValidSignature').returns(true), ]; - const ecSignature = await zeroEx.signOrderHashAsync(orderHash); + const ecSignature = await zeroEx.signOrderHashAsync(orderHash, makerAccount); expect(ecSignature).to.deep.equal(expectedECSignature); }); it ('should return the correct ECSignature on Parity < V1.6.6', async () => { @@ -243,9 +244,6 @@ describe('ZeroEx library', () => { r: '0xc80bedc6756722672753413efdd749b5adbd4fd552595f59c13427407ee9aee0', s: '0x2dea66f25a608bbae457e020fb6decb763deb8b7192abab624997242da248960', }; - - const web3 = web3Factory.create(); - const zeroEx = new ZeroEx(web3); stubs = [ Sinon.stub((zeroEx as any).web3Wrapper, 'getNodeVersionAsync') .returns(Promise.resolve(newParityNodeVersion)), @@ -254,7 +252,7 @@ describe('ZeroEx library', () => { Sinon.stub(ZeroEx, 'isValidSignature').returns(true), ]; - const ecSignature = await zeroEx.signOrderHashAsync(orderHash); + const ecSignature = await zeroEx.signOrderHashAsync(orderHash, makerAccount); expect(ecSignature).to.deep.equal(expectedECSignature); }); }); -- cgit v1.2.3