-
Notifications
You must be signed in to change notification settings - Fork 17
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Code improvements according to PR comments in review.
- Loading branch information
1 parent
d073aef
commit 6a90db1
Showing
11 changed files
with
106 additions
and
146 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
import WebSocket from 'ws'; | ||
|
||
export class TestHelper { | ||
public static getWsUrl = (gatewayPort: number): string => { | ||
const wsUrl = `ws://localhost:${gatewayPort}`; | ||
return wsUrl; | ||
}; | ||
|
||
public static setupWs = async (wsUrl: string, docName?: string): Promise<WebSocket> => { | ||
let ws: WebSocket; | ||
if (docName) { | ||
ws = new WebSocket(`${wsUrl}/${docName}`); | ||
} else { | ||
ws = new WebSocket(`${wsUrl}`); | ||
} | ||
await new Promise((resolve) => { | ||
ws.on('open', resolve); | ||
}); | ||
|
||
return ws; | ||
}; | ||
} |
Oops, something went wrong.