@0x/contracts-utils
: Fix failing tests due to RevertError
behavior changes.
This commit is contained in:
parent
f601329a47
commit
b78705120e
@ -130,7 +130,7 @@ describe('Authorizable', () => {
|
|||||||
constants.AWAIT_TRANSACTION_MINED_MS,
|
constants.AWAIT_TRANSACTION_MINED_MS,
|
||||||
);
|
);
|
||||||
const index = new BigNumber(1);
|
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, {
|
const tx = authorizable.removeAuthorizedAddressAtIndex.sendTransactionAsync(address, index, {
|
||||||
from: owner,
|
from: owner,
|
||||||
});
|
});
|
||||||
|
@ -1,36 +1,31 @@
|
|||||||
import { chaiSetup, constants, provider, txDefaults, web3Wrapper } from '@0x/contracts-test-utils';
|
import { blockchainTests, expect, hexRandom } from '@0x/contracts-test-utils';
|
||||||
import { BlockchainLifecycle } from '@0x/dev-utils';
|
import { coerceThrownErrorAsRevertError, StringRevertError } from '@0x/utils';
|
||||||
import { StringRevertError } from '@0x/utils';
|
|
||||||
import * as chai from 'chai';
|
|
||||||
import * as _ from 'lodash';
|
|
||||||
|
|
||||||
import { artifacts, TestLibRichErrorsContract } from '../src';
|
import { artifacts, TestLibRichErrorsContract } from '../src';
|
||||||
|
|
||||||
chaiSetup.configure();
|
blockchainTests('LibRichErrors', env => {
|
||||||
const expect = chai.expect;
|
|
||||||
const blockchainLifecycle = new BlockchainLifecycle(web3Wrapper);
|
|
||||||
|
|
||||||
describe('LibRichErrors', () => {
|
|
||||||
let lib: TestLibRichErrorsContract;
|
let lib: TestLibRichErrorsContract;
|
||||||
|
|
||||||
before(async () => {
|
before(async () => {
|
||||||
await blockchainLifecycle.startAsync();
|
|
||||||
// Deploy SafeMath
|
// Deploy SafeMath
|
||||||
lib = await TestLibRichErrorsContract.deployFrom0xArtifactAsync(
|
lib = await TestLibRichErrorsContract.deployFrom0xArtifactAsync(
|
||||||
artifacts.TestLibRichErrors,
|
artifacts.TestLibRichErrors,
|
||||||
provider,
|
env.provider,
|
||||||
txDefaults,
|
env.txDefaults,
|
||||||
{},
|
{},
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|
||||||
after(async () => {
|
|
||||||
await blockchainLifecycle.revertAsync();
|
|
||||||
});
|
|
||||||
|
|
||||||
describe('_rrevert', () => {
|
describe('_rrevert', () => {
|
||||||
it('should correctly revert the extra bytes', async () => {
|
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 () => {
|
it('should correctly revert a StringRevertError', async () => {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user