Skip to content

Commit 02730ee

Browse files
committed
Make sure we connect to the correct endpoint
1 parent 1f70c31 commit 02730ee

File tree

4 files changed

+6
-5
lines changed

4 files changed

+6
-5
lines changed

e2e/scaffolding/env.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
export const providerUrl = process.env.WS_PROVIDER_URL;
1+
export const providerUrl: string = process.env.WS_PROVIDER_URL || 'ws://localhost:9944';
22
export const verbose = process.env.VERBOSE_TESTS === 'true' || process.env.VERBOSE_TESTS === '1';
33

44
const CHAIN_ENVIRONMENT = {

e2e/scaffolding/extrinsicHelpers.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -306,7 +306,7 @@ export class ExtrinsicHelper {
306306
public static api: ApiRx;
307307
public static apiPromise: ApiPromise;
308308

309-
public static async initialize(providerUrl?: string | string[] | undefined) {
309+
public static async initialize(providerUrl: string | string[]) {
310310
ExtrinsicHelper.api = await connect(providerUrl);
311311
// For single state queries (api.query), ApiPromise is better
312312
ExtrinsicHelper.apiPromise = await connectPromise(providerUrl);

e2e/scaffolding/globalHooks.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import workerpool from 'workerpool';
55
import { ExtrinsicHelper } from './extrinsicHelpers';
66
import { fundingSources, getFundingSource, getRootFundingSource, getSudo } from './funding';
77
import { TEST_EPOCH_LENGTH, drainKeys, getNonce, setEpochLength } from './helpers';
8-
import { isDev } from './env';
8+
import { isDev, providerUrl } from './env';
99

1010
const SOURCE_AMOUNT = 100_000_000_000_000n;
1111

@@ -35,7 +35,7 @@ function drainAllSources() {
3535
export async function mochaGlobalSetup() {
3636
console.log('Global Setup Start', 'Reported CPU Count: ', workerpool.cpus);
3737
await cryptoWaitReady();
38-
await ExtrinsicHelper.initialize();
38+
await ExtrinsicHelper.initialize(providerUrl);
3939
await fundAllSources();
4040

4141
// Sudo is only when not on Testnet

e2e/scaffolding/rootHooks.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import { cryptoWaitReady } from '@polkadot/util-crypto';
44
import { ExtrinsicHelper } from './extrinsicHelpers';
55
import { drainFundedKeys } from './helpers';
66
import { getRootFundingSource } from './funding';
7+
import { providerUrl } from './env';
78

89
// Make sure that we can serialize BigInts for Mocha
910
(BigInt.prototype as any).toJSON = function () {
@@ -14,7 +15,7 @@ export const mochaHooks = {
1415
async beforeAll() {
1516
try {
1617
await cryptoWaitReady();
17-
await ExtrinsicHelper.initialize();
18+
await ExtrinsicHelper.initialize(providerUrl);
1819
} catch (e) {
1920
console.error('Failed to run beforeAll root hook: ', this.test.parent.suites[0].title, e);
2021
}

0 commit comments

Comments
 (0)