




























@@ -168,14 +168,18 @@ describe("getMessageFeishu", () => {
168168messageId: "om_1",
169169});
170170171-expect(result).toEqual(
172-expect.objectContaining({
173-messageId: "om_1",
174-chatId: "oc_1",
175-contentType: "interactive",
176-content: "hello markdown\nhello div",
177-}),
178-);
171+expect(result).toEqual({
172+messageId: "om_1",
173+chatId: "oc_1",
174+chatType: undefined,
175+senderId: undefined,
176+senderOpenId: undefined,
177+senderType: undefined,
178+content: "hello markdown\nhello div",
179+contentType: "interactive",
180+createTime: undefined,
181+threadId: undefined,
182+});
179183});
180184181185it("falls through empty interactive card element arrays and locale variants", async () => {
@@ -217,14 +221,18 @@ describe("getMessageFeishu", () => {
217221messageId: "om_i18n_card",
218222});
219223220-expect(result).toEqual(
221-expect.objectContaining({
222-messageId: "om_i18n_card",
223-chatId: "oc_i18n_card",
224-contentType: "interactive",
225-content: "hello 2 tasks {{metadata}}",
226-}),
227-);
224+expect(result).toEqual({
225+messageId: "om_i18n_card",
226+chatId: "oc_i18n_card",
227+chatType: undefined,
228+senderId: undefined,
229+senderOpenId: undefined,
230+senderType: undefined,
231+content: "hello 2 tasks {{metadata}}",
232+contentType: "interactive",
233+createTime: undefined,
234+threadId: undefined,
235+});
228236});
229237230238it("falls back to post-format content when interactive card elements are empty", async () => {
@@ -257,14 +265,18 @@ describe("getMessageFeishu", () => {
257265messageId: "om_post_card",
258266});
259267260-expect(result).toEqual(
261-expect.objectContaining({
262-messageId: "om_post_card",
263-chatId: "oc_post_card",
264-contentType: "interactive",
265-content: "Card summary\n\n**fallback** body",
266-}),
267-);
268+expect(result).toEqual({
269+messageId: "om_post_card",
270+chatId: "oc_post_card",
271+chatType: undefined,
272+senderId: undefined,
273+senderOpenId: undefined,
274+senderType: undefined,
275+content: "Card summary\n\n**fallback** body",
276+contentType: "interactive",
277+createTime: undefined,
278+threadId: undefined,
279+});
268280});
269281270282it("extracts text content from post messages", async () => {
@@ -294,14 +306,18 @@ describe("getMessageFeishu", () => {
294306messageId: "om_post",
295307});
296308297-expect(result).toEqual(
298-expect.objectContaining({
299-messageId: "om_post",
300-chatId: "oc_post",
301-contentType: "post",
302-content: "Summary\n\npost body",
303-}),
304-);
309+expect(result).toEqual({
310+messageId: "om_post",
311+chatId: "oc_post",
312+chatType: undefined,
313+senderId: undefined,
314+senderOpenId: undefined,
315+senderType: undefined,
316+content: "Summary\n\npost body",
317+contentType: "post",
318+createTime: undefined,
319+threadId: undefined,
320+});
305321});
306322307323it("returns text placeholder instead of raw JSON for unsupported message types", async () => {
@@ -326,14 +342,18 @@ describe("getMessageFeishu", () => {
326342messageId: "om_file",
327343});
328344329-expect(result).toEqual(
330-expect.objectContaining({
331-messageId: "om_file",
332-chatId: "oc_file",
333-contentType: "file",
334-content: "[file message]",
335-}),
336-);
345+expect(result).toEqual({
346+messageId: "om_file",
347+chatId: "oc_file",
348+chatType: undefined,
349+senderId: undefined,
350+senderOpenId: undefined,
351+senderType: undefined,
352+content: "[file message]",
353+contentType: "file",
354+createTime: undefined,
355+threadId: undefined,
356+});
337357});
338358339359it("supports single-object response shape from Feishu API", async () => {
@@ -354,14 +374,18 @@ describe("getMessageFeishu", () => {
354374messageId: "om_single",
355375});
356376357-expect(result).toEqual(
358-expect.objectContaining({
359-messageId: "om_single",
360-chatId: "oc_single",
361-contentType: "text",
362-content: "single payload",
363-}),
364-);
377+expect(result).toEqual({
378+messageId: "om_single",
379+chatId: "oc_single",
380+chatType: undefined,
381+senderId: undefined,
382+senderOpenId: undefined,
383+senderType: undefined,
384+content: "single payload",
385+contentType: "text",
386+createTime: undefined,
387+threadId: undefined,
388+});
365389});
366390367391it("reuses the same content parsing for thread history messages", async () => {
@@ -415,16 +439,22 @@ describe("getMessageFeishu", () => {
415439});
416440417441expect(result).toEqual([
418-expect.objectContaining({
442+{
419443messageId: "om_file",
444+senderId: "ou_1",
445+senderType: "user",
420446contentType: "file",
421447content: "[file message]",
422-}),
423-expect.objectContaining({
448+createTime: 1710000001000,
449+},
450+{
424451messageId: "om_card",
452+senderId: "app_1",
453+senderType: "app",
425454contentType: "interactive",
426455content: "hello from card 2.0",
427-}),
456+createTime: 1710000000000,
457+},
428458]);
429459});
430460});
@@ -547,13 +577,14 @@ describe("buildStructuredCard", () => {
547577},
548578});
549579550-expect(card).toEqual(
551-expect.objectContaining({
552-header: {
553-title: { tag: "plain_text", content: "Agent" },
554-template: "blue",
555-},
556-}),
557-);
580+expect(card).toEqual({
581+schema: "2.0",
582+config: { width_mode: "fill" },
583+body: { elements: [{ tag: "markdown", content: "hello" }] },
584+header: {
585+title: { tag: "plain_text", content: "Agent" },
586+template: "blue",
587+},
588+});
558589});
559590});
此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。