Skip to content
This repository has been archived by the owner on Sep 14, 2023. It is now read-only.

Commit

Permalink
fix failing test
Browse files Browse the repository at this point in the history
  • Loading branch information
harrysolovay committed Nov 7, 2022
1 parent 61ee273 commit 43efdc4
Showing 1 changed file with 9 additions and 5 deletions.
14 changes: 9 additions & 5 deletions test_util/local.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,12 @@ const hostname = Deno.env.get("TEST_CTX_HOSTNAME");
const portRaw = Deno.env.get("TEST_CTX_PORT");

class LocalClient extends C.rpc.Client<string, Event, Event, Event> {
url;

constructor(port: number, close: () => void) {
super(C.rpc.proxyProvider, `ws://127.0.0.1:${port}`);
const url = `ws://127.0.0.1:${port}`;
super(C.rpc.proxyProvider, url);
this.url = url;
const prevDiscard = this.discard;
this.discard = async () => {
const closeError = await prevDiscard();
Expand Down Expand Up @@ -37,17 +41,17 @@ export class LocalClientEffect extends Z.Effect<LocalClient, PolkadotBinNotFound
getClientContainer.getClient = this.createClient.bind(this);
}

get url(): Promise<string> {
return null!;
}

get client(): Promise<LocalClient> {
if (!this.#clientPending) {
this.#clientPending = this.createClient();
}
return this.#clientPending;
}

get url(): Promise<string> {
return this.client.then(({ url }) => url);
}

private async createClient(): Promise<LocalClient> {
let port: number;
let close = () => {};
Expand Down

0 comments on commit 43efdc4

Please sign in to comment.