diff options
author | Fabio Berger <me@fabioberger.com> | 2018-06-27 17:02:40 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-06-27 17:02:40 +0800 |
commit | f9fab216e9874a2457e614e55209705dd7828386 (patch) | |
tree | 5d9c16c1a51513a7da60cb6a4278845511144228 /packages/contracts/src/utils/assertions.ts | |
parent | e59c57106cd15d45efb6f4100529cf6e5dfe71a8 (diff) | |
parent | 84bd54ba4025a33f4e311ec66d81d58b45e54d6b (diff) | |
download | dexon-sol-tools-f9fab216e9874a2457e614e55209705dd7828386.tar dexon-sol-tools-f9fab216e9874a2457e614e55209705dd7828386.tar.gz dexon-sol-tools-f9fab216e9874a2457e614e55209705dd7828386.tar.bz2 dexon-sol-tools-f9fab216e9874a2457e614e55209705dd7828386.tar.lz dexon-sol-tools-f9fab216e9874a2457e614e55209705dd7828386.tar.xz dexon-sol-tools-f9fab216e9874a2457e614e55209705dd7828386.tar.zst dexon-sol-tools-f9fab216e9874a2457e614e55209705dd7828386.zip |
Merge branch 'v2-prototype' into invalid-argument-error
Diffstat (limited to 'packages/contracts/src/utils/assertions.ts')
-rw-r--r-- | packages/contracts/src/utils/assertions.ts | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/packages/contracts/src/utils/assertions.ts b/packages/contracts/src/utils/assertions.ts index 615e648f3..e702a3200 100644 --- a/packages/contracts/src/utils/assertions.ts +++ b/packages/contracts/src/utils/assertions.ts @@ -1,3 +1,4 @@ +import { RevertReason } from '@0xproject/types'; import * as chai from 'chai'; import * as _ from 'lodash'; @@ -52,6 +53,21 @@ 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: RevertReason, +): 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 |