惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

T
Threatpost
The Hacker News
The Hacker News
AWS News Blog
AWS News Blog
Spread Privacy
Spread Privacy
T
Tenable Blog
C
CERT Recently Published Vulnerability Notes
Cisco Talos Blog
Cisco Talos Blog
Threat Intelligence Blog | Flashpoint
Threat Intelligence Blog | Flashpoint
S
Securelist
P
Privacy & Cybersecurity Law Blog
Know Your Adversary
Know Your Adversary
T
The Exploit Database - CXSecurity.com
Latest news
Latest news
D
Darknet – Hacking Tools, Hacker News & Cyber Security
I
Intezer
F
Fortinet All Blogs
Engineering at Meta
Engineering at Meta
Simon Willison's Weblog
Simon Willison's Weblog
The Register - Security
The Register - Security
CTFtime.org: upcoming CTF events
CTFtime.org: upcoming CTF events
L
Lohrmann on Cybersecurity
C
Cyber Attacks, Cyber Crime and Cyber Security
Microsoft Azure Blog
Microsoft Azure Blog
P
Proofpoint News Feed
H
Help Net Security
T
Threat Research - Cisco Blogs
D
DataBreaches.Net
S
Schneier on Security
Cyberwarzone
Cyberwarzone
Google DeepMind News
Google DeepMind News
P
Privacy International News Feed
S
Secure Thoughts
Cyber Security Advisories - MS-ISAC
Cyber Security Advisories - MS-ISAC
Recorded Future
Recorded Future
C
Cybersecurity and Infrastructure Security Agency CISA
MyScale Blog
MyScale Blog
M
MIT News - Artificial intelligence
Stack Overflow Blog
Stack Overflow Blog
IT之家
IT之家
人人都是产品经理
人人都是产品经理
NISL@THU
NISL@THU
博客园 - Franky
T
Tor Project blog
G
GRAHAM CLULEY
博客园 - 【当耐特】
Jina AI
Jina AI
Security Archives - TechRepublic
Security Archives - TechRepublic
K
KPMG report finds enterprise disconnect between AI and its ROI | CIO
A
About on SuperTechFans
Hacker News - Newest:
Hacker News - Newest: "LLM"

Recent Commits to openclaw:main

