test: guard discord threading starter mock calls · openclaw/openclaw@14d248f
steipete
·
2026-05-12
·
via Recent Commits to openclaw:main
File tree
extensions/discord/src/monitor
| Original file line number | Diff line number | Diff line change |
|---|
@@ -76,6 +76,14 @@ function requireThreadStarter(
|
76 | 76 | return result; |
77 | 77 | } |
78 | 78 | |
| 79 | +function firstRestGetPath(get: ReturnType<typeof vi.fn>): unknown { |
| 80 | +const [call] = get.mock.calls; |
| 81 | +if (!call) { |
| 82 | +throw new Error("expected Discord REST GET call"); |
| 83 | +} |
| 84 | +return call[0]; |
| 85 | +} |
| 86 | + |
79 | 87 | async function resolveStarter(params: { |
80 | 88 | message: ThreadStarterRestMessage; |
81 | 89 | parentId?: string; |
@@ -258,7 +266,7 @@ describe("resolveDiscordThreadStarter", () => {
|
258 | 266 | |
259 | 267 | expect(requireThreadStarter(result).text).toBe("starter content"); |
260 | 268 | expect(get).toHaveBeenCalledTimes(1); |
261 | | -expect(get.mock.calls[0]?.[0]).toBe("/channels/thread-1/messages/thread-1"); |
| 269 | +expect(firstRestGetPath(get)).toBe("/channels/thread-1/messages/thread-1"); |
262 | 270 | }); |
263 | 271 | |
264 | 272 | it("returns null when content, embeds, and snapshots are all empty", async () => { |
|
此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。