Change all instances of throw to revert in it tests

This commit is contained in:
Alex Towle
2019-08-01 15:10:06 -07:00
parent 77feaec444
commit 8c5c81fe70
15 changed files with 80 additions and 80 deletions

View File

@@ -380,7 +380,7 @@ describe('Exchange core', () => {
});
});
it('should throw if fully filled', async () => {
it('should revert if fully filled', async () => {
signedOrder = await orderFactory.newSignedOrderAsync();
const orderHashHex = orderHashUtils.getOrderHashHex(signedOrder);
await exchangeWrapper.fillOrderAsync(signedOrder, takerAddress);
@@ -423,7 +423,7 @@ describe('Exchange core', () => {
).to.be.bignumber.equal(signedOrder.takerFee);
});
it('should throw if order is expired', async () => {
it('should revert if order is expired', async () => {
const currentTimestamp = await getLatestBlockTimestampAsync();
signedOrder = await orderFactory.newSignedOrderAsync({
expirationTimeSeconds: new BigNumber(currentTimestamp).minus(10),
@@ -742,14 +742,14 @@ describe('Exchange core', () => {
signedOrder = await orderFactory.newSignedOrderAsync();
});
it('should throw if not sent by maker', async () => {
it('should revert if not sent by maker', async () => {
const orderHash = orderHashUtils.getOrderHashHex(signedOrder);
const expectedError = new ExchangeRevertErrors.InvalidMakerError(orderHash, takerAddress);
const tx = exchangeWrapper.cancelOrderAsync(signedOrder, takerAddress);
return expect(tx).to.revertWith(expectedError);
});
it('should throw if makerAssetAmount is 0', async () => {
it('should revert if makerAssetAmount is 0', async () => {
signedOrder = await orderFactory.newSignedOrderAsync({
makerAssetAmount: new BigNumber(0),
});
@@ -762,7 +762,7 @@ describe('Exchange core', () => {
return expect(tx).to.revertWith(expectedError);
});
it('should throw if takerAssetAmount is 0', async () => {
it('should revert if takerAssetAmount is 0', async () => {
signedOrder = await orderFactory.newSignedOrderAsync({
takerAssetAmount: new BigNumber(0),
});
@@ -800,7 +800,7 @@ describe('Exchange core', () => {
expect(orderHashUtils.getOrderHashHex(signedOrder)).to.be.equal(logArgs.orderHash);
});
it('should throw if already cancelled', async () => {
it('should revert if already cancelled', async () => {
await exchangeWrapper.cancelOrderAsync(signedOrder, makerAddress);
const orderHash = orderHashUtils.getOrderHashHex(signedOrder);
const expectedError = new ExchangeRevertErrors.OrderStatusError(orderHash, OrderStatus.Cancelled);
@@ -808,7 +808,7 @@ describe('Exchange core', () => {
return expect(tx).to.revertWith(expectedError);
});
it('should throw if order is expired', async () => {
it('should revert if order is expired', async () => {
const currentTimestamp = await getLatestBlockTimestampAsync();
signedOrder = await orderFactory.newSignedOrderAsync({
expirationTimeSeconds: new BigNumber(currentTimestamp).minus(10),
@@ -819,7 +819,7 @@ describe('Exchange core', () => {
return expect(tx).to.revertWith(expectedError);
});
it('should throw if rounding error is greater than 0.1%', async () => {
it('should revert if rounding error is greater than 0.1%', async () => {
signedOrder = await orderFactory.newSignedOrderAsync({
makerAssetAmount: new BigNumber(1001),
takerAssetAmount: new BigNumber(3),
@@ -936,7 +936,7 @@ describe('Exchange core', () => {
});
describe('Testing Exchange of ERC721 Tokens', () => {
it('should throw when maker does not own the token with id makerAssetId', async () => {
it('should revert when maker does not own the token with id makerAssetId', async () => {
// Construct Exchange parameters
const makerAssetId = erc721TakerAssetIds[0];
const takerAssetId = erc721TakerAssetIds[1];
@@ -963,7 +963,7 @@ describe('Exchange core', () => {
return expect(tx).to.revertWith(expectedError);
});
it('should throw when taker does not own the token with id takerAssetId', async () => {
it('should revert when taker does not own the token with id takerAssetId', async () => {
// Construct Exchange parameters
const makerAssetId = erc721MakerAssetIds[0];
const takerAssetId = erc721MakerAssetIds[1];
@@ -990,7 +990,7 @@ describe('Exchange core', () => {
return expect(tx).to.revertWith(expectedError);
});
it('should throw when makerAssetAmount is greater than 1', async () => {
it('should revert when makerAssetAmount is greater than 1', async () => {
// Construct Exchange parameters
const makerAssetId = erc721MakerAssetIds[0];
const takerAssetId = erc721TakerAssetIds[0];
@@ -1017,7 +1017,7 @@ describe('Exchange core', () => {
return expect(tx).to.revertWith(expectedError);
});
it('should throw when takerAssetAmount is greater than 1', async () => {
it('should revert when takerAssetAmount is greater than 1', async () => {
// Construct Exchange parameters
const makerAssetId = erc721MakerAssetIds[0];
const takerAssetId = erc721TakerAssetIds[0];
@@ -1044,7 +1044,7 @@ describe('Exchange core', () => {
return expect(tx).to.revertWith(expectedError);
});
it('should throw on partial fill', async () => {
it('should revert on partial fill', async () => {
// Construct Exchange parameters
const makerAssetId = erc721MakerAssetIds[0];
signedOrder = await orderFactory.newSignedOrderAsync({

View File

@@ -114,7 +114,7 @@ describe('AssetProxyDispatcher', () => {
expect(proxyAddress).to.be.equal(erc721Proxy.address);
});
it('should throw if a proxy with the same id is already registered', async () => {
it('should revert if a proxy with the same id is already registered', async () => {
// Initial registration
await assetProxyDispatcher.registerAssetProxy.awaitTransactionSuccessAsync(erc20Proxy.address, {
from: owner,
@@ -134,7 +134,7 @@ describe('AssetProxyDispatcher', () => {
return expect(tx).to.revertWith(expectedError);
});
it('should throw if requesting address is not owner', async () => {
it('should revert if requesting address is not owner', async () => {
const expectedError = new OwnableRevertErrors.OnlyOwnerError(notOwner, owner);
const tx = assetProxyDispatcher.registerAssetProxy.sendTransactionAsync(erc20Proxy.address, {
from: notOwner,
@@ -250,7 +250,7 @@ describe('AssetProxyDispatcher', () => {
expect(newBalances).to.deep.equal(erc20Balances);
});
it('should throw if dispatching to unregistered proxy', async () => {
it('should revert if dispatching to unregistered proxy', async () => {
// Construct metadata for ERC20 proxy
const encodedAssetData = assetDataUtils.encodeERC20AssetData(erc20TokenA.address);
// Perform a transfer from makerAddress to takerAddress

View File

@@ -175,7 +175,7 @@ describe('FillOrder Tests', () => {
await fillOrderCombinatorialUtils.testFillOrderScenarioSuccessAsync(fillScenario);
});
it('should throw when taker is specified and order is claimed by other', async () => {
it('should revert when taker is specified and order is claimed by other', async () => {
const fillScenario = {
...defaultFillScenario,
orderScenario: {
@@ -186,7 +186,7 @@ describe('FillOrder Tests', () => {
await fillOrderCombinatorialUtils.testFillOrderScenarioFailureAsync(fillScenario);
});
it('should throw if makerAssetAmount is 0', async () => {
it('should revert if makerAssetAmount is 0', async () => {
const fillScenario = {
...defaultFillScenario,
orderScenario: {
@@ -198,7 +198,7 @@ describe('FillOrder Tests', () => {
await fillOrderCombinatorialUtils.testFillOrderScenarioFailureAsync(fillScenario);
});
it('should throw if takerAssetAmount is 0', async () => {
it('should revert if takerAssetAmount is 0', async () => {
const fillScenario = {
...defaultFillScenario,
orderScenario: {
@@ -210,7 +210,7 @@ describe('FillOrder Tests', () => {
await fillOrderCombinatorialUtils.testFillOrderScenarioFailureAsync(fillScenario);
});
it('should throw if takerAssetFillAmount is 0', async () => {
it('should revert if takerAssetFillAmount is 0', async () => {
const fillScenario = {
...defaultFillScenario,
takerAssetFillAmountScenario: TakerAssetFillAmountScenario.Zero,
@@ -218,7 +218,7 @@ describe('FillOrder Tests', () => {
await fillOrderCombinatorialUtils.testFillOrderScenarioFailureAsync(fillScenario);
});
it('should throw if an order is expired', async () => {
it('should revert if an order is expired', async () => {
const fillScenario = {
...defaultFillScenario,
orderScenario: {
@@ -331,7 +331,7 @@ describe('FillOrder Tests', () => {
await fillOrderCombinatorialUtils.testFillOrderScenarioSuccessAsync(fillScenario);
});
it('should throw if maker balance is too low to fill order', async () => {
it('should revert if maker balance is too low to fill order', async () => {
const fillScenario = {
...defaultFillScenario,
makerStateScenario: {
@@ -342,7 +342,7 @@ describe('FillOrder Tests', () => {
await fillOrderCombinatorialUtils.testFillOrderScenarioFailureAsync(fillScenario);
});
it('should throw if taker balance is too low to fill order', async () => {
it('should revert if taker balance is too low to fill order', async () => {
const fillScenario = {
...defaultFillScenario,
takerStateScenario: {
@@ -353,7 +353,7 @@ describe('FillOrder Tests', () => {
await fillOrderCombinatorialUtils.testFillOrderScenarioFailureAsync(fillScenario);
});
it('should throw if maker allowances are too low to fill order', async () => {
it('should revert if maker allowances are too low to fill order', async () => {
const fillScenario = {
...defaultFillScenario,
makerStateScenario: {
@@ -364,7 +364,7 @@ describe('FillOrder Tests', () => {
await fillOrderCombinatorialUtils.testFillOrderScenarioFailureAsync(fillScenario);
});
it('should throw if taker allowances are too low to fill order', async () => {
it('should revert if taker allowances are too low to fill order', async () => {
const fillScenario = {
...defaultFillScenario,
takerStateScenario: {
@@ -375,7 +375,7 @@ describe('FillOrder Tests', () => {
await fillOrderCombinatorialUtils.testFillOrderScenarioFailureAsync(fillScenario);
});
it('should throw if maker fee balance is too low to fill order', async () => {
it('should revert if maker fee balance is too low to fill order', async () => {
const fillScenario = {
...defaultFillScenario,
makerStateScenario: {
@@ -386,7 +386,7 @@ describe('FillOrder Tests', () => {
await fillOrderCombinatorialUtils.testFillOrderScenarioFailureAsync(fillScenario);
});
it('should throw if taker fee balance is too low to fill order', async () => {
it('should revert if taker fee balance is too low to fill order', async () => {
const fillScenario = {
...defaultFillScenario,
takerStateScenario: {
@@ -397,7 +397,7 @@ describe('FillOrder Tests', () => {
await fillOrderCombinatorialUtils.testFillOrderScenarioFailureAsync(fillScenario);
});
it('should throw if maker fee allowances are too low to fill order', async () => {
it('should revert if maker fee allowances are too low to fill order', async () => {
const fillScenario = {
...defaultFillScenario,
makerStateScenario: {
@@ -408,7 +408,7 @@ describe('FillOrder Tests', () => {
await fillOrderCombinatorialUtils.testFillOrderScenarioFailureAsync(fillScenario);
});
it('should throw if taker fee allowances are too low to fill order', async () => {
it('should revert if taker fee allowances are too low to fill order', async () => {
const fillScenario = {
...defaultFillScenario,
takerStateScenario: {

View File

@@ -1286,7 +1286,7 @@ describe('matchOrders', () => {
);
});
it('Should throw if left order is not fillable', async () => {
it('Should revert if left order is not fillable', async () => {
// Create orders to match
const signedOrderLeft = await orderFactoryLeft.newSignedOrderAsync({
makerAssetAmount: Web3Wrapper.toBaseUnitAmount(5, 18),
@@ -1305,7 +1305,7 @@ describe('matchOrders', () => {
return expect(tx).to.revertWith(expectedError);
});
it('Should throw if right order is not fillable', async () => {
it('Should revert if right order is not fillable', async () => {
// Create orders to match
const signedOrderLeft = await orderFactoryLeft.newSignedOrderAsync({
makerAssetAmount: Web3Wrapper.toBaseUnitAmount(5, 18),
@@ -1324,7 +1324,7 @@ describe('matchOrders', () => {
return expect(tx).to.revertWith(expectedError);
});
it('should throw if there is not a positive spread', async () => {
it('should revert if there is not a positive spread', async () => {
// Create orders to match
const signedOrderLeft = await orderFactoryLeft.newSignedOrderAsync({
makerAssetAmount: Web3Wrapper.toBaseUnitAmount(5, 18),
@@ -1342,7 +1342,7 @@ describe('matchOrders', () => {
return expect(tx).to.revertWith(expectedError);
});
it('should throw if the left maker asset is not equal to the right taker asset ', async () => {
it('should revert if the left maker asset is not equal to the right taker asset ', async () => {
// Create orders to match
const signedOrderLeft = await orderFactoryLeft.newSignedOrderAsync({
makerAssetAmount: Web3Wrapper.toBaseUnitAmount(5, 18),
@@ -1373,7 +1373,7 @@ describe('matchOrders', () => {
return expect(tx).to.revertWith(expectedError);
});
it('should throw if the right maker asset is not equal to the left taker asset', async () => {
it('should revert if the right maker asset is not equal to the left taker asset', async () => {
// Create orders to match
const signedOrderLeft = await orderFactoryLeft.newSignedOrderAsync({
takerAssetData: assetDataUtils.encodeERC20AssetData(defaultERC20MakerAssetAddress),
@@ -2416,7 +2416,7 @@ describe('matchOrders', () => {
);
});
it('Should throw if left order is not fillable', async () => {
it('Should revert if left order is not fillable', async () => {
// Create orders to match
const signedOrderLeft = await orderFactoryLeft.newSignedOrderAsync({
makerAssetAmount: Web3Wrapper.toBaseUnitAmount(5, 18),
@@ -2435,7 +2435,7 @@ describe('matchOrders', () => {
return expect(tx).to.revertWith(expectedError);
});
it('Should throw if right order is not fillable', async () => {
it('Should revert if right order is not fillable', async () => {
// Create orders to match
const signedOrderLeft = await orderFactoryLeft.newSignedOrderAsync({
makerAssetAmount: Web3Wrapper.toBaseUnitAmount(5, 18),
@@ -2454,7 +2454,7 @@ describe('matchOrders', () => {
return expect(tx).to.revertWith(expectedError);
});
it('should throw if there is not a positive spread', async () => {
it('should revert if there is not a positive spread', async () => {
// Create orders to match
const signedOrderLeft = await orderFactoryLeft.newSignedOrderAsync({
makerAssetAmount: Web3Wrapper.toBaseUnitAmount(5, 18),
@@ -2472,7 +2472,7 @@ describe('matchOrders', () => {
return expect(tx).to.revertWith(expectedError);
});
it('should throw if the left maker asset is not equal to the right taker asset ', async () => {
it('should revert if the left maker asset is not equal to the right taker asset ', async () => {
// Create orders to match
const signedOrderLeft = await orderFactoryLeft.newSignedOrderAsync({
makerAssetAmount: Web3Wrapper.toBaseUnitAmount(5, 18),
@@ -2503,7 +2503,7 @@ describe('matchOrders', () => {
return expect(tx).to.revertWith(expectedError);
});
it('should throw if the right maker asset is not equal to the left taker asset', async () => {
it('should revert if the right maker asset is not equal to the left taker asset', async () => {
// Create orders to match
const signedOrderLeft = await orderFactoryLeft.newSignedOrderAsync({
takerAssetData: assetDataUtils.encodeERC20AssetData(defaultERC20MakerAssetAddress),

View File

@@ -495,7 +495,7 @@ describe('MixinSignatureValidator', () => {
return expect(tx).to.revertWith(expectedError);
});
it('should throw when SignatureType=Validator, signature is valid and validator is not approved', async () => {
it('should revert when SignatureType=Validator, signature is valid and validator is not approved', async () => {
// Set approval of signature validator to false
await signatureValidator.setSignatureValidatorApproval.awaitTransactionSuccessAsync(
validatorWallet.address,
@@ -702,7 +702,7 @@ describe('MixinSignatureValidator', () => {
return expect(tx).to.revertWith(expectedError);
});
it('should throw when SignatureType=Validator, signature is valid and validator is not approved', async () => {
it('should revert when SignatureType=Validator, signature is valid and validator is not approved', async () => {
// Set approval of signature validator to false
await signatureValidator.setSignatureValidatorApproval.awaitTransactionSuccessAsync(
validatorWallet.address,

View File

@@ -234,7 +234,7 @@ describe('Exchange wrappers', () => {
);
});
it('should throw if a signedOrder is expired', async () => {
it('should revert if a signedOrder is expired', async () => {
const currentTimestamp = await getLatestBlockTimestampAsync();
const signedOrder = await orderFactory.newSignedOrderAsync({
expirationTimeSeconds: new BigNumber(currentTimestamp).minus(10),
@@ -245,7 +245,7 @@ describe('Exchange wrappers', () => {
return expect(tx).to.revertWith(expectedError);
});
it('should throw if entire takerAssetFillAmount not filled', async () => {
it('should revert if entire takerAssetFillAmount not filled', async () => {
const signedOrder = await orderFactory.newSignedOrderAsync();
await exchangeWrapper.fillOrderAsync(signedOrder, takerAddress, {
@@ -815,7 +815,7 @@ describe('Exchange wrappers', () => {
expect(newBalances).to.be.deep.equal(erc20Balances);
});
it('should throw if a single signedOrder does not fill the expected amount', async () => {
it('should revert if a single signedOrder does not fill the expected amount', async () => {
const takerAssetFillAmounts: BigNumber[] = [];
_.forEach(signedOrders, signedOrder => {
const takerAssetFillAmount = signedOrder.takerAssetAmount.div(2);
@@ -922,7 +922,7 @@ describe('Exchange wrappers', () => {
expect(newBalances).to.be.deep.equal(erc20Balances);
});
it('should not throw if an order is invalid and fill the remaining orders', async () => {
it('should not revert if an order is invalid and fill the remaining orders', async () => {
const makerAssetAddress = erc20TokenA.address;
const takerAssetAddress = erc20TokenB.address;
@@ -1132,7 +1132,7 @@ describe('Exchange wrappers', () => {
expect(newBalances).to.be.deep.equal(erc20Balances);
});
it('should throw when a signedOrder does not use the same takerAssetAddress', async () => {
it('should revert when a signedOrder does not use the same takerAssetAddress', async () => {
signedOrders = [
await orderFactory.newSignedOrderAsync(),
await orderFactory.newSignedOrderAsync({
@@ -1510,7 +1510,7 @@ describe('Exchange wrappers', () => {
expect(newBalances).to.be.deep.equal(erc20Balances);
});
it('should throw when a signedOrder does not use the same makerAssetAddress', async () => {
it('should revert when a signedOrder does not use the same makerAssetAddress', async () => {
signedOrders = [
await orderFactory.newSignedOrderAsync(),
await orderFactory.newSignedOrderAsync({