aboutsummaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorLeonid Logvinov <logvinov.leon@gmail.com>2017-06-01 23:09:02 +0800
committerLeonid Logvinov <logvinov.leon@gmail.com>2017-06-01 23:10:35 +0800
commit9a3cd3d06c5cb74e772685501bedee7e3fce5990 (patch)
treea177f2c1fdbf123f42f31f705819ed62d7f09681 /test
parentbcc8e43ab889b98bc2ebe2f4f6c172cbef925838 (diff)
downloaddexon-sol-tools-9a3cd3d06c5cb74e772685501bedee7e3fce5990.tar
dexon-sol-tools-9a3cd3d06c5cb74e772685501bedee7e3fce5990.tar.gz
dexon-sol-tools-9a3cd3d06c5cb74e772685501bedee7e3fce5990.tar.bz2
dexon-sol-tools-9a3cd3d06c5cb74e772685501bedee7e3fce5990.tar.lz
dexon-sol-tools-9a3cd3d06c5cb74e772685501bedee7e3fce5990.tar.xz
dexon-sol-tools-9a3cd3d06c5cb74e772685501bedee7e3fce5990.tar.zst
dexon-sol-tools-9a3cd3d06c5cb74e772685501bedee7e3fce5990.zip
Add test, for throw when order is expired
Diffstat (limited to 'test')
-rw-r--r--test/exchange_wrapper_test.ts17
1 files changed, 14 insertions, 3 deletions
diff --git a/test/exchange_wrapper_test.ts b/test/exchange_wrapper_test.ts
index 4d28dd2bd..92e2514dd 100644
--- a/test/exchange_wrapper_test.ts
+++ b/test/exchange_wrapper_test.ts
@@ -104,6 +104,10 @@ describe('ExchangeWrapper', () => {
});
describe('#fillOrderAsync', () => {
let tokens: Token[];
+ const addressBySymbol: {[symbol: string]: string} = {};
+ let networkId: number;
+ const fillAmount = new BigNumber(5);
+ const shouldCheckTransfer = false;
let maker: string;
let taker: string;
let networkId: number;
@@ -139,18 +143,25 @@ describe('ExchangeWrapper', () => {
it('should throw when the fill amount is zero', async () => {
const signedOrder = await orderFactory.createSignedOrderAsync(zeroEx, networkId, maker, taker,
5, addressBySymbol.MLN, 5, addressBySymbol.GNT);
- const fillAmount = new BigNumber(0);
+ const zeroFillAmount = new BigNumber(0);
zeroEx.setDefaultAccount(taker);
- expect(zeroEx.exchange.fillOrderAsync(signedOrder, fillAmount, shouldCheckTransfer))
+ expect(zeroEx.exchange.fillOrderAsync(signedOrder, zeroFillAmount, shouldCheckTransfer))
.to.be.rejectedWith(FillOrderValidationErrs.FILL_AMOUNT_IS_ZERO);
});
it('should throw when sender is not a taker', async () => {
const signedOrder = await orderFactory.createSignedOrderAsync(zeroEx, networkId, maker, taker,
5, addressBySymbol.MLN, 5, addressBySymbol.GNT);
- const fillAmount = new BigNumber(5);
expect(zeroEx.exchange.fillOrderAsync(signedOrder, fillAmount, shouldCheckTransfer))
.to.be.rejectedWith(FillOrderValidationErrs.NOT_A_TAKER);
});
+ it('should throw when order is expired', async () => {
+ const OLD_TIMESTAMP = new BigNumber(42);
+ const signedOrder = await orderFactory.createSignedOrderAsync(zeroEx, networkId, maker, taker,
+ 5, addressBySymbol.MLN, 5, addressBySymbol.GNT, OLD_TIMESTAMP);
+ zeroEx.setDefaultAccount(taker);
+ expect(zeroEx.exchange.fillOrderAsync(signedOrder, fillAmount, shouldCheckTransfer))
+ .to.be.rejectedWith(FillOrderValidationErrs.EXPIRED);
+ });
});
describe('successful fills', () => {
it('should fill the valid order', async () => {