





















@@ -1,4 +1,4 @@
1-import { ChannelType } from "discord-api-types/v10";
1+import { ChannelType, MessageFlags } from "discord-api-types/v10";
22import { beforeAll, beforeEach, describe, expect, it, vi } from "vitest";
33import { makeDiscordRest } from "./send.test-harness.js";
44@@ -123,12 +123,12 @@ describe("sendDiscordComponentMessage", () => {
123123},
124124);
125125126-expect(patchMock).toHaveBeenCalledWith(
127- expect.stringContaining("/channels/chan-1/messages/msg1"),
128- expect.objectContaining({
129- body: expect.any(Object),
130- }),
131-);
126+expect(patchMock).toHaveBeenCalledTimes(1);
127+const [patchUrl, patchRequest] = patchMock.mock.calls[0] ?? [];
128+expect(patchUrl).toEqual(expect.stringContaining("/channels/chan-1/messages/msg1"));
129+expect(patchRequest?.body?.flags).toBe(MessageFlags.IsComponentsV2);
130+expect(Array.isArray(patchRequest?.body?.components)).toBe(true);
131+expect(patchRequest?.body?.components).toHaveLength(1);
132132expect(registerMock).toHaveBeenCalledTimes(1);
133133const args = registerMock.mock.calls[0]?.[0];
134134expect(args?.messageId).toBe("msg1");
此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。