diff options
author | Alex Browne <stephenalexbrowne@gmail.com> | 2018-06-05 09:10:42 +0800 |
---|---|---|
committer | Alex Browne <stephenalexbrowne@gmail.com> | 2018-06-07 03:40:30 +0800 |
commit | bca62c813d2e821c56968916615861366402435b (patch) | |
tree | 041ea056d813b0db32520f7ca9e25e9799530c47 /packages/contracts/src/utils/assertions.ts | |
parent | ae1cf74dcd84b0a39a5781f63c1c3f2beb0e1857 (diff) | |
download | dexon-sol-tools-bca62c813d2e821c56968916615861366402435b.tar dexon-sol-tools-bca62c813d2e821c56968916615861366402435b.tar.gz dexon-sol-tools-bca62c813d2e821c56968916615861366402435b.tar.bz2 dexon-sol-tools-bca62c813d2e821c56968916615861366402435b.tar.lz dexon-sol-tools-bca62c813d2e821c56968916615861366402435b.tar.xz dexon-sol-tools-bca62c813d2e821c56968916615861366402435b.tar.zst dexon-sol-tools-bca62c813d2e821c56968916615861366402435b.zip |
Throw in web3-wrapper when rawCallResult is '0x'
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 1e8d58b9f..4fc410363 100644 --- a/packages/contracts/src/utils/assertions.ts +++ b/packages/contracts/src/utils/assertions.ts @@ -30,3 +30,15 @@ export function expectInsufficientFunds<T>(p: Promise<T>): PromiseLike<void> { ); }); } + +export function expectRevertOrContractCallFailed<T>(p: Promise<T>): PromiseLike<void> { + return expect(p) + .to.be.rejected() + .then(e => { + expect(e).to.satisfy( + (err: Error) => + _.includes(err.message, constants.REVERT) || + _.includes(err.message, constants.CONTRACT_CALL_FAILED), + ); + }); +} |