* Build a fresh mock WebSocketClient class. Each `new MockClient(url)` * registers the instance and arguments on the static `.mock` so tests can * assert on them. * @returns {new (url: string) => unknown} mock client constructor
()
| 11 | * @returns {new (url: string) => unknown} mock client constructor |
| 12 | */ |
| 13 | function createMockClient() { |
| 14 | class MockClient { |
| 15 | constructor(url) { |
| 16 | MockClient.mock.instances.push(this); |
| 17 | MockClient.mock.calls.push([url]); |
| 18 | this.onOpen = fn(); |
| 19 | this.onClose = fn(); |
| 20 | this.onMessage = fn(); |
| 21 | } |
| 22 | } |
| 23 | MockClient.mock = { instances: [], calls: [] }; |
| 24 | return MockClient; |
| 25 | } |
| 26 | |
| 27 | describe("socket", () => { |
| 28 | beforeEach(() => { |
no outgoing calls
no test coverage detected
searching dependent graphs…