




























@@ -195,58 +195,54 @@ describe("nextcloud-talk send cfg threading", () => {
195195mockNextcloudMessageResponse(22346, 1_706_000_004);
196196mockNextcloudMessageResponse(22347, 1_706_000_005);
197197198-await expect(
199-verifyChannelMessageAdapterCapabilityProofs({
200-adapterName: "nextcloud-talk",
201-adapter: nextcloudTalkMessageAdapter,
202-proofs: {
203-text: async () => {
204-const result = await nextcloudTalkMessageAdapter.send?.text?.({
205-cfg: cfg as CoreConfig,
206-to: "room:abc123",
207-text: "hello",
208-accountId: "work",
209-});
210-expect(result?.receipt.platformMessageIds).toEqual(["22345"]);
211-},
212-media: async () => {
213-const result = await nextcloudTalkMessageAdapter.send?.media?.({
214-cfg: cfg as CoreConfig,
215-to: "room:abc123",
216-text: "image",
217-mediaUrl: "https://example.com/image.png",
218-accountId: "work",
219-});
220-expect(result?.receipt.platformMessageIds).toEqual(["22346"]);
221-expect(fetchMock).toHaveBeenNthCalledWith(
222-2,
223-"https://nextcloud.example.com/ocs/v2.php/apps/spreed/api/v1/bot/abc123/message",
224-expect.objectContaining({
225-body: JSON.stringify({
226-message: "image\n\nAttachment: https://example.com/image.png",
227-}),
228-}),
229-);
230-},
231-replyTo: async () => {
232-const result = await nextcloudTalkMessageAdapter.send?.text?.({
233-cfg: cfg as CoreConfig,
234-to: "room:abc123",
235-text: "threaded",
236-replyToId: "parent-1",
237-accountId: "work",
238-});
239-expect(result?.receipt.replyToId).toBe("parent-1");
240-},
198+const proofResults = await verifyChannelMessageAdapterCapabilityProofs({
199+adapterName: "nextcloud-talk",
200+adapter: nextcloudTalkMessageAdapter,
201+proofs: {
202+text: async () => {
203+const result = await nextcloudTalkMessageAdapter.send?.text?.({
204+cfg: cfg as CoreConfig,
205+to: "room:abc123",
206+text: "hello",
207+accountId: "work",
208+});
209+expect(result?.receipt.platformMessageIds).toEqual(["22345"]);
241210},
242-}),
243-).resolves.toEqual(
244-expect.arrayContaining([
245-{ capability: "text", status: "verified" },
246-{ capability: "media", status: "verified" },
247-{ capability: "replyTo", status: "verified" },
248-]),
249-);
211+media: async () => {
212+const result = await nextcloudTalkMessageAdapter.send?.media?.({
213+cfg: cfg as CoreConfig,
214+to: "room:abc123",
215+text: "image",
216+mediaUrl: "https://example.com/image.png",
217+accountId: "work",
218+});
219+expect(result?.receipt.platformMessageIds).toEqual(["22346"]);
220+const mediaSendCall = fetchMock.mock.calls[1];
221+expect(mediaSendCall?.[0]).toBe(
222+"https://nextcloud.example.com/ocs/v2.php/apps/spreed/api/v1/bot/abc123/message",
223+);
224+expect((mediaSendCall?.[1] as RequestInit | undefined)?.body).toBe(
225+JSON.stringify({
226+message: "image\n\nAttachment: https://example.com/image.png",
227+}),
228+);
229+},
230+replyTo: async () => {
231+const result = await nextcloudTalkMessageAdapter.send?.text?.({
232+cfg: cfg as CoreConfig,
233+to: "room:abc123",
234+text: "threaded",
235+replyToId: "parent-1",
236+accountId: "work",
237+});
238+expect(result?.receipt.replyToId).toBe("parent-1");
239+},
240+},
241+});
242+243+expect(proofResults.find((result) => result.capability === "text")?.status).toBe("verified");
244+expect(proofResults.find((result) => result.capability === "media")?.status).toBe("verified");
245+expect(proofResults.find((result) => result.capability === "replyTo")?.status).toBe("verified");
250246});
251247252248it("fails hard for sendReaction when cfg is omitted", async () => {
此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。