test: merge chat side-result checks · openclaw/openclaw@ddd2c2a test: merge cron history checks · openclaw/openclaw@f7eb746 test: merge responsive navigation shell checks · openclaw/openclaw@c2e4b47 docs(changelog): add codex oauth fixes · openclaw/openclaw@628e6cd test: merge navigation routing cases · openclaw/openclaw@5d8cecb Tests: mock channel registry bundled fallback · openclaw/openclaw@2b08233 Secrets: avoid broad web search discovery for single plugin config · openclaw/openclaw@a464f59 test: merge config view browser checks · openclaw/openclaw@20cf511 fix(status): align oauth health with runtime · openclaw/openclaw@eed7116 feat: add macOS screen snapshots for monitor preview (#67954) thanks … · openclaw/openclaw@f377db1 fix: report shared auth scopes in hello-ok (#67810) thanks @BunsDev · openclaw/openclaw@0b6c39b Auto-reply: avoid eager bundled route fallback · openclaw/openclaw@3ea1bf4 Tests: narrow session binding contract setup · openclaw/openclaw@54e4e16 fix(macOS): enable undo/redo in webchat composer text input (#34962) · openclaw/openclaw@00951dc Tests: speed up channel setup promotion · openclaw/openclaw@82b529a Docs: refresh agent instructions · openclaw/openclaw@5775fe2 fix(auth): serialize OAuth refresh across agents to fix #26322 (#67876) · openclaw/openclaw@8e79080 test: allow ollama public surface boundary test · openclaw/openclaw@7d4f1a6 Docs: add test performance guardrails · openclaw/openclaw@89706d3 Tests: restore context-engine usage proof · openclaw/openclaw@e4c4f95 Tests: slim context engine runtime coverage · openclaw/openclaw@74c198f ci: retry failed custom checkouts · openclaw/openclaw@0ee5baf test: trim duplicate provider auth onboarding cases · openclaw/openclaw@1ffc02e matrix: fix sessions_spawn --thread subagent session spawning (#67643) · openclaw/openclaw@1ce2596 test: reduce auth choice fixture churn · openclaw/openclaw@857b9cd test: mock health status config boundaries · openclaw/openclaw@9d5ab4a test: mock onboard config io boundary · openclaw/openclaw@299694d test: mock legacy state plugin boundaries · openclaw/openclaw@2713089 test: mock channel install boundaries · openclaw/openclaw@b945248 test: mock doctor preview channel boundaries · openclaw/openclaw@b1a3ad4 test: trim doctor command hotspots · openclaw/openclaw@c66f16a test: isolate agent auth and spawn hotspots · openclaw/openclaw@9285935 test: stabilize MCP startup disposal race · openclaw/openclaw@dd9d2eb test: merge browser contract server suites · openclaw/openclaw@5817a76 test: narrow ollama provider discovery setup · openclaw/openclaw@a0d9598 build: declare qa-lab aimock runtime dependency · openclaw/openclaw@24431e5 test: speed up safe-bins exec harness · openclaw/openclaw@ee856ab test: preserve tool helpers in embedded runner mocks · openclaw/openclaw@acd86a0 refactor: move memory embeddings into provider plugins · openclaw/openclaw@77e6e4c test: reuse system-run temp fixtures · openclaw/openclaw@7e9ff0f test: trim hotspot wait overhead · openclaw/openclaw@12a59b0 Check: avoid duplicate boundary prep · openclaw/openclaw@baf11b8 test: reduce hotspot fixture overhead · openclaw/openclaw@3a59edd feat(ui): overhaul settings and slash command UX (#67819) thanks @Bun… · openclaw/openclaw@2cfb660 QA Matrix: exit cleanly on failure · openclaw/openclaw@42805d2 QA Matrix: isolate scenario coverage · openclaw/openclaw@7e659e1 Matrix: refresh crypto bootstrap state · openclaw/openclaw@94081d8 QA Lab: add provider registry · openclaw/openclaw@bb7e982 Matrix: add plugin changelog · openclaw/openclaw@4acab55 test: trim more hotspot overhead · openclaw/openclaw@f485311 test: trim remaining hotspot tests · openclaw/openclaw@6ba8626 test: narrow hotspot mocks · openclaw/openclaw@dbc8179 test: isolate gemini embedding request helpers · openclaw/openclaw@cd330f5 test: trim memory and mcp hotspots · openclaw/openclaw@fd48dfa test: slim provider registry mocks · openclaw/openclaw@2e08c77 test: harden Parallels update smoke · openclaw/openclaw@1a98090 feat: default Anthropic to Opus 4.7 · openclaw/openclaw@628b454 fix: harden node-host shell payload mutability checks · openclaw/openclaw@75c551e fix: land node-host approval binding for native binaries (#66731) (th… · openclaw/openclaw@29919bb CI: add daily schedule to CodeQL workflow (#67645) · openclaw/openclaw@69d25f5 fix(gateway): capture config hash after plugin auto-enable to prevent… · openclaw/openclaw@8c11210 fix: repair sanitized replay tool results before send (#67620) (thank… · openclaw/openclaw@c3c7a99 fix: restrict HTML timeout short-circuit to transient statuses · openclaw/openclaw@de129a6 fix: keep TUI watchdog bound to active run (#67401) (thanks @xantorres) · openclaw/openclaw@3525273 Gateway/skills: dedupe skills prefix-match + drop dead fallback on log · openclaw/openclaw@d7f489f Extensions/lmstudio: back off inference preload after consecutive fai… · openclaw/openclaw@b555214 TUI/streaming: add watchdog that resets the activity indicator after … · openclaw/openclaw@f44ab20 Agents/tool-loop: enable unknown-tool stream guard by default · openclaw/openclaw@36ed367 Gateway/skills: invalidate session skills snapshot on config write · openclaw/openclaw@b23d59a fix: classify HTML provider error pages correctly (#67642) (thanks @s… · openclaw/openclaw@e588e90 fix(skills): remove unused model-usage import (#67641) · openclaw/openclaw@55f05df docs(changelog): credit codex fix superseded PRs · openclaw/openclaw@e485f24 fix(openai-codex): normalize stale transport metadata in resolution a… · openclaw/openclaw@90801ba CI: pin Docker-related GitHub Actions (#67632) · openclaw/openclaw@f697b01 Android: modernize WebView and discovery API usage (#67627) · openclaw/openclaw@44a6e50 fix(deps): bump hono to 4.12.14 and @hono/node-server to 1.19.14 (GHS… · openclaw/openclaw@fbccc18 fix(deps): bump dompurify to 3.4.0 (#67614) · openclaw/openclaw@2c2dc00 CI: add explicit permissions to all workflow jobs (fixes code-scannin… · openclaw/openclaw@01b7516 fix: register bundled TTS providers and route overrides correctly (#6… · openclaw/openclaw@6ea3cdd fix: align host tilde paths with OS home (#62804) (thanks @stainlu) · openclaw/openclaw@ecfaf64 fix: flush creds queue before reconnect socket open (#67464) (thanks … · openclaw/openclaw@405c63f fix: strip standalone <function> tool call tags from visible text (#6… · openclaw/openclaw@78df859 fix(agents): preserve cli session metadata before transcript persist … · openclaw/openclaw@898fd04 docs(changelog): move cli transcript entry · openclaw/openclaw@c1817c6 fix(agents): normalize cli transcript api field · openclaw/openclaw@3a3fae0 docs(changelog): note cli transcript persistence · openclaw/openclaw@6c343f1 fix(agents): persist cli transcript turns · openclaw/openclaw@b8ef507 fix(msteams): harden security-sensitive flows (#65841) · openclaw/openclaw@c56b56e [Dashboard] Fix exec approval modal overflow for long command content… · openclaw/openclaw@053c5b0 Docs: remove QA changelog entry · openclaw/openclaw@7fd5771 QA: fix private runtime source loading (#67428) · openclaw/openclaw@d5933af docs(gateway): correct protocol.md schema path, hello-ok example, aut… · openclaw/openclaw@489404d CI: pin Node 22 runners to 22.18.0 · openclaw/openclaw@4ffa621 models.authStatus: normalize provider ids + tighten env-backed escape… · openclaw/openclaw@f2fdb9d Update CHANGELOG.md · openclaw/openclaw@7694a92 test(parallels): clean up npm update guard jobs · openclaw/openclaw@045ea7b Plugins: prefer scanDir override paths · openclaw/openclaw@b2974da fix(dreaming): default storage.mode to "separate" so phase blocks sto… · openclaw/openclaw@8c392f0 fix(memory-core): skip dreaming transcript ingestion via session stor… · openclaw/openclaw@a1b01f0 fix: dedupe replayed exec.finished node events (#67281) · openclaw/openclaw@5dcf526
test: tighten feishu outbound card assertions · openclaw/openclaw@76b64d7
steipete · 2026-05-10 · via Recent Commits to openclaw:main

@@ -166,6 +166,32 @@ function resetOutboundMocks() {

166166

cleanupAmbientCommentTypingReactionMock.mockResolvedValue(false);

167167

}

168168169+

function sendMessageCall(index = 0): Record<string, any> | undefined {

170+

const calls = sendMessageFeishuMock.mock.calls as unknown as Array<[Record<string, any>]>;

171+

return calls[index]?.[0];

172+

}

173+174+

function sendMediaCall(index = 0): Record<string, any> | undefined {

175+

const calls = sendMediaFeishuMock.mock.calls as unknown as Array<[Record<string, any>]>;

176+

return calls[index]?.[0];

177+

}

178+179+

function sendCardCall(index = 0): Record<string, any> | undefined {

180+

const calls = sendCardFeishuMock.mock.calls as unknown as Array<[Record<string, any>]>;

181+

return calls[index]?.[0];

182+

}

183+184+

function sendStructuredCardCall(index = 0): Record<string, any> | undefined {

185+

const calls = sendStructuredCardFeishuMock.mock.calls as unknown as Array<[Record<string, any>]>;

186+

return calls[index]?.[0];

187+

}

188+189+

function expectFeishuResult(result: unknown, messageId: string) {

190+

const typedResult = result as { channel?: string; messageId?: string } | undefined;

191+

expect(typedResult?.channel).toBe("feishu");

192+

expect(typedResult?.messageId).toBe(messageId);

193+

}

194+169195

describe("feishuOutbound.sendText local-image auto-convert", () => {

170196

beforeEach(() => {

171197

resetOutboundMocks();

@@ -194,52 +220,43 @@ describe("feishuOutbound.sendText local-image auto-convert", () => {

194220

const adapterSendText = requireFeishuTextSender(adapter);

195221

const adapterSendMedia = requireFeishuMediaSender(adapter);

196222197-

await expect(

198-

verifyChannelMessageAdapterCapabilityProofs({

199-

adapterName: "feishu",

200-

adapter,

201-

proofs: {

202-

text: async () => {

203-

const result = await adapterSendText({

204-

cfg: emptyConfig,

205-

to: "chat:chat-1",

206-

text: "hello",

207-

accountId: "default",

208-

});

209-

expect(sendMessageFeishuMock).toHaveBeenCalledWith(

210-

expect.objectContaining({

211-

to: "chat:chat-1",

212-

text: "hello",

213-

accountId: "default",

214-

}),

215-

);

216-

expect(result.receipt.platformMessageIds).toEqual(["feishu-text-1"]);

217-

},

218-

media: async () => {

219-

const result = await adapterSendMedia({

220-

cfg: emptyConfig,

221-

to: "chat:chat-1",

222-

text: "",

223-

mediaUrl: "https://example.com/image.png",

224-

accountId: "default",

225-

});

226-

expect(sendMediaFeishuMock).toHaveBeenCalledWith(

227-

expect.objectContaining({

228-

to: "chat:chat-1",

229-

mediaUrl: "https://example.com/image.png",

230-

accountId: "default",

231-

}),

232-

);

233-

expect(result.receipt.platformMessageIds).toEqual(["feishu-media-1"]);

234-

},

223+

const proofs = await verifyChannelMessageAdapterCapabilityProofs({

224+

adapterName: "feishu",

225+

adapter,

226+

proofs: {

227+

text: async () => {

228+

const result = await adapterSendText({

229+

cfg: emptyConfig,

230+

to: "chat:chat-1",

231+

text: "hello",

232+

accountId: "default",

233+

});

234+

expect(sendMessageCall()?.to).toBe("chat:chat-1");

235+

expect(sendMessageCall()?.text).toBe("hello");

236+

expect(sendMessageCall()?.accountId).toBe("default");

237+

expect(result.receipt.platformMessageIds).toEqual(["feishu-text-1"]);

235238

},

236-

}),

237-

).resolves.toEqual(

238-

expect.arrayContaining([

239-

{ capability: "text", status: "verified" },

240-

{ capability: "media", status: "verified" },

241-

]),

239+

media: async () => {

240+

const result = await adapterSendMedia({

241+

cfg: emptyConfig,

242+

to: "chat:chat-1",

243+

text: "",

244+

mediaUrl: "https://example.com/image.png",

245+

accountId: "default",

246+

});

247+

expect(sendMediaCall()?.to).toBe("chat:chat-1");

248+

expect(sendMediaCall()?.mediaUrl).toBe("https://example.com/image.png");

249+

expect(sendMediaCall()?.accountId).toBe("default");

250+

expect(result.receipt.platformMessageIds).toEqual(["feishu-media-1"]);

251+

},

252+

},

253+

});

254+

expect(proofs.some((proof) => proof.capability === "text" && proof.status === "verified")).toBe(

255+

true,

242256

);

257+

expect(

258+

proofs.some((proof) => proof.capability === "media" && proof.status === "verified"),

259+

).toBe(true);

243260

});

244261245262

it("chunks outbound text without requiring Feishu runtime initialization", () => {

@@ -269,18 +286,12 @@ describe("feishuOutbound.sendText local-image auto-convert", () => {

269286

mediaLocalRoots: [dir],

270287

});

271288272-

expect(sendMediaFeishuMock).toHaveBeenCalledWith(

273-

expect.objectContaining({

274-

to: "chat_1",

275-

mediaUrl: file,

276-

accountId: "main",

277-

mediaLocalRoots: [dir],

278-

}),

279-

);

289+

expect(sendMediaCall()?.to).toBe("chat_1");

290+

expect(sendMediaCall()?.mediaUrl).toBe(file);

291+

expect(sendMediaCall()?.accountId).toBe("main");

292+

expect(sendMediaCall()?.mediaLocalRoots).toEqual([dir]);

280293

expect(sendMessageFeishuMock).not.toHaveBeenCalled();

281-

expect(result).toEqual(

282-

expect.objectContaining({ channel: "feishu", messageId: "media_msg" }),

283-

);

294+

expectFeishuResult(result, "media_msg");

284295

} finally {

285296

await fs.rm(dir, { recursive: true, force: true });

286297

}

@@ -295,13 +306,9 @@ describe("feishuOutbound.sendText local-image auto-convert", () => {

295306

});

296307297308

expect(sendMediaFeishuMock).not.toHaveBeenCalled();

298-

expect(sendMessageFeishuMock).toHaveBeenCalledWith(

299-

expect.objectContaining({

300-

to: "chat_1",

301-

text: "please upload /tmp/example.png",

302-

accountId: "main",

303-

}),

304-

);

309+

expect(sendMessageCall()?.to).toBe("chat_1");

310+

expect(sendMessageCall()?.text).toBe("please upload /tmp/example.png");

311+

expect(sendMessageCall()?.accountId).toBe("main");

305312

});

306313307314

it("falls back to plain text if local-image media send fails", async () => {

@@ -316,13 +323,9 @@ describe("feishuOutbound.sendText local-image auto-convert", () => {

316323

});

317324318325

expect(sendMediaFeishuMock).toHaveBeenCalledTimes(1);

319-

expect(sendMessageFeishuMock).toHaveBeenCalledWith(

320-

expect.objectContaining({

321-

to: "chat_1",

322-

text: file,

323-

accountId: "main",

324-

}),

325-

);

326+

expect(sendMessageCall()?.to).toBe("chat_1");

327+

expect(sendMessageCall()?.text).toBe(file);

328+

expect(sendMessageCall()?.accountId).toBe("main");

326329

} finally {

327330

await fs.rm(dir, { recursive: true, force: true });

328331

}

@@ -336,15 +339,11 @@ describe("feishuOutbound.sendText local-image auto-convert", () => {

336339

accountId: "main",

337340

});

338341339-

expect(sendStructuredCardFeishuMock).toHaveBeenCalledWith(

340-

expect.objectContaining({

341-

to: "chat_1",

342-

text: "| a | b |\n| - | - |",

343-

accountId: "main",

344-

}),

345-

);

342+

expect(sendStructuredCardCall()?.to).toBe("chat_1");

343+

expect(sendStructuredCardCall()?.text).toBe("| a | b |\n| - | - |");

344+

expect(sendStructuredCardCall()?.accountId).toBe("main");

346345

expect(sendMessageFeishuMock).not.toHaveBeenCalled();

347-

expect(result).toEqual(expect.objectContaining({ channel: "feishu", messageId: "card_msg" }));

346+

expectFeishuResult(result, "card_msg");

348347

});

349348350349

it("forwards replyToId as replyToMessageId on sendText", async () => {

@@ -356,14 +355,10 @@ describe("feishuOutbound.sendText local-image auto-convert", () => {

356355

accountId: "main",

357356

});

358357359-

expect(sendMessageFeishuMock).toHaveBeenCalledWith(

360-

expect.objectContaining({

361-

to: "chat_1",

362-

text: "hello",

363-

replyToMessageId: "om_reply_1",

364-

accountId: "main",

365-

}),

366-

);

358+

expect(sendMessageCall()?.to).toBe("chat_1");

359+

expect(sendMessageCall()?.text).toBe("hello");

360+

expect(sendMessageCall()?.replyToMessageId).toBe("om_reply_1");

361+

expect(sendMessageCall()?.accountId).toBe("main");

367362

});

368363369364

it("falls back to threadId when replyToId is empty on sendText", async () => {

@@ -376,15 +371,11 @@ describe("feishuOutbound.sendText local-image auto-convert", () => {

376371

accountId: "main",

377372

});

378373379-

expect(sendMessageFeishuMock).toHaveBeenCalledWith(

380-

expect.objectContaining({

381-

to: "chat_1",

382-

text: "hello",

383-

replyToMessageId: "om_thread_2",

384-

replyInThread: true,

385-

accountId: "main",

386-

}),

387-

);

374+

expect(sendMessageCall()?.to).toBe("chat_1");

375+

expect(sendMessageCall()?.text).toBe("hello");

376+

expect(sendMessageCall()?.replyToMessageId).toBe("om_thread_2");

377+

expect(sendMessageCall()?.replyInThread).toBe(true);

378+

expect(sendMessageCall()?.accountId).toBe("main");

388379

});

389380

});

390381

@@ -427,32 +418,26 @@ describe("feishuOutbound.sendPayload native cards", () => {

427418

},

428419

});

429420430-

expect(rendered).toEqual(

431-

expect.objectContaining({

432-

text: "Approval\n\nApprove the request?\n\n- Approve",

433-

channelData: {

434-

feishu: {

435-

card: expect.objectContaining({

436-

schema: "2.0",

437-

header: {

438-

title: { tag: "plain_text", content: "Approval" },

439-

template: "green",

440-

},

441-

body: {

442-

elements: expect.arrayContaining([

443-

{ tag: "markdown", content: "Approve the request?" },

444-

expect.objectContaining({ tag: "action" }),

445-

]),

446-

},

447-

}),

448-

},

449-

},

450-

}),

451-

);

452-453421

if (!rendered) {

454422

throw new Error("expected Feishu presentation renderer to return a payload");

455423

}

424+

expect(rendered.text).toBe("Approval\n\nApprove the request?\n\n- Approve");

425+

const renderedChannelData = rendered.channelData as

426+

| { feishu?: { card?: Record<string, any> } }

427+

| undefined;

428+

const renderedCard = renderedChannelData?.feishu?.card;

429+

expect(renderedCard?.schema).toBe("2.0");

430+

expect(renderedCard?.header).toEqual({

431+

title: { tag: "plain_text", content: "Approval" },

432+

template: "green",

433+

});

434+

expect(renderedCard?.body?.elements?.[0]).toEqual({

435+

tag: "markdown",

436+

content: "Approve the request?",

437+

});

438+

expect(

439+

renderedCard?.body?.elements?.some((element: { tag?: string }) => element.tag === "action"),

440+

).toBe(true);

456441

const { presentation: _presentation, ...coreRenderedPayload } = rendered;

457442

const result = await feishuOutbound.sendPayload?.({

458443

cfg: emptyConfig,

@@ -462,21 +447,13 @@ describe("feishuOutbound.sendPayload native cards", () => {

462447

payload: coreRenderedPayload,

463448

});

464449465-

expect(sendCardFeishuMock).toHaveBeenCalledWith(

466-

expect.objectContaining({

467-

to: "chat_1",

468-

card: expect.objectContaining({

469-

header: {

470-

title: { tag: "plain_text", content: "Approval" },

471-

template: "green",

472-

},

473-

}),

474-

}),

475-

);

450+

expect(sendCardCall()?.to).toBe("chat_1");

451+

expect(sendCardCall()?.card?.header).toEqual({

452+

title: { tag: "plain_text", content: "Approval" },

453+

template: "green",

454+

});

476455

expect(sendMessageFeishuMock).not.toHaveBeenCalled();

477-

expect(result).toEqual(

478-

expect.objectContaining({ channel: "feishu", messageId: "native_card_msg" }),

479-

);

456+

expectFeishuResult(result, "native_card_msg");

480457

});

481458482459

it("sends interactive button payloads as native Feishu cards", async () => {

@@ -502,52 +479,31 @@ describe("feishuOutbound.sendPayload native cards", () => {

502479

},

503480

});

504481505-

expect(sendCardFeishuMock).toHaveBeenCalledWith(

506-

expect.objectContaining({

507-

cfg: emptyConfig,

508-

to: "chat_1",

509-

accountId: "main",

510-

}),

511-

);

482+

expect(sendCardCall()?.cfg).toBe(emptyConfig);

483+

expect(sendCardCall()?.to).toBe("chat_1");

484+

expect(sendCardCall()?.accountId).toBe("main");

512485

const card = sendCardFeishuMock.mock.calls[0][0].card;

513-

expect(card).toEqual(

514-

expect.objectContaining({

515-

schema: "2.0",

516-

body: {

517-

elements: expect.arrayContaining([

518-

{ tag: "markdown", content: "Choose an action" },

519-

{ tag: "markdown", content: "Approve the request?" },

520-

expect.objectContaining({

521-

tag: "action",

522-

actions: [

523-

expect.objectContaining({

524-

text: { tag: "plain_text", content: "Approve" },

525-

type: "primary",

526-

value: expect.objectContaining({

527-

oc: "ocf1",

528-

k: "quick",

529-

q: "/approve req_1 allow-once",

530-

}),

531-

}),

532-

expect.objectContaining({

533-

text: { tag: "plain_text", content: "Deny" },

534-

type: "danger",

535-

value: expect.objectContaining({

536-

oc: "ocf1",

537-

k: "quick",

538-

q: "/approve req_1 deny",

539-

}),

540-

}),

541-

],

542-

}),

543-

]),

544-

},

545-

}),

486+

expect(card.schema).toBe("2.0");

487+

expect(card.body.elements[0]).toEqual({ tag: "markdown", content: "Choose an action" });

488+

expect(card.body.elements[1]).toEqual({

489+

tag: "markdown",

490+

content: "Approve the request?",

491+

});

492+

const actionElement = card.body.elements.find(

493+

(element: { tag?: string }) => element.tag === "action",

546494

);

495+

expect(actionElement?.actions[0]?.text).toEqual({ tag: "plain_text", content: "Approve" });

496+

expect(actionElement?.actions[0]?.type).toBe("primary");

497+

expect(actionElement?.actions[0]?.value?.oc).toBe("ocf1");

498+

expect(actionElement?.actions[0]?.value?.k).toBe("quick");

499+

expect(actionElement?.actions[0]?.value?.q).toBe("/approve req_1 allow-once");

500+

expect(actionElement?.actions[1]?.text).toEqual({ tag: "plain_text", content: "Deny" });

501+

expect(actionElement?.actions[1]?.type).toBe("danger");

502+

expect(actionElement?.actions[1]?.value?.oc).toBe("ocf1");

503+

expect(actionElement?.actions[1]?.value?.k).toBe("quick");

504+

expect(actionElement?.actions[1]?.value?.q).toBe("/approve req_1 deny");

547505

expect(sendMessageFeishuMock).not.toHaveBeenCalled();

548-

expect(result).toEqual(

549-

expect.objectContaining({ channel: "feishu", messageId: "native_card_msg" }),

550-

);

506+

expectFeishuResult(result, "native_card_msg");

551507

});

552508553509

it("escapes generated markdown card text and drops unsafe button URLs", async () => {