diff options
author | Fabio Berger <me@fabioberger.com> | 2018-06-25 18:32:16 +0800 |
---|---|---|
committer | Fabio Berger <me@fabioberger.com> | 2018-06-25 18:32:16 +0800 |
commit | c50da5d0344cd23392f71d213fff9dfec7ec71c9 (patch) | |
tree | 067e106202a83c0cd3bc929a940145100293f2b1 /packages/contracts/src/utils/assertions.ts | |
parent | 9b196ba68c9f958cd82ef99ae87fdd87c70441a9 (diff) | |
parent | df79fb19aff1aa1ed7b1346feccfa3d235c25ea0 (diff) | |
download | dexon-0x-contracts-c50da5d0344cd23392f71d213fff9dfec7ec71c9.tar dexon-0x-contracts-c50da5d0344cd23392f71d213fff9dfec7ec71c9.tar.gz dexon-0x-contracts-c50da5d0344cd23392f71d213fff9dfec7ec71c9.tar.bz2 dexon-0x-contracts-c50da5d0344cd23392f71d213fff9dfec7ec71c9.tar.lz dexon-0x-contracts-c50da5d0344cd23392f71d213fff9dfec7ec71c9.tar.xz dexon-0x-contracts-c50da5d0344cd23392f71d213fff9dfec7ec71c9.tar.zst dexon-0x-contracts-c50da5d0344cd23392f71d213fff9dfec7ec71c9.zip |
merge check-revert-reasons
Diffstat (limited to 'packages/contracts/src/utils/assertions.ts')
-rw-r--r-- | packages/contracts/src/utils/assertions.ts | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/packages/contracts/src/utils/assertions.ts b/packages/contracts/src/utils/assertions.ts index 615e648f3..29489e648 100644 --- a/packages/contracts/src/utils/assertions.ts +++ b/packages/contracts/src/utils/assertions.ts @@ -52,6 +52,18 @@ export function expectRevertOrAlwaysFailingTransactionAsync<T>(p: Promise<T>): P } /** + * Rejects if the given Promise does not reject with the given revert reason or "always + * failing transaction" error. + * @param p the Promise which is expected to reject + * @param reason a specific revert reason + * @returns a new Promise which will reject if the conditions are not met and + * otherwise resolve with no value. + */ +export function expectRevertReasonOrAlwaysFailingTransactionAsync<T>(p: Promise<T>, reason: string): PromiseLike<void> { + return _expectEitherErrorAsync(p, 'always failing transaction', reason); +} + +/** * Rejects if the given Promise does not reject with a "revert" or "Contract * call failed" error. * @param p the Promise which is expected to reject |