From 1cc9d9c0713a56b59717498fcae6dc2720ca4fb0 Mon Sep 17 00:00:00 2001 From: Alex Browne Date: Tue, 22 May 2018 12:47:37 -0700 Subject: Replace constant.REVERT test assertions with expectRevertOrAlwaysFailingTransaction --- packages/contracts/test/libraries/lib_bytes.ts | 25 +++++++++---------------- 1 file changed, 9 insertions(+), 16 deletions(-) (limited to 'packages/contracts/test/libraries') diff --git a/packages/contracts/test/libraries/lib_bytes.ts b/packages/contracts/test/libraries/lib_bytes.ts index 26cfa8291..e639e6db1 100644 --- a/packages/contracts/test/libraries/lib_bytes.ts +++ b/packages/contracts/test/libraries/lib_bytes.ts @@ -10,6 +10,7 @@ import * as Web3 from 'web3'; import { TestLibBytesContract } from '../../src/contract_wrappers/generated/test_lib_bytes'; import { artifacts } from '../../src/utils/artifacts'; +import { expectRevertOrAlwaysFailingTransaction } from '../../src/utils/assertions'; import { chaiSetup } from '../../src/utils/chai_setup'; import { constants } from '../../src/utils/constants'; import { provider, txDefaults, web3Wrapper } from '../../src/utils/web3_wrapper'; @@ -162,17 +163,13 @@ describe('LibBytes', () => { it('should fail if the byte array is too short to hold an address)', async () => { const shortByteArray = '0xabcdef'; const offset = new BigNumber(0); - return expect(libBytes.publicReadAddress.callAsync(shortByteArray, offset)).to.be.rejectedWith( - constants.REVERT, - ); + return expectRevertOrAlwaysFailingTransaction(libBytes.publicReadAddress.callAsync(shortByteArray, offset)); }); it('should fail if the length between the offset and end of the byte array is too short to hold an address)', async () => { const byteArray = ethUtil.addHexPrefix(testAddress); const badOffset = new BigNumber(ethUtil.toBuffer(byteArray).byteLength); - return expect(libBytes.publicReadAddress.callAsync(byteArray, badOffset)).to.be.rejectedWith( - constants.REVERT, - ); + return expectRevertOrAlwaysFailingTransaction(libBytes.publicReadAddress.callAsync(byteArray, badOffset)); }); }); @@ -206,16 +203,14 @@ describe('LibBytes', () => { it('should fail if the byte array is too short to hold a bytes32)', async () => { const offset = new BigNumber(0); - return expect(libBytes.publicReadBytes32.callAsync(byteArrayShorterThan32Bytes, offset)).to.be.rejectedWith( - constants.REVERT, + return expectRevertOrAlwaysFailingTransaction( + libBytes.publicReadBytes32.callAsync(byteArrayShorterThan32Bytes, offset), ); }); it('should fail if the length between the offset and end of the byte array is too short to hold a bytes32)', async () => { const badOffset = new BigNumber(ethUtil.toBuffer(testBytes32).byteLength); - return expect(libBytes.publicReadBytes32.callAsync(testBytes32, badOffset)).to.be.rejectedWith( - constants.REVERT, - ); + return expectRevertOrAlwaysFailingTransaction(libBytes.publicReadBytes32.callAsync(testBytes32, badOffset)); }); }); @@ -253,8 +248,8 @@ describe('LibBytes', () => { it('should fail if the byte array is too short to hold a uint256)', async () => { const offset = new BigNumber(0); - return expect(libBytes.publicReadUint256.callAsync(byteArrayShorterThan32Bytes, offset)).to.be.rejectedWith( - constants.REVERT, + return expectRevertOrAlwaysFailingTransaction( + libBytes.publicReadUint256.callAsync(byteArrayShorterThan32Bytes, offset), ); }); @@ -263,9 +258,7 @@ describe('LibBytes', () => { const testUint256AsBuffer = ethUtil.toBuffer(formattedTestUint256); const byteArray = ethUtil.bufferToHex(testUint256AsBuffer); const badOffset = new BigNumber(testUint256AsBuffer.byteLength); - return expect(libBytes.publicReadUint256.callAsync(byteArray, badOffset)).to.be.rejectedWith( - constants.REVERT, - ); + return expectRevertOrAlwaysFailingTransaction(libBytes.publicReadUint256.callAsync(byteArray, badOffset)); }); }); -- cgit v1.2.3 From 00bf957b53c22f3ccdd6c2e7ad75f0c9e15caa38 Mon Sep 17 00:00:00 2001 From: Alex Browne Date: Wed, 23 May 2018 18:13:18 -0700 Subject: Add more transactions to Geth on init. Skip tests that are failing. --- packages/contracts/test/libraries/lib_bytes.ts | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) (limited to 'packages/contracts/test/libraries') diff --git a/packages/contracts/test/libraries/lib_bytes.ts b/packages/contracts/test/libraries/lib_bytes.ts index e639e6db1..2b5dfeaaa 100644 --- a/packages/contracts/test/libraries/lib_bytes.ts +++ b/packages/contracts/test/libraries/lib_bytes.ts @@ -160,13 +160,15 @@ describe('LibBytes', () => { return expect(address).to.be.equal(testAddress); }); - it('should fail if the byte array is too short to hold an address)', async () => { + // TOOD(albrow): AssertionError: expected promise to be rejected but it was fulfilled with '0x0000000000000000000000000000000000000000' + it.skip('should fail if the byte array is too short to hold an address)', async () => { const shortByteArray = '0xabcdef'; const offset = new BigNumber(0); return expectRevertOrAlwaysFailingTransaction(libBytes.publicReadAddress.callAsync(shortByteArray, offset)); }); - it('should fail if the length between the offset and end of the byte array is too short to hold an address)', async () => { + // TODO(albrow): AssertionError: expected promise to be rejected but it was fulfilled with '0x0000000000000000000000000000000000000000' + it.skip('should fail if the length between the offset and end of the byte array is too short to hold an address)', async () => { const byteArray = ethUtil.addHexPrefix(testAddress); const badOffset = new BigNumber(ethUtil.toBuffer(byteArray).byteLength); return expectRevertOrAlwaysFailingTransaction(libBytes.publicReadAddress.callAsync(byteArray, badOffset)); @@ -201,14 +203,16 @@ describe('LibBytes', () => { return expect(bytes32).to.be.equal(testBytes32); }); - it('should fail if the byte array is too short to hold a bytes32)', async () => { + // TODO(albrow): AssertionError: expected promise to be rejected but it was fulfilled with '0x08c379a000000000000000000000000000000000000000000000000000000000' + it.skip('should fail if the byte array is too short to hold a bytes32)', async () => { const offset = new BigNumber(0); return expectRevertOrAlwaysFailingTransaction( libBytes.publicReadBytes32.callAsync(byteArrayShorterThan32Bytes, offset), ); }); - it('should fail if the length between the offset and end of the byte array is too short to hold a bytes32)', async () => { + // TODO(albrow): AssertionError: expected promise to be rejected but it was fulfilled with '0x08c379a000000000000000000000000000000000000000000000000000000000' + it.skip('should fail if the length between the offset and end of the byte array is too short to hold a bytes32)', async () => { const badOffset = new BigNumber(ethUtil.toBuffer(testBytes32).byteLength); return expectRevertOrAlwaysFailingTransaction(libBytes.publicReadBytes32.callAsync(testBytes32, badOffset)); }); @@ -246,14 +250,16 @@ describe('LibBytes', () => { return expect(uint256).to.bignumber.equal(testUint256); }); - it('should fail if the byte array is too short to hold a uint256)', async () => { + // TODO(albrow): AssertionError: expected promise to be rejected but it was fulfilled with { Object (s, e, ...) } + it.skip('should fail if the byte array is too short to hold a uint256)', async () => { const offset = new BigNumber(0); return expectRevertOrAlwaysFailingTransaction( libBytes.publicReadUint256.callAsync(byteArrayShorterThan32Bytes, offset), ); }); - it('should fail if the length between the offset and end of the byte array is too short to hold a uint256)', async () => { + // TODO(albrow): AssertionError: expected promise to be rejected but it was fulfilled with { Object (s, e, ...) } + it.skip('should fail if the length between the offset and end of the byte array is too short to hold a uint256)', async () => { const formattedTestUint256 = new BN(testUint256.toString(10)); const testUint256AsBuffer = ethUtil.toBuffer(formattedTestUint256); const byteArray = ethUtil.bufferToHex(testUint256AsBuffer); -- cgit v1.2.3 From 31c98fc0db21300cb32e265c49b3f0320c315f01 Mon Sep 17 00:00:00 2001 From: Alex Browne Date: Tue, 29 May 2018 17:54:08 -0700 Subject: Update some tests after rebase --- packages/contracts/test/libraries/lib_bytes.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'packages/contracts/test/libraries') diff --git a/packages/contracts/test/libraries/lib_bytes.ts b/packages/contracts/test/libraries/lib_bytes.ts index 2b5dfeaaa..22d40cfd1 100644 --- a/packages/contracts/test/libraries/lib_bytes.ts +++ b/packages/contracts/test/libraries/lib_bytes.ts @@ -280,7 +280,8 @@ describe('LibBytes', () => { */ describe('readFirst4', () => { - it('should revert if byte array has a length < 4', async () => { + // AssertionError: expected promise to be rejected with an error including 'revert' but it was fulfilled with '0x08c379a0' + it.skip('should revert if byte array has a length < 4', async () => { const byteArrayLessThan4Bytes = '0x010101'; return expect(libBytes.publicReadFirst4.callAsync(byteArrayLessThan4Bytes)).to.be.rejectedWith( constants.REVERT, -- cgit v1.2.3 From 98ffe9931d4fd8886955c45c42eb63b33184ddd2 Mon Sep 17 00:00:00 2001 From: Alex Browne Date: Fri, 1 Jun 2018 14:03:12 -0700 Subject: Get LibBytes tests working on both Ganache and Geth --- packages/contracts/test/libraries/lib_bytes.ts | 52 ++++++++++++++------------ 1 file changed, 28 insertions(+), 24 deletions(-) (limited to 'packages/contracts/test/libraries') diff --git a/packages/contracts/test/libraries/lib_bytes.ts b/packages/contracts/test/libraries/lib_bytes.ts index 22d40cfd1..26802a60d 100644 --- a/packages/contracts/test/libraries/lib_bytes.ts +++ b/packages/contracts/test/libraries/lib_bytes.ts @@ -64,7 +64,9 @@ describe('LibBytes', () => { describe('popByte', () => { it('should revert if length is 0', async () => { - return expect(libBytes.publicPopByte.callAsync(constants.NULL_BYTES)).to.be.rejectedWith(constants.REVERT); + return expect(libBytes.publicPopByte.callAsync(constants.NULL_BYTES)).to.be.rejectedWith( + constants.LIB_BYTES_GT_ZERO_LENGTH_REQUIRED, + ); }); it('should pop the last byte from the input and return it', async () => { @@ -79,7 +81,7 @@ describe('LibBytes', () => { describe('popAddress', () => { it('should revert if length is less than 20', async () => { return expect(libBytes.publicPopAddress.callAsync(byteArrayShorterThan20Bytes)).to.be.rejectedWith( - constants.REVERT, + constants.LIB_BYTES_GTE_20_LENGTH_REQUIRED, ); }); @@ -160,18 +162,20 @@ describe('LibBytes', () => { return expect(address).to.be.equal(testAddress); }); - // TOOD(albrow): AssertionError: expected promise to be rejected but it was fulfilled with '0x0000000000000000000000000000000000000000' - it.skip('should fail if the byte array is too short to hold an address)', async () => { + it('should fail if the byte array is too short to hold an address)', async () => { const shortByteArray = '0xabcdef'; const offset = new BigNumber(0); - return expectRevertOrAlwaysFailingTransaction(libBytes.publicReadAddress.callAsync(shortByteArray, offset)); + return expect(libBytes.publicReadAddress.callAsync(shortByteArray, offset)).to.be.rejectedWith( + constants.LIB_BYTES_GTE_20_LENGTH_REQUIRED, + ); }); - // TODO(albrow): AssertionError: expected promise to be rejected but it was fulfilled with '0x0000000000000000000000000000000000000000' - it.skip('should fail if the length between the offset and end of the byte array is too short to hold an address)', async () => { + it('should fail if the length between the offset and end of the byte array is too short to hold an address)', async () => { const byteArray = ethUtil.addHexPrefix(testAddress); const badOffset = new BigNumber(ethUtil.toBuffer(byteArray).byteLength); - return expectRevertOrAlwaysFailingTransaction(libBytes.publicReadAddress.callAsync(byteArray, badOffset)); + return expect(libBytes.publicReadAddress.callAsync(byteArray, badOffset)).to.be.rejectedWith( + constants.LIB_BYTES_GTE_20_LENGTH_REQUIRED, + ); }); }); @@ -203,18 +207,18 @@ describe('LibBytes', () => { return expect(bytes32).to.be.equal(testBytes32); }); - // TODO(albrow): AssertionError: expected promise to be rejected but it was fulfilled with '0x08c379a000000000000000000000000000000000000000000000000000000000' - it.skip('should fail if the byte array is too short to hold a bytes32)', async () => { + it('should fail if the byte array is too short to hold a bytes32)', async () => { const offset = new BigNumber(0); - return expectRevertOrAlwaysFailingTransaction( - libBytes.publicReadBytes32.callAsync(byteArrayShorterThan32Bytes, offset), + return expect(libBytes.publicReadBytes32.callAsync(byteArrayShorterThan32Bytes, offset)).to.be.rejectedWith( + constants.LIB_BYTES_GTE_32_LENGTH_REQUIRED, ); }); - // TODO(albrow): AssertionError: expected promise to be rejected but it was fulfilled with '0x08c379a000000000000000000000000000000000000000000000000000000000' - it.skip('should fail if the length between the offset and end of the byte array is too short to hold a bytes32)', async () => { + it('should fail if the length between the offset and end of the byte array is too short to hold a bytes32)', async () => { const badOffset = new BigNumber(ethUtil.toBuffer(testBytes32).byteLength); - return expectRevertOrAlwaysFailingTransaction(libBytes.publicReadBytes32.callAsync(testBytes32, badOffset)); + return expect(libBytes.publicReadBytes32.callAsync(testBytes32, badOffset)).to.be.rejectedWith( + constants.LIB_BYTES_GTE_32_LENGTH_REQUIRED, + ); }); }); @@ -250,21 +254,21 @@ describe('LibBytes', () => { return expect(uint256).to.bignumber.equal(testUint256); }); - // TODO(albrow): AssertionError: expected promise to be rejected but it was fulfilled with { Object (s, e, ...) } - it.skip('should fail if the byte array is too short to hold a uint256)', async () => { + it('should fail if the byte array is too short to hold a uint256)', async () => { const offset = new BigNumber(0); - return expectRevertOrAlwaysFailingTransaction( - libBytes.publicReadUint256.callAsync(byteArrayShorterThan32Bytes, offset), + return expect(libBytes.publicReadUint256.callAsync(byteArrayShorterThan32Bytes, offset)).to.be.rejectedWith( + constants.LIB_BYTES_GTE_32_LENGTH_REQUIRED, ); }); - // TODO(albrow): AssertionError: expected promise to be rejected but it was fulfilled with { Object (s, e, ...) } - it.skip('should fail if the length between the offset and end of the byte array is too short to hold a uint256)', async () => { + it('should fail if the length between the offset and end of the byte array is too short to hold a uint256)', async () => { const formattedTestUint256 = new BN(testUint256.toString(10)); const testUint256AsBuffer = ethUtil.toBuffer(formattedTestUint256); const byteArray = ethUtil.bufferToHex(testUint256AsBuffer); const badOffset = new BigNumber(testUint256AsBuffer.byteLength); - return expectRevertOrAlwaysFailingTransaction(libBytes.publicReadUint256.callAsync(byteArray, badOffset)); + return expect(libBytes.publicReadUint256.callAsync(byteArray, badOffset)).to.be.rejectedWith( + constants.LIB_BYTES_GTE_32_LENGTH_REQUIRED, + ); }); }); @@ -281,10 +285,10 @@ describe('LibBytes', () => { describe('readFirst4', () => { // AssertionError: expected promise to be rejected with an error including 'revert' but it was fulfilled with '0x08c379a0' - it.skip('should revert if byte array has a length < 4', async () => { + it('should revert if byte array has a length < 4', async () => { const byteArrayLessThan4Bytes = '0x010101'; return expect(libBytes.publicReadFirst4.callAsync(byteArrayLessThan4Bytes)).to.be.rejectedWith( - constants.REVERT, + constants.LIB_BYTES_GTE_4_LENGTH_REQUIRED, ); }); it('should return the first 4 bytes of a byte array of arbitrary length', async () => { -- cgit v1.2.3 From d6d7f4e875b161aa7284467a61f67989f76ec89e Mon Sep 17 00:00:00 2001 From: Alex Browne Date: Tue, 5 Jun 2018 16:20:38 -0700 Subject: Update more things to work with both Geth and Ganache --- packages/contracts/test/libraries/lib_bytes.ts | 29 +++++++++++++++++--------- 1 file changed, 19 insertions(+), 10 deletions(-) (limited to 'packages/contracts/test/libraries') diff --git a/packages/contracts/test/libraries/lib_bytes.ts b/packages/contracts/test/libraries/lib_bytes.ts index 26802a60d..f5435a81e 100644 --- a/packages/contracts/test/libraries/lib_bytes.ts +++ b/packages/contracts/test/libraries/lib_bytes.ts @@ -10,7 +10,7 @@ import * as Web3 from 'web3'; import { TestLibBytesContract } from '../../src/contract_wrappers/generated/test_lib_bytes'; import { artifacts } from '../../src/utils/artifacts'; -import { expectRevertOrAlwaysFailingTransaction } from '../../src/utils/assertions'; +import { expectRevertOrAlwaysFailingTransaction, expectRevertOrOtherError } from '../../src/utils/assertions'; import { chaiSetup } from '../../src/utils/chai_setup'; import { constants } from '../../src/utils/constants'; import { provider, txDefaults, web3Wrapper } from '../../src/utils/web3_wrapper'; @@ -64,7 +64,8 @@ describe('LibBytes', () => { describe('popByte', () => { it('should revert if length is 0', async () => { - return expect(libBytes.publicPopByte.callAsync(constants.NULL_BYTES)).to.be.rejectedWith( + return expectRevertOrOtherError( + libBytes.publicPopByte.callAsync(constants.NULL_BYTES), constants.LIB_BYTES_GT_ZERO_LENGTH_REQUIRED, ); }); @@ -80,7 +81,8 @@ describe('LibBytes', () => { describe('popAddress', () => { it('should revert if length is less than 20', async () => { - return expect(libBytes.publicPopAddress.callAsync(byteArrayShorterThan20Bytes)).to.be.rejectedWith( + return expectRevertOrOtherError( + libBytes.publicPopAddress.callAsync(byteArrayShorterThan20Bytes), constants.LIB_BYTES_GTE_20_LENGTH_REQUIRED, ); }); @@ -165,7 +167,8 @@ describe('LibBytes', () => { it('should fail if the byte array is too short to hold an address)', async () => { const shortByteArray = '0xabcdef'; const offset = new BigNumber(0); - return expect(libBytes.publicReadAddress.callAsync(shortByteArray, offset)).to.be.rejectedWith( + return expectRevertOrOtherError( + libBytes.publicReadAddress.callAsync(shortByteArray, offset), constants.LIB_BYTES_GTE_20_LENGTH_REQUIRED, ); }); @@ -173,7 +176,8 @@ describe('LibBytes', () => { it('should fail if the length between the offset and end of the byte array is too short to hold an address)', async () => { const byteArray = ethUtil.addHexPrefix(testAddress); const badOffset = new BigNumber(ethUtil.toBuffer(byteArray).byteLength); - return expect(libBytes.publicReadAddress.callAsync(byteArray, badOffset)).to.be.rejectedWith( + return expectRevertOrOtherError( + libBytes.publicReadAddress.callAsync(byteArray, badOffset), constants.LIB_BYTES_GTE_20_LENGTH_REQUIRED, ); }); @@ -209,14 +213,16 @@ describe('LibBytes', () => { it('should fail if the byte array is too short to hold a bytes32)', async () => { const offset = new BigNumber(0); - return expect(libBytes.publicReadBytes32.callAsync(byteArrayShorterThan32Bytes, offset)).to.be.rejectedWith( + return expectRevertOrOtherError( + libBytes.publicReadBytes32.callAsync(byteArrayShorterThan32Bytes, offset), constants.LIB_BYTES_GTE_32_LENGTH_REQUIRED, ); }); it('should fail if the length between the offset and end of the byte array is too short to hold a bytes32)', async () => { const badOffset = new BigNumber(ethUtil.toBuffer(testBytes32).byteLength); - return expect(libBytes.publicReadBytes32.callAsync(testBytes32, badOffset)).to.be.rejectedWith( + return expectRevertOrOtherError( + libBytes.publicReadBytes32.callAsync(testBytes32, badOffset), constants.LIB_BYTES_GTE_32_LENGTH_REQUIRED, ); }); @@ -256,7 +262,8 @@ describe('LibBytes', () => { it('should fail if the byte array is too short to hold a uint256)', async () => { const offset = new BigNumber(0); - return expect(libBytes.publicReadUint256.callAsync(byteArrayShorterThan32Bytes, offset)).to.be.rejectedWith( + return expectRevertOrOtherError( + libBytes.publicReadUint256.callAsync(byteArrayShorterThan32Bytes, offset), constants.LIB_BYTES_GTE_32_LENGTH_REQUIRED, ); }); @@ -266,7 +273,8 @@ describe('LibBytes', () => { const testUint256AsBuffer = ethUtil.toBuffer(formattedTestUint256); const byteArray = ethUtil.bufferToHex(testUint256AsBuffer); const badOffset = new BigNumber(testUint256AsBuffer.byteLength); - return expect(libBytes.publicReadUint256.callAsync(byteArray, badOffset)).to.be.rejectedWith( + return expectRevertOrOtherError( + libBytes.publicReadUint256.callAsync(byteArray, badOffset), constants.LIB_BYTES_GTE_32_LENGTH_REQUIRED, ); }); @@ -287,7 +295,8 @@ describe('LibBytes', () => { // AssertionError: expected promise to be rejected with an error including 'revert' but it was fulfilled with '0x08c379a0' it('should revert if byte array has a length < 4', async () => { const byteArrayLessThan4Bytes = '0x010101'; - return expect(libBytes.publicReadFirst4.callAsync(byteArrayLessThan4Bytes)).to.be.rejectedWith( + return expectRevertOrOtherError( + libBytes.publicReadFirst4.callAsync(byteArrayLessThan4Bytes), constants.LIB_BYTES_GTE_4_LENGTH_REQUIRED, ); }); -- cgit v1.2.3 From 167a38e27d09af12af6c59f1b486c835420fbac1 Mon Sep 17 00:00:00 2001 From: Alex Browne Date: Tue, 5 Jun 2018 16:56:16 -0700 Subject: Add Async suffix to relevant assertions --- packages/contracts/test/libraries/lib_bytes.ts | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) (limited to 'packages/contracts/test/libraries') diff --git a/packages/contracts/test/libraries/lib_bytes.ts b/packages/contracts/test/libraries/lib_bytes.ts index f5435a81e..156463130 100644 --- a/packages/contracts/test/libraries/lib_bytes.ts +++ b/packages/contracts/test/libraries/lib_bytes.ts @@ -10,7 +10,7 @@ import * as Web3 from 'web3'; import { TestLibBytesContract } from '../../src/contract_wrappers/generated/test_lib_bytes'; import { artifacts } from '../../src/utils/artifacts'; -import { expectRevertOrAlwaysFailingTransaction, expectRevertOrOtherError } from '../../src/utils/assertions'; +import { expectRevertOrAlwaysFailingTransactionAsync, expectRevertOrOtherErrorAsync } from '../../src/utils/assertions'; import { chaiSetup } from '../../src/utils/chai_setup'; import { constants } from '../../src/utils/constants'; import { provider, txDefaults, web3Wrapper } from '../../src/utils/web3_wrapper'; @@ -64,7 +64,7 @@ describe('LibBytes', () => { describe('popByte', () => { it('should revert if length is 0', async () => { - return expectRevertOrOtherError( + return expectRevertOrOtherErrorAsync( libBytes.publicPopByte.callAsync(constants.NULL_BYTES), constants.LIB_BYTES_GT_ZERO_LENGTH_REQUIRED, ); @@ -81,7 +81,7 @@ describe('LibBytes', () => { describe('popAddress', () => { it('should revert if length is less than 20', async () => { - return expectRevertOrOtherError( + return expectRevertOrOtherErrorAsync( libBytes.publicPopAddress.callAsync(byteArrayShorterThan20Bytes), constants.LIB_BYTES_GTE_20_LENGTH_REQUIRED, ); @@ -167,7 +167,7 @@ describe('LibBytes', () => { it('should fail if the byte array is too short to hold an address)', async () => { const shortByteArray = '0xabcdef'; const offset = new BigNumber(0); - return expectRevertOrOtherError( + return expectRevertOrOtherErrorAsync( libBytes.publicReadAddress.callAsync(shortByteArray, offset), constants.LIB_BYTES_GTE_20_LENGTH_REQUIRED, ); @@ -176,7 +176,7 @@ describe('LibBytes', () => { it('should fail if the length between the offset and end of the byte array is too short to hold an address)', async () => { const byteArray = ethUtil.addHexPrefix(testAddress); const badOffset = new BigNumber(ethUtil.toBuffer(byteArray).byteLength); - return expectRevertOrOtherError( + return expectRevertOrOtherErrorAsync( libBytes.publicReadAddress.callAsync(byteArray, badOffset), constants.LIB_BYTES_GTE_20_LENGTH_REQUIRED, ); @@ -213,7 +213,7 @@ describe('LibBytes', () => { it('should fail if the byte array is too short to hold a bytes32)', async () => { const offset = new BigNumber(0); - return expectRevertOrOtherError( + return expectRevertOrOtherErrorAsync( libBytes.publicReadBytes32.callAsync(byteArrayShorterThan32Bytes, offset), constants.LIB_BYTES_GTE_32_LENGTH_REQUIRED, ); @@ -221,7 +221,7 @@ describe('LibBytes', () => { it('should fail if the length between the offset and end of the byte array is too short to hold a bytes32)', async () => { const badOffset = new BigNumber(ethUtil.toBuffer(testBytes32).byteLength); - return expectRevertOrOtherError( + return expectRevertOrOtherErrorAsync( libBytes.publicReadBytes32.callAsync(testBytes32, badOffset), constants.LIB_BYTES_GTE_32_LENGTH_REQUIRED, ); @@ -262,7 +262,7 @@ describe('LibBytes', () => { it('should fail if the byte array is too short to hold a uint256)', async () => { const offset = new BigNumber(0); - return expectRevertOrOtherError( + return expectRevertOrOtherErrorAsync( libBytes.publicReadUint256.callAsync(byteArrayShorterThan32Bytes, offset), constants.LIB_BYTES_GTE_32_LENGTH_REQUIRED, ); @@ -273,7 +273,7 @@ describe('LibBytes', () => { const testUint256AsBuffer = ethUtil.toBuffer(formattedTestUint256); const byteArray = ethUtil.bufferToHex(testUint256AsBuffer); const badOffset = new BigNumber(testUint256AsBuffer.byteLength); - return expectRevertOrOtherError( + return expectRevertOrOtherErrorAsync( libBytes.publicReadUint256.callAsync(byteArray, badOffset), constants.LIB_BYTES_GTE_32_LENGTH_REQUIRED, ); @@ -295,7 +295,7 @@ describe('LibBytes', () => { // AssertionError: expected promise to be rejected with an error including 'revert' but it was fulfilled with '0x08c379a0' it('should revert if byte array has a length < 4', async () => { const byteArrayLessThan4Bytes = '0x010101'; - return expectRevertOrOtherError( + return expectRevertOrOtherErrorAsync( libBytes.publicReadFirst4.callAsync(byteArrayLessThan4Bytes), constants.LIB_BYTES_GTE_4_LENGTH_REQUIRED, ); -- cgit v1.2.3