























@@ -26,6 +26,16 @@ vi.mock("openclaw/plugin-sdk/channel-activity-runtime", async () => {
26262727let sendWebhookMessageDiscord: typeof import("./send.webhook.js").sendWebhookMessageDiscord;
282829+type MockWithCalls = { mock: { calls: unknown[][] } };
30+31+function firstMockCall(mock: MockWithCalls, label: string): unknown[] {
32+const call = mock.mock.calls.at(0);
33+if (!call) {
34+throw new Error(`expected ${label} call`);
35+}
36+return call;
37+}
38+2939describe("sendWebhookMessageDiscord activity", () => {
3040beforeAll(async () => {
3141({ sendWebhookMessageDiscord } = await import("./send.webhook.js"));
@@ -126,7 +136,7 @@ describe("sendWebhookMessageDiscord activity", () => {
126136127137const fetchMock = vi.mocked(fetch);
128138expect(fetchMock).toHaveBeenCalledTimes(1);
129-expect(fetchMock.mock.calls[0]).toEqual([
139+expect(firstMockCall(fetchMock, "fetch")).toEqual([
130140"https://discord.com/api/v10/webhooks/wh-1/tok-1?wait=true&thread_id=thread-1",
131141{
132142method: "POST",
此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。