aboutsummaryrefslogtreecommitdiffstats
path: root/packages/contracts/test/utils/assertions.ts
diff options
context:
space:
mode:
Diffstat (limited to 'packages/contracts/test/utils/assertions.ts')
-rw-r--r--packages/contracts/test/utils/assertions.ts10
1 files changed, 8 insertions, 2 deletions
diff --git a/packages/contracts/test/utils/assertions.ts b/packages/contracts/test/utils/assertions.ts
index c8031c8a1..112a470f6 100644
--- a/packages/contracts/test/utils/assertions.ts
+++ b/packages/contracts/test/utils/assertions.ts
@@ -9,12 +9,16 @@ import { web3Wrapper } from './web3_wrapper';
const expect = chai.expect;
+let nodeType: NodeType | undefined;
+
// Represents the return value of a `sendTransaction` call. The Promise should
// resolve with either a transaction receipt or a transaction hash.
export type sendTransactionResult = Promise<TransactionReceipt | TransactionReceiptWithDecodedLogs | string>;
async function _getGanacheOrGethError(ganacheError: string, gethError: string): Promise<string> {
- const nodeType = await web3Wrapper.getNodeTypeAsync();
+ if (_.isUndefined(nodeType)) {
+ nodeType = await web3Wrapper.getNodeTypeAsync();
+ }
switch (nodeType) {
case NodeType.Ganache:
return ganacheError;
@@ -68,7 +72,9 @@ export async function expectTransactionFailedAsync(p: sendTransactionResult, rea
_.noop(e);
});
- const nodeType = await web3Wrapper.getNodeTypeAsync();
+ if (_.isUndefined(nodeType)) {
+ nodeType = await web3Wrapper.getNodeTypeAsync();
+ }
switch (nodeType) {
case NodeType.Ganache:
return expect(p).to.be.rejectedWith(reason);