






















@@ -54,19 +54,35 @@ describe("discordMessageActions", () => {
54545555expect(discovery?.capabilities).toEqual(["presentation"]);
5656expect(discovery?.schema).toBeUndefined();
57-expect(discovery?.actions).toEqual(
58-expect.arrayContaining([
59-"send",
60-"upload-file",
61-"poll",
62-"react",
63-"reactions",
64-"emoji-list",
65-"permissions",
66-]),
67-);
68-expect(discovery?.actions).not.toContain("channel-create");
69-expect(discovery?.actions).not.toContain("role-add");
57+expect(discovery?.actions).toEqual([
58+"send",
59+"poll",
60+"react",
61+"reactions",
62+"emoji-list",
63+"upload-file",
64+"read",
65+"edit",
66+"delete",
67+"pin",
68+"unpin",
69+"list-pins",
70+"permissions",
71+"thread-create",
72+"thread-list",
73+"thread-reply",
74+"search",
75+"sticker",
76+"member-info",
77+"role-info",
78+"emoji-upload",
79+"sticker-upload",
80+"channel-info",
81+"channel-list",
82+"voice-status",
83+"event-list",
84+"event-create",
85+]);
7086});
71877288it("describes actions when the Discord token is an unresolved SecretRef", () => {
@@ -85,9 +101,42 @@ describe("discordMessageActions", () => {
85101});
8610287103expect(discovery?.capabilities).toEqual(["presentation"]);
88-expect(discovery?.actions).toEqual(
89-expect.arrayContaining(["send", "poll", "react", "reactions", "emoji-list"]),
90-);
104+expect(discovery?.actions).toEqual([
105+"send",
106+"poll",
107+"react",
108+"reactions",
109+"emoji-list",
110+"upload-file",
111+"read",
112+"edit",
113+"delete",
114+"pin",
115+"unpin",
116+"list-pins",
117+"permissions",
118+"thread-create",
119+"thread-list",
120+"thread-reply",
121+"search",
122+"sticker",
123+"member-info",
124+"role-info",
125+"emoji-upload",
126+"sticker-upload",
127+"channel-info",
128+"channel-list",
129+"channel-create",
130+"channel-edit",
131+"channel-delete",
132+"channel-move",
133+"category-create",
134+"category-edit",
135+"category-delete",
136+"voice-status",
137+"event-list",
138+"event-create",
139+]);
91140});
9214193142it("describes scoped account actions when only the account token is an unresolved SecretRef", () => {
@@ -114,10 +163,41 @@ describe("discordMessageActions", () => {
114163accountId: "ops",
115164});
116165117-expect(discovery?.actions).toEqual(
118-expect.arrayContaining(["send", "react", "reactions", "emoji-list"]),
119-);
120-expect(discovery?.actions).not.toContain("poll");
166+expect(discovery?.actions).toEqual([
167+"send",
168+"react",
169+"reactions",
170+"emoji-list",
171+"upload-file",
172+"read",
173+"edit",
174+"delete",
175+"pin",
176+"unpin",
177+"list-pins",
178+"permissions",
179+"thread-create",
180+"thread-list",
181+"thread-reply",
182+"search",
183+"sticker",
184+"member-info",
185+"role-info",
186+"emoji-upload",
187+"sticker-upload",
188+"channel-info",
189+"channel-list",
190+"channel-create",
191+"channel-edit",
192+"channel-delete",
193+"channel-move",
194+"category-create",
195+"category-edit",
196+"category-delete",
197+"voice-status",
198+"event-list",
199+"event-create",
200+]);
121201});
122202123203it("honors account-scoped action gates during discovery", () => {
@@ -151,13 +231,74 @@ describe("discordMessageActions", () => {
151231accountId: "work",
152232});
153233154-expect(defaultDiscovery?.actions).toEqual(expect.arrayContaining(["send", "poll"]));
155-expect(defaultDiscovery?.actions).toContain("upload-file");
156-expect(defaultDiscovery?.actions).not.toContain("react");
157-expect(workDiscovery?.actions).toEqual(
158-expect.arrayContaining(["send", "upload-file", "react", "reactions", "emoji-list"]),
159-);
160-expect(workDiscovery?.actions).not.toContain("poll");
234+expect(defaultDiscovery?.actions).toEqual([
235+"send",
236+"poll",
237+"upload-file",
238+"read",
239+"edit",
240+"delete",
241+"pin",
242+"unpin",
243+"list-pins",
244+"permissions",
245+"thread-create",
246+"thread-list",
247+"thread-reply",
248+"search",
249+"sticker",
250+"member-info",
251+"role-info",
252+"emoji-upload",
253+"sticker-upload",
254+"channel-info",
255+"channel-list",
256+"channel-create",
257+"channel-edit",
258+"channel-delete",
259+"channel-move",
260+"category-create",
261+"category-edit",
262+"category-delete",
263+"voice-status",
264+"event-list",
265+"event-create",
266+]);
267+expect(workDiscovery?.actions).toEqual([
268+"send",
269+"react",
270+"reactions",
271+"emoji-list",
272+"upload-file",
273+"read",
274+"edit",
275+"delete",
276+"pin",
277+"unpin",
278+"list-pins",
279+"permissions",
280+"thread-create",
281+"thread-list",
282+"thread-reply",
283+"search",
284+"sticker",
285+"member-info",
286+"role-info",
287+"emoji-upload",
288+"sticker-upload",
289+"channel-info",
290+"channel-list",
291+"channel-create",
292+"channel-edit",
293+"channel-delete",
294+"channel-move",
295+"category-create",
296+"category-edit",
297+"category-delete",
298+"voice-status",
299+"event-list",
300+"event-create",
301+]);
161302});
162303163304it("hides upload-file when Discord message actions are disabled", () => {
@@ -253,12 +394,20 @@ describe("discordMessageActions", () => {
253394payload: { text: "hello", mediaUrl: "/tmp/photo.png" },
254395});
255396256-expect(prepared).toMatchObject({
397+expect(prepared).toEqual({
257398text: "hello",
258399mediaUrl: "/tmp/photo.png",
259400channelData: {
260401discord: {
261-components: expect.objectContaining({ text: "Choose" }),
402+components: {
403+text: "Choose",
404+blocks: [
405+{
406+type: "actions",
407+buttons: [{ label: "Yes", callbackData: "yes" }],
408+},
409+],
410+},
262411filename: "photo.png",
263412},
264413},
此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。