test: tighten websocket session error assertions · openclaw/openclaw@8a710a6
steipete
·
2026-05-09
·
via Recent Commits to openclaw:main
File tree
src/realtime-transcription
| Original file line number | Diff line number | Diff line change |
|---|
@@ -161,7 +161,10 @@ describe("createRealtimeTranscriptionWebSocketSession", () => {
|
161 | 161 | |
162 | 162 | await expect(session.connect()).rejects.toThrow("nope"); |
163 | 163 | expect(session.isConnected()).toBe(false); |
164 | | -expect(onError).toHaveBeenCalledWith(expect.any(Error)); |
| 164 | +expect(onError).toHaveBeenCalledTimes(1); |
| 165 | +const setupError = onError.mock.calls[0]?.[0]; |
| 166 | +expect(setupError).toBeInstanceOf(Error); |
| 167 | +expect(setupError).toMatchObject({ message: "nope" }); |
165 | 168 | }); |
166 | 169 | |
167 | 170 | it("reports pre-ready closes separately from connection timeouts", async () => { |
@@ -181,8 +184,10 @@ describe("createRealtimeTranscriptionWebSocketSession", () => {
|
181 | 184 | await expect(session.connect()).rejects.toThrow( |
182 | 185 | "test realtime transcription connection closed before ready", |
183 | 186 | ); |
184 | | -expect(onError).toHaveBeenCalledWith(expect.any(Error)); |
185 | | -expect(onError.mock.calls[0]?.[0]).toMatchObject({ |
| 187 | +expect(onError).toHaveBeenCalledTimes(1); |
| 188 | +const closeError = onError.mock.calls[0]?.[0]; |
| 189 | +expect(closeError).toBeInstanceOf(Error); |
| 190 | +expect(closeError).toMatchObject({ |
186 | 191 | message: "test realtime transcription connection closed before ready", |
187 | 192 | }); |
188 | 193 | }); |
|
此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。