diff options
author | Fabio Berger <me@fabioberger.com> | 2017-06-01 23:04:05 +0800 |
---|---|---|
committer | Fabio Berger <me@fabioberger.com> | 2017-06-01 23:04:05 +0800 |
commit | 33940ec8fee91b2c64ffd45816a223c9a3096d7e (patch) | |
tree | 43ae5b7d5c0430e15f1cffed6263acab1172c36c | |
parent | 60d658a0249cdfb54d0763eb322cf6b16a1af36e (diff) | |
parent | af61b5a9089b2575c8f0a44e1f0bceac41bb891f (diff) | |
download | dexon-sol-tools-33940ec8fee91b2c64ffd45816a223c9a3096d7e.tar dexon-sol-tools-33940ec8fee91b2c64ffd45816a223c9a3096d7e.tar.gz dexon-sol-tools-33940ec8fee91b2c64ffd45816a223c9a3096d7e.tar.bz2 dexon-sol-tools-33940ec8fee91b2c64ffd45816a223c9a3096d7e.tar.lz dexon-sol-tools-33940ec8fee91b2c64ffd45816a223c9a3096d7e.tar.xz dexon-sol-tools-33940ec8fee91b2c64ffd45816a223c9a3096d7e.tar.zst dexon-sol-tools-33940ec8fee91b2c64ffd45816a223c9a3096d7e.zip |
Merge branch 'fillOrderAsync' of github.com:0xProject/0x.js into fillOrderAsync
-rw-r--r-- | test/exchange_wrapper_test.ts | 19 |
1 files changed, 10 insertions, 9 deletions
diff --git a/test/exchange_wrapper_test.ts b/test/exchange_wrapper_test.ts index 251bd03ec..04fd6a7e1 100644 --- a/test/exchange_wrapper_test.ts +++ b/test/exchange_wrapper_test.ts @@ -108,6 +108,8 @@ describe('ExchangeWrapper', () => { const addressBySymbol: {[symbol: string]: string} = {}; let networkId: number; const shouldCheckTransfer = false; + let maker: string; + let taker: string; const setBalance = async (toAddress: string, amountInBaseUnits: BigNumber.BigNumber|number, tokenAddress: string) => { @@ -127,19 +129,23 @@ describe('ExchangeWrapper', () => { }); networkId = await promisify(web3.version.getNetwork)(); }); + beforeEach('setup', () => { + maker = userAddresses[0]; + taker = userAddresses[1]; + }); + afterEach('reset default account', () => { + zeroEx.setDefaultAccount(userAddresses[0]); + }); describe('failed fills', () => { it('should throw when the fill amount is zero', async () => { - const maker = userAddresses[0]; - const taker = userAddresses[0]; const signedOrder = await orderFactory.createSignedOrderAsync(zeroEx, networkId, maker, taker, 5, addressBySymbol.MLN, 5, addressBySymbol.GNT); const fillAmount = new BigNumber(0); + zeroEx.setDefaultAccount(taker); expect(zeroEx.exchange.fillOrderAsync(signedOrder, fillAmount, shouldCheckTransfer)) .to.be.rejectedWith(FillOrderValidationErrs.FILL_AMOUNT_IS_ZERO); }); it('should throw when sender is not a taker', async () => { - const maker = userAddresses[0]; - const taker = userAddresses[1]; const signedOrder = await orderFactory.createSignedOrderAsync(zeroEx, networkId, maker, taker, 5, addressBySymbol.MLN, 5, addressBySymbol.GNT); const fillAmount = new BigNumber(5); @@ -148,12 +154,7 @@ describe('ExchangeWrapper', () => { }); }); describe('successful fills', () => { - afterEach('reset default account', () => { - zeroEx.setDefaultAccount(userAddresses[0]); - }); it('should fill the valid order', async () => { - const maker = userAddresses[0]; - const taker = userAddresses[1]; await setAllowance(maker, 5, addressBySymbol.MLN); await setBalance(taker, 5, addressBySymbol.GNT); await setAllowance(taker, 5, addressBySymbol.GNT); |