aboutsummaryrefslogtreecommitdiffstats
path: root/packages/contracts/src/utils
diff options
context:
space:
mode:
authorAlex Browne <stephenalexbrowne@gmail.com>2018-06-02 06:59:34 +0800
committerAlex Browne <stephenalexbrowne@gmail.com>2018-06-07 03:40:30 +0800
commit2dfc4680941293ca9f4a55f3ca58b9ee68872754 (patch)
treeb4f06876bfa2e18c455bf13c24a62b3d8787741c /packages/contracts/src/utils
parent98ffe9931d4fd8886955c45c42eb63b33184ddd2 (diff)
downloaddexon-0x-contracts-2dfc4680941293ca9f4a55f3ca58b9ee68872754.tar.gz
dexon-0x-contracts-2dfc4680941293ca9f4a55f3ca58b9ee68872754.tar.zst
dexon-0x-contracts-2dfc4680941293ca9f4a55f3ca58b9ee68872754.zip
Update more tests to pass on Geth
Diffstat (limited to 'packages/contracts/src/utils')
-rw-r--r--packages/contracts/src/utils/assertions.ts12
-rw-r--r--packages/contracts/src/utils/constants.ts2
2 files changed, 14 insertions, 0 deletions
diff --git a/packages/contracts/src/utils/assertions.ts b/packages/contracts/src/utils/assertions.ts
index e3f31bf89..1e8d58b9f 100644
--- a/packages/contracts/src/utils/assertions.ts
+++ b/packages/contracts/src/utils/assertions.ts
@@ -18,3 +18,15 @@ export function expectRevertOrAlwaysFailingTransaction<T>(p: Promise<T>): Promis
);
});
}
+
+export function expectInsufficientFunds<T>(p: Promise<T>): PromiseLike<void> {
+ return expect(p)
+ .to.be.rejected()
+ .then(e => {
+ expect(e).to.satisfy(
+ (err: Error) =>
+ _.includes(err.message, 'insufficient funds') ||
+ _.includes(err.message, "sender doesn't have enough funds"),
+ );
+ });
+}
diff --git a/packages/contracts/src/utils/constants.ts b/packages/contracts/src/utils/constants.ts
index a0369c256..60f41b51b 100644
--- a/packages/contracts/src/utils/constants.ts
+++ b/packages/contracts/src/utils/constants.ts
@@ -25,6 +25,8 @@ export const constants = {
LIB_BYTES_GTE_20_LENGTH_REQUIRED: 'Length must be greater than or equal to 20.',
LIB_BYTES_GTE_32_LENGTH_REQUIRED: 'Length must be greater than or equal to 32.',
LIB_BYTES_INDEX_OUT_OF_BOUNDS: 'Specified array index is out of bounds.',
+ ERC20_INSUFFICIENT_BALANCE: 'Insufficient balance to complete transfer.',
+ ERC20_INSUFFICIENT_ALLOWANCE: 'Insufficient allowance to complete transfer.',
TESTRPC_NETWORK_ID: 50,
AWAIT_TRANSACTION_MINED_MS: 100,
MAX_ETHERTOKEN_WITHDRAW_GAS: 43000,