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

推荐订阅源

M
MIT News - Artificial intelligence
雷峰网
雷峰网
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻
Last Week in AI
Last Week in AI
奇客Solidot–传递最新科技情报
奇客Solidot–传递最新科技情报
阮一峰的网络日志
阮一峰的网络日志
月光博客
月光博客
博客园 - Franky
腾讯CDC
T
Tailwind CSS Blog
Recent Announcements
Recent Announcements
V
V2EX
N
Netflix TechBlog - Medium
量子位
Jina AI
Jina AI
Y
Y Combinator Blog
The GitHub Blog
The GitHub Blog
G
Google Developers Blog
爱范儿
爱范儿
博客园 - 叶小钗
D
Docker
MongoDB | Blog
MongoDB | Blog
D
DataBreaches.Net
T
The Blog of Author Tim Ferriss

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
chore(deadcode): remove stale msteams mention helpers · o...
vincentkoc · 2026-06-20 · via Recent Commits to openclaw:main
11

// Msteams tests cover mentions plugin behavior.

22

import { describe, expect, it } from "vitest";

3-

import { buildMentionEntities, formatMentionText, parseMentions } from "./mentions.js";

3+

import { parseMentions } from "./mentions.js";

4455

function requireFirstEntity(result: ReturnType<typeof parseMentions>) {

66

const entity = result.entities[0];

@@ -15,29 +15,12 @@ function requireOnlyEntity(result: ReturnType<typeof parseMentions>) {

1515

return requireFirstEntity(result);

1616

}

171718-

const mentionFreeTextCases = [

19-

{

20-

name: "parseMentions",

21-

assert: () => {

22-

const result = parseMentions("Hello world!");

23-24-

expect(result.text).toBe("Hello world!");

25-

expect(result.entities).toHaveLength(0);

26-

},

27-

},

28-

{

29-

name: "formatMentionText",

30-

assert: () => {

31-

const mentions = [{ id: "28:xxx", name: "John" }];

32-33-

expect(formatMentionText("Hello world", mentions)).toBe("Hello world");

34-

},

35-

},

36-

];

37-3818

describe("mention-free text contract", () => {

39-

it.each(mentionFreeTextCases)("$name handles text without mentions", ({ assert }) => {

40-

assert();

19+

it("parseMentions handles text without mentions", () => {

20+

const result = parseMentions("Hello world!");

21+22+

expect(result.text).toBe("Hello world!");

23+

expect(result.entities).toHaveLength(0);

4124

});

4225

});

4326

@@ -175,81 +158,3 @@ describe("parseMentions", () => {

175158

expect(result.text).toBe("See @[docs](https://example.com) for details");

176159

});

177160

});

178-179-

describe("buildMentionEntities", () => {

180-

it("builds entities from mention info", () => {

181-

const mentions = [

182-

{ id: "28:aaa", name: "Alice" },

183-

{ id: "28:bbb", name: "Bob" },

184-

];

185-186-

const entities = buildMentionEntities(mentions);

187-188-

expect(entities).toHaveLength(2);

189-

expect(entities[0]).toEqual({

190-

type: "mention",

191-

text: "<at>Alice</at>",

192-

mentioned: {

193-

id: "28:aaa",

194-

name: "Alice",

195-

},

196-

});

197-

expect(entities[1]).toEqual({

198-

type: "mention",

199-

text: "<at>Bob</at>",

200-

mentioned: {

201-

id: "28:bbb",

202-

name: "Bob",

203-

},

204-

});

205-

});

206-207-

it("handles empty list", () => {

208-

const entities = buildMentionEntities([]);

209-

expect(entities).toHaveLength(0);

210-

});

211-

});

212-213-

describe("formatMentionText", () => {

214-

it("formats text with single mention", () => {

215-

const text = "Hello @John!";

216-

const mentions = [{ id: "28:xxx", name: "John" }];

217-218-

const result = formatMentionText(text, mentions);

219-220-

expect(result).toBe("Hello <at>John</at>!");

221-

});

222-223-

it("formats text with multiple mentions", () => {

224-

const text = "Hey @Alice and @Bob";

225-

const mentions = [

226-

{ id: "28:aaa", name: "Alice" },

227-

{ id: "28:bbb", name: "Bob" },

228-

];

229-230-

const result = formatMentionText(text, mentions);

231-232-

expect(result).toBe("Hey <at>Alice</at> and <at>Bob</at>");

233-

});

234-235-

it("handles case-insensitive matching", () => {

236-

const text = "Hey @alice and @ALICE";

237-

const mentions = [{ id: "28:aaa", name: "Alice" }];

238-239-

const result = formatMentionText(text, mentions);

240-241-

expect(result).toBe("Hey <at>Alice</at> and <at>Alice</at>");

242-

});

243-244-

it("escapes regex metacharacters in names", () => {

245-

const text = "Hey @John(Test) and @Alice.Smith";

246-

const mentions = [

247-

{ id: "28:xxx", name: "John(Test)" },

248-

{ id: "28:yyy", name: "Alice.Smith" },

249-

];

250-251-

const result = formatMentionText(text, mentions);

252-253-

expect(result).toBe("Hey <at>John(Test)</at> and <at>Alice.Smith</at>");

254-

});

255-

});