aboutsummaryrefslogtreecommitdiffstats
path: root/packages/contracts/test/multi_sig_with_time_lock.ts
diff options
context:
space:
mode:
Diffstat (limited to 'packages/contracts/test/multi_sig_with_time_lock.ts')
-rw-r--r--packages/contracts/test/multi_sig_with_time_lock.ts18
1 files changed, 10 insertions, 8 deletions
diff --git a/packages/contracts/test/multi_sig_with_time_lock.ts b/packages/contracts/test/multi_sig_with_time_lock.ts
index afe7571af..48bc9b4e0 100644
--- a/packages/contracts/test/multi_sig_with_time_lock.ts
+++ b/packages/contracts/test/multi_sig_with_time_lock.ts
@@ -9,8 +9,10 @@ import {
SubmissionContractEventArgs,
} from '../src/contract_wrappers/generated/multi_sig_wallet_with_time_lock';
import { artifacts } from '../src/utils/artifacts';
+import { expectRevertOrAlwaysFailingTransactionAsync } from '../src/utils/assertions';
import { chaiSetup } from '../src/utils/chai_setup';
import { constants } from '../src/utils/constants';
+import { increaseTimeAndMineBlockAsync } from '../src/utils/increase_time';
import { MultiSigWrapper } from '../src/utils/multi_sig_wrapper';
import { provider, txDefaults, web3Wrapper } from '../src/utils/web3_wrapper';
@@ -66,9 +68,9 @@ describe('MultiSigWalletWithTimeLock', () => {
});
it('should throw when not called by wallet', async () => {
- return expect(
+ return expectRevertOrAlwaysFailingTransactionAsync(
multiSig.changeTimeLock.sendTransactionAsync(SECONDS_TIME_LOCKED, { from: owners[0] }),
- ).to.be.rejectedWith(constants.REVERT);
+ );
});
it('should throw without enough confirmations', async () => {
@@ -77,10 +79,9 @@ describe('MultiSigWalletWithTimeLock', () => {
const res = await multiSigWrapper.submitTransactionAsync(destination, changeTimeLockData, owners[0]);
const log = res.logs[0] as LogWithDecodedArgs<SubmissionContractEventArgs>;
const txId = log.args.transactionId;
-
- return expect(
+ return expectRevertOrAlwaysFailingTransactionAsync(
multiSig.executeTransaction.sendTransactionAsync(txId, { from: owners[0] }),
- ).to.be.rejectedWith(constants.REVERT);
+ );
});
it('should set confirmation time with enough confirmations', async () => {
@@ -145,14 +146,15 @@ describe('MultiSigWalletWithTimeLock', () => {
txId = log.args.transactionId;
await multiSigWrapper.confirmTransactionAsync(txId, owners[1]);
});
+
it('should throw if it has enough confirmations but is not past the time lock', async () => {
- return expect(
+ return expectRevertOrAlwaysFailingTransactionAsync(
multiSig.executeTransaction.sendTransactionAsync(txId, { from: owners[0] }),
- ).to.be.rejectedWith(constants.REVERT);
+ );
});
it('should execute if it has enough confirmations and is past the time lock', async () => {
- await web3Wrapper.increaseTimeAsync(SECONDS_TIME_LOCKED.toNumber());
+ await increaseTimeAndMineBlockAsync(SECONDS_TIME_LOCKED.toNumber());
await web3Wrapper.awaitTransactionSuccessAsync(
await multiSig.executeTransaction.sendTransactionAsync(txId, { from: owners[0] }),
constants.AWAIT_TRANSACTION_MINED_MS,