aboutsummaryrefslogtreecommitdiffstats
path: root/packages/contracts/src/utils/assertions.ts
diff options
context:
space:
mode:
Diffstat (limited to 'packages/contracts/src/utils/assertions.ts')
-rw-r--r--packages/contracts/src/utils/assertions.ts12
1 files changed, 12 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"),
+ );
+ });
+}