aboutsummaryrefslogtreecommitdiffstats
path: root/test/utils
diff options
context:
space:
mode:
Diffstat (limited to 'test/utils')
-rw-r--r--test/utils/blockchain_lifecycle.ts3
-rw-r--r--test/utils/report_callback_errors.ts14
-rw-r--r--test/utils/rpc.ts6
3 files changed, 23 insertions, 0 deletions
diff --git a/test/utils/blockchain_lifecycle.ts b/test/utils/blockchain_lifecycle.ts
index 9fdf0e856..9a44ccd6f 100644
--- a/test/utils/blockchain_lifecycle.ts
+++ b/test/utils/blockchain_lifecycle.ts
@@ -20,4 +20,7 @@ export class BlockchainLifecycle {
throw new Error(`Snapshot with id #${snapshotId} failed to revert`);
}
}
+ public async mineABlock(): Promise<void> {
+ await this.rpc.mineBlockAsync();
+ }
}
diff --git a/test/utils/report_callback_errors.ts b/test/utils/report_callback_errors.ts
new file mode 100644
index 000000000..d471b2af2
--- /dev/null
+++ b/test/utils/report_callback_errors.ts
@@ -0,0 +1,14 @@
+import { DoneCallback } from '../../src/types';
+
+export const reportCallbackErrors = (done: DoneCallback) => {
+ return (f: (...args: any[]) => void) => {
+ const wrapped = (...args: any[]) => {
+ try {
+ f(...args);
+ } catch (err) {
+ done(err);
+ }
+ };
+ return wrapped;
+ };
+};
diff --git a/test/utils/rpc.ts b/test/utils/rpc.ts
index f28a85340..299e72e79 100644
--- a/test/utils/rpc.ts
+++ b/test/utils/rpc.ts
@@ -26,6 +26,12 @@ export class RPC {
const didRevert = await this.sendAsync(payload);
return didRevert;
}
+ public async mineBlockAsync(): Promise<void> {
+ const method = 'evm_mine';
+ const params: any[] = [];
+ const payload = this.toPayload(method, params);
+ await this.sendAsync(payload);
+ }
private toPayload(method: string, params: any[] = []): string {
const payload = JSON.stringify({
id: this.id,