(actual: string, expected: WebSocketEvent | undefined, index: number, asJson: boolean)
| 51 | const jsonOrText = (value: string) => Option.match(decodeJson(value), { onNone: () => value, onSome: canonicalizeJson }) |
| 52 | |
| 53 | const assertClientEvent = (actual: string, expected: WebSocketEvent | undefined, index: number, asJson: boolean) => |
| 54 | Effect.sync(() => { |
| 55 | const matches = |
| 56 | expected?.direction === "client" && |
| 57 | expected.kind === "text" && |
| 58 | JSON.stringify(asJson ? jsonOrText(actual) : actual) === |
| 59 | JSON.stringify(asJson ? jsonOrText(expected.body) : expected.body) |
| 60 | if (matches) return |
| 61 | throw new Error(`WebSocket client frame ${index + 1}: expected ${safeText(expected)}, received ${safeText(actual)}`) |
| 62 | }) |
| 63 | |
| 64 | export const makeWebSocketExecutor = <E>( |
| 65 | options: WebSocketRecordReplayOptions<E>, |
no test coverage detected