Function
connectMockApp
(
relayPort: number,
appName = "TestApp"
)
Source from the content-addressed store, hash-verified
| 44 | |
| 45 | // Helper: connect a mock app to the relay |
| 46 | function connectMockApp( |
| 47 | relayPort: number, |
| 48 | appName = "TestApp" |
| 49 | ): Promise<WebSocket> { |
| 50 | return new Promise((resolve) => { |
| 51 | const ws = new WebSocket(`ws://localhost:${relayPort}`) |
| 52 | ws.on("open", () => { |
| 53 | ws.send( |
| 54 | JSON.stringify({ |
| 55 | type: "client.intro", |
| 56 | payload: { |
| 57 | name: appName, |
| 58 | platform: "ios", |
| 59 | platformVersion: "17.0", |
| 60 | clientId: `${appName}-ios-test`, |
| 61 | }, |
| 62 | }) |
| 63 | ) |
| 64 | // Give the relay time to process |
| 65 | setTimeout(() => resolve(ws), 100) |
| 66 | }) |
| 67 | }) |
| 68 | } |
| 69 | |
| 70 | let relayPort: number |
| 71 | let mcpPort: number |
Tested by
no test coverage detected