From 0d4ff5a916694be7cb5772bbd7d3e610522e09df Mon Sep 17 00:00:00 2001 From: Greg Hysen Date: Thu, 7 Jun 2018 13:56:10 -0700 Subject: Updated tests to use new revert handler --- packages/contracts/test/asset_proxy/proxies.ts | 4 ++-- packages/contracts/test/libraries/lib_bytes.ts | 22 +++++++++++----------- 2 files changed, 13 insertions(+), 13 deletions(-) (limited to 'packages/contracts') diff --git a/packages/contracts/test/asset_proxy/proxies.ts b/packages/contracts/test/asset_proxy/proxies.ts index 0548a2aac..ea236ab24 100644 --- a/packages/contracts/test/asset_proxy/proxies.ts +++ b/packages/contracts/test/asset_proxy/proxies.ts @@ -341,7 +341,7 @@ describe('Asset Transfer Proxies', () => { // Perform a transfer from makerAddress to takerAddress const erc20Balances = await erc20Wrapper.getBalancesAsync(); const amount = new BigNumber(1); - return expect( + return expectRevertOrAlwaysFailingTransactionAsync( erc721Proxy.transferFrom.sendTransactionAsync( encodedAssetData, makerAddress, @@ -349,7 +349,7 @@ describe('Asset Transfer Proxies', () => { amount, { from: exchangeAddress }, ), - ).to.be.rejectedWith(constants.REVERT); + ); }); it('should throw if transferring 0 amount of a token', async () => { diff --git a/packages/contracts/test/libraries/lib_bytes.ts b/packages/contracts/test/libraries/lib_bytes.ts index 5830c5753..e0d214ea2 100644 --- a/packages/contracts/test/libraries/lib_bytes.ts +++ b/packages/contracts/test/libraries/lib_bytes.ts @@ -385,27 +385,27 @@ describe('LibBytes', () => { it('should fail if the byte array is too short to hold the length of a nested byte array)', async () => { // The length of the nested array is 32 bytes. By storing less than 32 bytes, a length cannot be read. const offset = new BigNumber(0); - return expect(libBytes.publicReadBytes.callAsync(byteArrayShorterThan32Bytes, offset)).to.be.rejectedWith( - constants.REVERT, + return expectRevertOrAlwaysFailingTransactionAsync( + libBytes.publicReadBytes.callAsync(byteArrayShorterThan32Bytes, offset), ); }); it('should fail if we store a nested byte array length, without a nested byte array)', async () => { const offset = new BigNumber(0); - return expect(libBytes.publicReadBytes.callAsync(testBytes32, offset)).to.be.rejectedWith(constants.REVERT); + return expectRevertOrAlwaysFailingTransactionAsync(libBytes.publicReadBytes.callAsync(testBytes32, offset)); }); it('should fail if the length between the offset and end of the byte array is too short to hold the length of a nested byte array)', async () => { const badOffset = new BigNumber(ethUtil.toBuffer(byteArrayShorterThan32Bytes).byteLength); - return expect( + return expectRevertOrAlwaysFailingTransactionAsync( libBytes.publicReadBytes.callAsync(byteArrayShorterThan32Bytes, badOffset), - ).to.be.rejectedWith(constants.REVERT); + ); }); it('should fail if the length between the offset and end of the byte array is too short to hold the nested byte array)', async () => { const badOffset = new BigNumber(ethUtil.toBuffer(testBytes32).byteLength); - return expect(libBytes.publicReadBytes.callAsync(testBytes32, badOffset)).to.be.rejectedWith( - constants.REVERT, + return expectRevertOrAlwaysFailingTransactionAsync( + libBytes.publicReadBytes.callAsync(testBytes32, badOffset), ); }); }); @@ -489,16 +489,16 @@ describe('LibBytes', () => { it('should fail if the byte array is too short to hold the length of a nested byte array)', async () => { const offset = new BigNumber(0); const emptyByteArray = ethUtil.bufferToHex(new Buffer(1)); - return expect(libBytes.publicWriteBytes.callAsync(emptyByteArray, offset, longData)).to.be.rejectedWith( - constants.REVERT, + return expectRevertOrAlwaysFailingTransactionAsync( + libBytes.publicWriteBytes.callAsync(emptyByteArray, offset, longData), ); }); it('should fail if the length between the offset and end of the byte array is too short to hold the length of a nested byte array)', async () => { const emptyByteArray = ethUtil.bufferToHex(new Buffer(shortTestBytesAsBuffer.byteLength)); const badOffset = new BigNumber(ethUtil.toBuffer(shortTestBytesAsBuffer).byteLength); - return expect(libBytes.publicWriteBytes.callAsync(emptyByteArray, badOffset, shortData)).to.be.rejectedWith( - constants.REVERT, + return expectRevertOrAlwaysFailingTransactionAsync( + libBytes.publicWriteBytes.callAsync(emptyByteArray, badOffset, shortData), ); }); }); -- cgit