Ran prettier
This commit is contained in:
@@ -1,10 +1,4 @@
|
|||||||
import {
|
import { chaiSetup, constants, provider, txDefaults, web3Wrapper } from '@0x/contracts-test-utils';
|
||||||
chaiSetup,
|
|
||||||
constants,
|
|
||||||
provider,
|
|
||||||
txDefaults,
|
|
||||||
web3Wrapper,
|
|
||||||
} from '@0x/contracts-test-utils';
|
|
||||||
import { BlockchainLifecycle } from '@0x/dev-utils';
|
import { BlockchainLifecycle } from '@0x/dev-utils';
|
||||||
import { AuthorizableRevertErrors, BigNumber, OwnableRevertErrors } from '@0x/utils';
|
import { AuthorizableRevertErrors, BigNumber, OwnableRevertErrors } from '@0x/utils';
|
||||||
import * as chai from 'chai';
|
import * as chai from 'chai';
|
||||||
@@ -140,14 +134,18 @@ describe('Authorizable', () => {
|
|||||||
);
|
);
|
||||||
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, constants.ZERO_AMOUNT);
|
||||||
const tx = authorizable.removeAuthorizedAddressAtIndex.sendTransactionAsync(address, index, { from: owner });
|
const tx = authorizable.removeAuthorizedAddressAtIndex.sendTransactionAsync(address, index, {
|
||||||
|
from: owner,
|
||||||
|
});
|
||||||
return expect(tx).to.revertWith(expectedError);
|
return expect(tx).to.revertWith(expectedError);
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should revert if owner attempts to remove an address that is not authorized', async () => {
|
it('should revert if owner attempts to remove an address that is not authorized', async () => {
|
||||||
const index = new BigNumber(0);
|
const index = new BigNumber(0);
|
||||||
const expectedError = new AuthorizableRevertErrors.TargetNotAuthorizedError(address);
|
const expectedError = new AuthorizableRevertErrors.TargetNotAuthorizedError(address);
|
||||||
const tx = authorizable.removeAuthorizedAddressAtIndex.sendTransactionAsync(address, index, { from: owner });
|
const tx = authorizable.removeAuthorizedAddressAtIndex.sendTransactionAsync(address, index, {
|
||||||
|
from: owner,
|
||||||
|
});
|
||||||
return expect(tx).to.revertWith(expectedError);
|
return expect(tx).to.revertWith(expectedError);
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -166,7 +164,9 @@ describe('Authorizable', () => {
|
|||||||
);
|
);
|
||||||
const address1Index = new BigNumber(0);
|
const address1Index = new BigNumber(0);
|
||||||
const expectedError = new AuthorizableRevertErrors.AuthorizedAddressMismatchError(address1, address2);
|
const expectedError = new AuthorizableRevertErrors.AuthorizedAddressMismatchError(address1, address2);
|
||||||
const tx = authorizable.removeAuthorizedAddressAtIndex.sendTransactionAsync(address2, address1Index, { from: owner });
|
const tx = authorizable.removeAuthorizedAddressAtIndex.sendTransactionAsync(address2, address1Index, {
|
||||||
|
from: owner,
|
||||||
|
});
|
||||||
return expect(tx).to.revertWith(expectedError);
|
return expect(tx).to.revertWith(expectedError);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
@@ -4,21 +4,16 @@ import { RevertError } from './revert_error';
|
|||||||
// tslint:disable:max-classes-per-file
|
// tslint:disable:max-classes-per-file
|
||||||
export class AuthorizedAddressMismatchError extends RevertError {
|
export class AuthorizedAddressMismatchError extends RevertError {
|
||||||
constructor(authorized?: string, target?: string) {
|
constructor(authorized?: string, target?: string) {
|
||||||
super(
|
super('AuthorizedAddressMismatchError', 'AuthorizedAddressMismatchError(address authorized, address target)', {
|
||||||
'AuthorizedAddressMismatchError',
|
authorized,
|
||||||
'AuthorizedAddressMismatchError(address authorized, address target)',
|
target,
|
||||||
{ authorized, target },
|
});
|
||||||
);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export class IndexOutOfBoundsError extends RevertError {
|
export class IndexOutOfBoundsError extends RevertError {
|
||||||
constructor(index?: BigNumber, length?: BigNumber) {
|
constructor(index?: BigNumber, length?: BigNumber) {
|
||||||
super(
|
super('IndexOutOfBoundsError', 'IndexOutOfBoundsError(uint256 index, uint256 length)', { index, length });
|
||||||
'IndexOutOfBoundsError',
|
|
||||||
'IndexOutOfBoundsError(uint256 index, uint256 length)',
|
|
||||||
{ index, length },
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -30,21 +25,13 @@ export class SenderNotAuthorizedError extends RevertError {
|
|||||||
|
|
||||||
export class TargetAlreadyAuthorizedError extends RevertError {
|
export class TargetAlreadyAuthorizedError extends RevertError {
|
||||||
constructor(target?: string) {
|
constructor(target?: string) {
|
||||||
super(
|
super('TargetAlreadyAuthorizedError', 'TargetAlreadyAuthorizedError(address target)', { target });
|
||||||
'TargetAlreadyAuthorizedError',
|
|
||||||
'TargetAlreadyAuthorizedError(address target)',
|
|
||||||
{ target },
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export class TargetNotAuthorizedError extends RevertError {
|
export class TargetNotAuthorizedError extends RevertError {
|
||||||
constructor(target?: string) {
|
constructor(target?: string) {
|
||||||
super(
|
super('TargetNotAuthorizedError', 'TargetNotAuthorizedError(address target)', { target });
|
||||||
'TargetNotAuthorizedError',
|
|
||||||
'TargetNotAuthorizedError(address target)',
|
|
||||||
{ target },
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user