aboutsummaryrefslogtreecommitdiffstats
path: root/packages/contracts/test
diff options
context:
space:
mode:
authorAlex Browne <stephenalexbrowne@gmail.com>2018-05-22 04:56:32 +0800
committerAlex Browne <stephenalexbrowne@gmail.com>2018-06-07 03:39:39 +0800
commit577156fe5f63e581b101682d13b7e70e7a9336e5 (patch)
tree202d928d4888825a4ea1f24e2fd03368643c2966 /packages/contracts/test
parentda3f783a9ff69b059b1a98f502d980660d6bacab (diff)
downloaddexon-0x-contracts-577156fe5f63e581b101682d13b7e70e7a9336e5.tar.gz
dexon-0x-contracts-577156fe5f63e581b101682d13b7e70e7a9336e5.tar.zst
dexon-0x-contracts-577156fe5f63e581b101682d13b7e70e7a9336e5.zip
Use Geth for contract tests
Diffstat (limited to 'packages/contracts/test')
-rw-r--r--packages/contracts/test/utils/assertions.ts20
1 files changed, 20 insertions, 0 deletions
diff --git a/packages/contracts/test/utils/assertions.ts b/packages/contracts/test/utils/assertions.ts
new file mode 100644
index 000000000..538a6e4fc
--- /dev/null
+++ b/packages/contracts/test/utils/assertions.ts
@@ -0,0 +1,20 @@
+import * as chai from 'chai';
+import * as _ from 'lodash';
+
+import { constants } from '../../util/constants';
+
+const expect = chai.expect;
+
+// throws if the given promise does not reject with one of two expected error
+// messages.
+export const expectRevertOrAlwaysFailingTransaction = <T>(p: Promise<T>) => {
+ return expect(p)
+ .to.be.rejected()
+ .then(e => {
+ expect(e).to.satisfy(
+ (err: Error) =>
+ _.includes(err.message, constants.REVERT) ||
+ _.includes(err.message, constants.ALWAYS_FAILING_TRANSACTION),
+ );
+ });
+};