test: strengthen no-throw assertions · openclaw/openclaw@bfa0ee3
steipete
·
2026-05-08
·
via Recent Commits to openclaw:main
| Original file line number | Diff line number | Diff line change |
|---|
@@ -88,7 +88,20 @@ describe("buildDiscordInboundJob", () => {
|
88 | 88 | }, |
89 | 89 | ownerId: "user-1", |
90 | 90 | }); |
91 | | -expect(() => JSON.stringify(job.payload)).not.toThrow(); |
| 91 | +expect(JSON.parse(JSON.stringify(job.payload))).toEqual( |
| 92 | +expect.objectContaining({ |
| 93 | +threadChannel: { |
| 94 | +id: "thread-1", |
| 95 | +name: "codex", |
| 96 | +parentId: "forum-1", |
| 97 | +parent: { |
| 98 | +id: "forum-1", |
| 99 | +name: "Forum", |
| 100 | +}, |
| 101 | +ownerId: "user-1", |
| 102 | +}, |
| 103 | +}), |
| 104 | +); |
92 | 105 | }); |
93 | 106 | |
94 | 107 | it("normalizes partial thread channels without reading throwing getters", async () => { |
@@ -115,7 +128,13 @@ describe("buildDiscordInboundJob", () => {
|
115 | 128 | parent: undefined, |
116 | 129 | ownerId: undefined, |
117 | 130 | }); |
118 | | -expect(() => JSON.stringify(job.payload)).not.toThrow(); |
| 131 | +expect(JSON.parse(JSON.stringify(job.payload))).toEqual( |
| 132 | +expect.objectContaining({ |
| 133 | +threadChannel: { |
| 134 | +id: "thread-1", |
| 135 | +}, |
| 136 | +}), |
| 137 | +); |
119 | 138 | }); |
120 | 139 | |
121 | 140 | it("re-materializes the process context with an overridden abort signal", async () => { |
|
| Original file line number | Diff line number | Diff line change |
|---|
@@ -196,7 +196,7 @@ describe("memory plugin e2e", () => {
|
196 | 196 | resolvePath: (filePath: string) => filePath, |
197 | 197 | }; |
198 | 198 | |
199 | | -expect(() => memoryPlugin.register(mockApi as any)).not.toThrow(); |
| 199 | +memoryPlugin.register(mockApi as any); |
200 | 200 | expect(registerService).toHaveBeenCalledWith({ |
201 | 201 | id: "memory-lancedb", |
202 | 202 | start: expect.any(Function), |
|
| Original file line number | Diff line number | Diff line change |
|---|
@@ -202,7 +202,7 @@ describe("createTelegramBot", () => {
|
202 | 202 | const errorHandler = catchMock.mock.calls[0]?.[0]; |
203 | 203 | |
204 | 204 | expect(errorHandler).toBeTypeOf("function"); |
205 | | -expect(() => errorHandler?.(new Error("handler boom"))).not.toThrow(); |
| 205 | +errorHandler?.(new Error("handler boom")); |
206 | 206 | expect(runtime.error).toHaveBeenCalledWith(expect.stringContaining("telegram bot error:")); |
207 | 207 | }); |
208 | 208 | |
|
此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。