aboutsummaryrefslogtreecommitdiffstats
path: root/packages/contracts/src/utils/assertions.ts
diff options
context:
space:
mode:
authorfragosti <francesco.agosti93@gmail.com>2018-06-29 02:13:19 +0800
committerfragosti <francesco.agosti93@gmail.com>2018-06-29 02:17:30 +0800
commite4188f5d4c38e53bf6966a364da41a3aa164b567 (patch)
treeac24b29f975be088a9d3d391f8a73acc7ad14aba /packages/contracts/src/utils/assertions.ts
parent360927ec77d5ea50848f4c1b2c66566542a28d1c (diff)
parent0fcbd02d50bd564a9c888f247a4b0a565d928cc6 (diff)
downloaddexon-sol-tools-e4188f5d4c38e53bf6966a364da41a3aa164b567.tar
dexon-sol-tools-e4188f5d4c38e53bf6966a364da41a3aa164b567.tar.gz
dexon-sol-tools-e4188f5d4c38e53bf6966a364da41a3aa164b567.tar.bz2
dexon-sol-tools-e4188f5d4c38e53bf6966a364da41a3aa164b567.tar.lz
dexon-sol-tools-e4188f5d4c38e53bf6966a364da41a3aa164b567.tar.xz
dexon-sol-tools-e4188f5d4c38e53bf6966a364da41a3aa164b567.tar.zst
dexon-sol-tools-e4188f5d4c38e53bf6966a364da41a3aa164b567.zip
Merge branch 'v2-prototype' of https://github.com/0xProject/0x-monorepo into feature/website/support-new-metamask
Diffstat (limited to 'packages/contracts/src/utils/assertions.ts')
-rw-r--r--packages/contracts/src/utils/assertions.ts16
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