()
| 37 | } |
| 38 | |
| 39 | function createMockEventSourceClass() { |
| 40 | return class MockEventSource { |
| 41 | url: string |
| 42 | onmessage: any = null |
| 43 | close = vi.fn() |
| 44 | constructor(url: string) { |
| 45 | this.url = url |
| 46 | mockEventSourceInstances.push(this) |
| 47 | } |
| 48 | } |
| 49 | } |
| 50 | |
| 51 | function createConnectingWebSocketClass() { |
| 52 | // Starts in CONNECTING state; tests flip readyState and fire onopen manually. |