test: remove weak no-throw wrappers · openclaw/openclaw@79c1f1b
steipete
·
2026-05-08
·
via Recent Commits to openclaw:main
| Original file line number | Diff line number | Diff line change |
|---|
@@ -98,10 +98,10 @@ describe("createDiscordGatewaySupervisor", () => {
|
98 | 98 | }); |
99 | 99 | |
100 | 100 | expect(supervisor.drainPending(() => "continue")).toBe("continue"); |
101 | | -expect(() => supervisor.attachLifecycle(() => {})).not.toThrow(); |
102 | | -expect(() => supervisor.detachLifecycle()).not.toThrow(); |
103 | | -expect(() => supervisor.dispose()).not.toThrow(); |
104 | | -expect(() => supervisor.dispose()).not.toThrow(); |
| 101 | +supervisor.attachLifecycle(() => {}); |
| 102 | +supervisor.detachLifecycle(); |
| 103 | +supervisor.dispose(); |
| 104 | +supervisor.dispose(); |
105 | 105 | }); |
106 | 106 | |
107 | 107 | it("keeps suppressing late gateway errors after dispose", () => { |
@@ -115,9 +115,7 @@ describe("createDiscordGatewaySupervisor", () => {
|
115 | 115 | |
116 | 116 | supervisor.dispose(); |
117 | 117 | |
118 | | -expect(() => |
119 | | -emitter.emit("error", new Error("Max reconnect attempts (0) reached after close code 1005")), |
120 | | -).not.toThrow(); |
| 118 | +emitter.emit("error", new Error("Max reconnect attempts (0) reached after close code 1005")); |
121 | 119 | expect(runtime.error).toHaveBeenCalledWith( |
122 | 120 | expect.stringContaining("suppressed late gateway reconnect-exhausted error after dispose"), |
123 | 121 | ); |
|
| Original file line number | Diff line number | Diff line change |
|---|
@@ -348,7 +348,7 @@ describe("processEvent (functional)", () => {
|
348 | 348 | from: "+15553333333", |
349 | 349 | }); |
350 | 350 | |
351 | | -expect(() => processEvent(ctx, event)).not.toThrow(); |
| 351 | +processEvent(ctx, event); |
352 | 352 | expect(ctx.activeCalls.size).toBe(0); |
353 | 353 | }); |
354 | 354 | |
|
| Original file line number | Diff line number | Diff line change |
|---|
@@ -111,7 +111,7 @@ describe("runFfprobe", () => {
|
111 | 111 | const promise = runFfprobe(["pipe:0"], { input: Buffer.alloc(1024) }); |
112 | 112 | |
113 | 113 | const stdinError = Object.assign(new Error("write EPIPE"), { code: "EPIPE" }); |
114 | | -expect(() => child.stdin?.emit("error", stdinError)).not.toThrow(); |
| 114 | +child.stdin?.emit("error", stdinError); |
115 | 115 | execCallback()(null, Buffer.from("ok"), Buffer.alloc(0)); |
116 | 116 | |
117 | 117 | await expect(promise).resolves.toBe("ok"); |
@@ -124,7 +124,7 @@ describe("runFfprobe", () => {
|
124 | 124 | const promise = runFfprobe(["pipe:0"], { input: Buffer.alloc(1024) }); |
125 | 125 | |
126 | 126 | const stdinError = Object.assign(new Error("write EPIPE"), { code: "EPIPE" }); |
127 | | -expect(() => child.stdin?.emit("error", stdinError)).not.toThrow(); |
| 127 | +child.stdin?.emit("error", stdinError); |
128 | 128 | const childError = new Error("ffprobe failed"); |
129 | 129 | execCallback()(childError, "", ""); |
130 | 130 | |
|
此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。