ai/test/__mocks__/ws.ts
2022-08-10 16:58:29 +09:00

17 lines
327 B
TypeScript

import * as websocket from 'websocket';
export class StreamingApi {
private ws: WS;
constructor() {
this.ws = new WS('ws://localhost/streaming');
}
public async waitForMainChannelConnected() {
await expect(this.ws).toReceiveMessage('hello');
}
public send(message) {
this.ws.send(JSON.stringify(message));
}
}