aboutsummaryrefslogtreecommitdiffstats
path: root/packages/contracts/test/utils/assertions.ts
diff options
context:
space:
mode:
authorAlex Browne <stephenalexbrowne@gmail.com>2018-07-04 03:55:05 +0800
committerAlex Browne <stephenalexbrowne@gmail.com>2018-07-04 03:57:11 +0800
commitdc956020ef7c6d3f1880263700422b31253c8da3 (patch)
tree6574a09976cfb5944107b3667748e85520c260a9 /packages/contracts/test/utils/assertions.ts
parentce1542da4fbab26d589f07f006fb5328a28bb9dd (diff)
downloaddexon-sol-tools-dc956020ef7c6d3f1880263700422b31253c8da3.tar
dexon-sol-tools-dc956020ef7c6d3f1880263700422b31253c8da3.tar.gz
dexon-sol-tools-dc956020ef7c6d3f1880263700422b31253c8da3.tar.bz2
dexon-sol-tools-dc956020ef7c6d3f1880263700422b31253c8da3.tar.lz
dexon-sol-tools-dc956020ef7c6d3f1880263700422b31253c8da3.tar.xz
dexon-sol-tools-dc956020ef7c6d3f1880263700422b31253c8da3.tar.zst
dexon-sol-tools-dc956020ef7c6d3f1880263700422b31253c8da3.zip
Move NodeType caching out of web3-wrapper and into our internal code
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);