fix: preserve config and hook contracts (#86911) · openclaw/openclaw@82dae95
steipete
·
2026-05-27
·
via Recent Commits to openclaw:main
| Original file line number | Diff line number | Diff line change |
|---|
@@ -270,6 +270,23 @@ describe("hooks", () => {
|
270 | 270 | } satisfies MessageSentHookContext), |
271 | 271 | expected: false, |
272 | 272 | }, |
| 273 | +{ |
| 274 | +name: "returns false when content is missing", |
| 275 | +event: createInternalHookEvent("message", "received", "test-session", { |
| 276 | +from: "+1234567890", |
| 277 | +channelId: "whatsapp", |
| 278 | +}), |
| 279 | +expected: false, |
| 280 | +}, |
| 281 | +{ |
| 282 | +name: "returns false when content is not a string", |
| 283 | +event: createInternalHookEvent("message", "received", "test-session", { |
| 284 | +from: "+1234567890", |
| 285 | +content: 123, |
| 286 | +channelId: "whatsapp", |
| 287 | +}), |
| 288 | +expected: false, |
| 289 | +}, |
273 | 290 | ] satisfies Array<{ |
274 | 291 | name: string; |
275 | 292 | event: ReturnType<typeof createInternalHookEvent>; |
@@ -313,6 +330,25 @@ describe("hooks", () => {
|
313 | 330 | } satisfies MessageReceivedHookContext), |
314 | 331 | expected: false, |
315 | 332 | }, |
| 333 | +{ |
| 334 | +name: "returns false when content is missing", |
| 335 | +event: createInternalHookEvent("message", "sent", "test-session", { |
| 336 | +to: "+1234567890", |
| 337 | +success: true, |
| 338 | +channelId: "telegram", |
| 339 | +}), |
| 340 | +expected: false, |
| 341 | +}, |
| 342 | +{ |
| 343 | +name: "returns false when content is not a string", |
| 344 | +event: createInternalHookEvent("message", "sent", "test-session", { |
| 345 | +to: "+1234567890", |
| 346 | +content: false, |
| 347 | +success: true, |
| 348 | +channelId: "telegram", |
| 349 | +}), |
| 350 | +expected: false, |
| 351 | +}, |
316 | 352 | ] satisfies Array<{ |
317 | 353 | name: string; |
318 | 354 | event: ReturnType<typeof createInternalHookEvent>; |
|
此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。