diff options
author | Amir Bandeali <abandeali1@gmail.com> | 2018-04-10 01:44:39 +0800 |
---|---|---|
committer | Amir Bandeali <abandeali1@gmail.com> | 2018-04-21 04:56:17 +0800 |
commit | 84d836f22b4bc5410c5d96137eff261b698b622e (patch) | |
tree | 8555f8d4ec64a57c495fea44f403c3fac77ef0bd /packages/contracts/test | |
parent | 5d05a2da7416d37da81d004d489c69d7326d9cce (diff) | |
download | dexon-sol-tools-84d836f22b4bc5410c5d96137eff261b698b622e.tar dexon-sol-tools-84d836f22b4bc5410c5d96137eff261b698b622e.tar.gz dexon-sol-tools-84d836f22b4bc5410c5d96137eff261b698b622e.tar.bz2 dexon-sol-tools-84d836f22b4bc5410c5d96137eff261b698b622e.tar.lz dexon-sol-tools-84d836f22b4bc5410c5d96137eff261b698b622e.tar.xz dexon-sol-tools-84d836f22b4bc5410c5d96137eff261b698b622e.tar.zst dexon-sol-tools-84d836f22b4bc5410c5d96137eff261b698b622e.zip |
Add back require statements and tests (will move to another PR)
Diffstat (limited to 'packages/contracts/test')
-rw-r--r-- | packages/contracts/test/exchange/core.ts | 42 |
1 files changed, 42 insertions, 0 deletions
diff --git a/packages/contracts/test/exchange/core.ts b/packages/contracts/test/exchange/core.ts index df4915403..ef3b3b9ee 100644 --- a/packages/contracts/test/exchange/core.ts +++ b/packages/contracts/test/exchange/core.ts @@ -501,6 +501,32 @@ describe('Exchange', () => { return expect(exWrapper.fillOrderAsync(signedOrder, takerAddress)).to.be.rejectedWith(constants.REVERT); }); + it('should throw if makerTokenAmount is 0', async () => { + signedOrder = orderFactory.newSignedOrder({ + makerTokenAmount: new BigNumber(0), + }); + + return expect(exWrapper.fillOrderAsync(signedOrder, takerAddress)).to.be.rejectedWith(constants.REVERT); + }); + + it('should throw if takerTokenAmount is 0', async () => { + signedOrder = orderFactory.newSignedOrder({ + takerTokenAmount: new BigNumber(0), + }); + + return expect(exWrapper.fillOrderAsync(signedOrder, takerAddress)).to.be.rejectedWith(constants.REVERT); + }); + + it('should throw if takerTokenFillAmount is 0', async () => { + signedOrder = orderFactory.newSignedOrder(); + + return expect( + exWrapper.fillOrderAsync(signedOrder, takerAddress, { + takerTokenFillAmount: new BigNumber(0), + }), + ).to.be.rejectedWith(constants.REVERT); + }); + it('should throw if maker balances are too low to fill order', async () => { signedOrder = orderFactory.newSignedOrder({ makerTokenAmount: ZeroEx.toBaseUnitAmount(new BigNumber(100000), 18), @@ -581,6 +607,22 @@ describe('Exchange', () => { return expect(exWrapper.cancelOrderAsync(signedOrder, takerAddress)).to.be.rejectedWith(constants.REVERT); }); + it('should throw if makerTokenAmount is 0', async () => { + signedOrder = orderFactory.newSignedOrder({ + makerTokenAmount: new BigNumber(0), + }); + + return expect(exWrapper.cancelOrderAsync(signedOrder, makerAddress)).to.be.rejectedWith(constants.REVERT); + }); + + it('should throw if takerTokenAmount is 0', async () => { + signedOrder = orderFactory.newSignedOrder({ + takerTokenAmount: new BigNumber(0), + }); + + return expect(exWrapper.cancelOrderAsync(signedOrder, makerAddress)).to.be.rejectedWith(constants.REVERT); + }); + it('should be able to cancel a full order', async () => { await exWrapper.cancelOrderAsync(signedOrder, makerAddress); await exWrapper.fillOrderAsync(signedOrder, takerAddress, { |