diff --git a/contracts/utils/test/authorizable.ts b/contracts/utils/test/authorizable.ts index 8e4bf800d8..df70f84e19 100644 --- a/contracts/utils/test/authorizable.ts +++ b/contracts/utils/test/authorizable.ts @@ -130,7 +130,7 @@ describe('Authorizable', () => { constants.AWAIT_TRANSACTION_MINED_MS, ); const index = new BigNumber(1); - const expectedError = new AuthorizableRevertErrors.IndexOutOfBoundsError(index, constants.ZERO_AMOUNT); + const expectedError = new AuthorizableRevertErrors.IndexOutOfBoundsError(index, index); const tx = authorizable.removeAuthorizedAddressAtIndex.sendTransactionAsync(address, index, { from: owner, }); diff --git a/contracts/utils/test/lib_rich_errors.ts b/contracts/utils/test/lib_rich_errors.ts index 7d074badb6..217e0abf30 100644 --- a/contracts/utils/test/lib_rich_errors.ts +++ b/contracts/utils/test/lib_rich_errors.ts @@ -1,36 +1,31 @@ -import { chaiSetup, constants, provider, txDefaults, web3Wrapper } from '@0x/contracts-test-utils'; -import { BlockchainLifecycle } from '@0x/dev-utils'; -import { StringRevertError } from '@0x/utils'; -import * as chai from 'chai'; -import * as _ from 'lodash'; +import { blockchainTests, expect, hexRandom } from '@0x/contracts-test-utils'; +import { coerceThrownErrorAsRevertError, StringRevertError } from '@0x/utils'; import { artifacts, TestLibRichErrorsContract } from '../src'; -chaiSetup.configure(); -const expect = chai.expect; -const blockchainLifecycle = new BlockchainLifecycle(web3Wrapper); - -describe('LibRichErrors', () => { +blockchainTests('LibRichErrors', env => { let lib: TestLibRichErrorsContract; before(async () => { - await blockchainLifecycle.startAsync(); // Deploy SafeMath lib = await TestLibRichErrorsContract.deployFrom0xArtifactAsync( artifacts.TestLibRichErrors, - provider, - txDefaults, + env.provider, + env.txDefaults, {}, ); }); - after(async () => { - await blockchainLifecycle.revertAsync(); - }); - describe('_rrevert', () => { it('should correctly revert the extra bytes', async () => { - return expect(lib.externalRRevert.callAsync(constants.NULL_BYTES)).to.revertWith(constants.NULL_BYTES); + const extraBytes = hexRandom(100); + try { + await lib.externalRRevert.callAsync(extraBytes); + } catch (err) { + const revertError = coerceThrownErrorAsRevertError(err); + return expect(revertError.encode()).to.eq(extraBytes); + } + return expect.fail('Expected call to revert'); }); it('should correctly revert a StringRevertError', async () => {