From d5faeec9433189115e4bd7e8cfe8feae5214e1d5 Mon Sep 17 00:00:00 2001 From: Alex Rea Date: Mon, 10 Oct 2022 16:15:47 +0100 Subject: [PATCH] Fix incorrect refactor of checkErrorRevert --- helpers/test-helper.js | 5 ++++- test/extensions/staked-expenditure.js | 11 ----------- 2 files changed, 4 insertions(+), 12 deletions(-) diff --git a/helpers/test-helper.js b/helpers/test-helper.js index 6ff247b66c..2c8ed442cd 100644 --- a/helpers/test-helper.js +++ b/helpers/test-helper.js @@ -191,9 +191,12 @@ exports.checkErrorRevert = async function checkErrorRevert(promise, errorMessage const txid = await promise; receipt = await exports.web3GetTransactionReceipt(txid); // Check the receipt `status` to ensure transaction failed. - expect(receipt.status, `Transaction succeeded, but expected error ${errorMessage}`).to.be.false; } + expect(receipt.status, `Transaction succeeded, but expected error ${errorMessage}`).to.be.false; } catch (err) { + if (err.toString().indexOf("AssertionError: Transaction succeeded, but expected error") === 0) { + throw err; + } ({ reason } = err); expect(reason).to.equal(errorMessage); } diff --git a/test/extensions/staked-expenditure.js b/test/extensions/staked-expenditure.js index ba57f92138..2f9c16b065 100644 --- a/test/extensions/staked-expenditure.js +++ b/test/extensions/staked-expenditure.js @@ -323,17 +323,6 @@ contract("StakedExpenditure", (accounts) => { expect(userLock.balance).to.eq.BN(WAD.sub(requiredStake)); }); - it("cannot slash a nonexistent stake", async () => { - await colony.makeExpenditure(1, UINT256_MAX, 1); - const expenditureId = await colony.getExpenditureCount(); - await colony.lockExpenditure(expenditureId); - - await checkErrorRevert( - stakedExpenditure.cancelAndPunish(1, UINT256_MAX, 1, UINT256_MAX, expenditureId, true), - "staked-expenditure-nothing-to-slash" - ); - }); - it("can reclaim the stake by cancelling the expenditure", async () => { await stakedExpenditure.makeExpenditureWithStake(1, UINT256_MAX, 1, domain1Key, domain1Value, domain1Mask, domain1Siblings, { from: USER0 }); const expenditureId = await colony.getExpenditureCount();