test: tighten plugin tool payload assertions · openclaw/openclaw@1ff126c
steipete
·
2026-05-11
·
via Recent Commits to openclaw:main
File tree
extensions/matrix/src/matrix/monitor
| Original file line number | Diff line number | Diff line change |
|---|
@@ -12,6 +12,10 @@ function requireRecord(value: unknown, label: string): Record<string, unknown> {
|
12 | 12 | return value as Record<string, unknown>; |
13 | 13 | } |
14 | 14 | |
| 15 | +function readFirstMockArg(fn: unknown): unknown { |
| 16 | +return (fn as { mock: { calls: unknown[][] } }).mock.calls[0]?.[0]; |
| 17 | +} |
| 18 | + |
15 | 19 | describe("createMatrixRoomMessageHandler thread root media", () => { |
16 | 20 | it("keeps image-only thread roots visible via attachment markers", async () => { |
17 | 21 | installMatrixMonitorTestRuntime(); |
@@ -80,10 +84,7 @@ describe("createMatrixRoomMessageHandler thread root media", () => {
|
80 | 84 | expect(String(envelope.body)).toContain("replying"); |
81 | 85 | |
82 | 86 | expect(recordInboundSession).toHaveBeenCalledTimes(1); |
83 | | -const inbound = requireRecord( |
84 | | -recordInboundSession.mock.calls[0]?.[0], |
85 | | -"record inbound session", |
86 | | -); |
| 87 | +const inbound = requireRecord(readFirstMockArg(recordInboundSession), "record inbound session"); |
87 | 88 | const ctx = requireRecord(inbound.ctx, "inbound context"); |
88 | 89 | expect(String(ctx.ThreadStarterBody)).toContain("[matrix image attachment]"); |
89 | 90 | }); |
|
此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。