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

推荐订阅源

量子位
Recent Announcements
Recent Announcements
D
Docker
V
V2EX
阮一峰的网络日志
阮一峰的网络日志
Vercel News
Vercel News
Microsoft Security Blog
Microsoft Security Blog
The GitHub Blog
The GitHub Blog
U
Unit 42
奇客Solidot–传递最新科技情报
奇客Solidot–传递最新科技情报
月光博客
月光博客
腾讯CDC
B
Blog
博客园_首页
罗磊的独立博客
D
DataBreaches.Net
IT之家
IT之家
酷 壳 – CoolShell
酷 壳 – CoolShell
L
LangChain Blog
aimingoo的专栏
aimingoo的专栏
MongoDB | Blog
MongoDB | Blog
GbyAI
GbyAI
Stack Overflow Blog
Stack Overflow Blog
M
MIT News - Artificial intelligence

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: clear clawhub skills broad matchers · openclaw/open...
steipete · 2026-05-10 · via Recent Commits to openclaw:main

@@ -36,6 +36,41 @@ vi.mock("../infra/fs-safe.js", () => ({

3636

const { installSkillFromClawHub, searchSkillsFromClawHub, updateSkillsFromClawHub } =

3737

await import("./skills-clawhub.js");

383839+

function expectInstallPackageSourceDir(sourceDir: string) {

40+

const call = installPackageDirMock.mock.calls[0];

41+

if (!call) {

42+

throw new Error("expected installPackageDir call");

43+

}

44+

expect(call[0]?.sourceDir).toBe(sourceDir);

45+

}

46+47+

function expectInstalledSkill(

48+

result: Awaited<ReturnType<typeof installSkillFromClawHub>>,

49+

expected: { slug?: string; version?: string; targetDir?: string } = {},

50+

) {

51+

expect(result.ok).toBe(true);

52+

if (!result.ok) {

53+

throw new Error(`expected skill install success, got ${result.error}`);

54+

}

55+

if (expected.slug) {

56+

expect(result.slug).toBe(expected.slug);

57+

}

58+

if (expected.version) {

59+

expect(result.version).toBe(expected.version);

60+

}

61+

if (expected.targetDir) {

62+

expect(result.targetDir).toBe(expected.targetDir);

63+

}

64+

}

65+66+

function expectInvalidSlug(result: Awaited<ReturnType<typeof installSkillFromClawHub>>) {

67+

expect(result.ok).toBe(false);

68+

if (result.ok) {

69+

throw new Error("expected invalid slug failure");

70+

}

71+

expect(result.error).toContain("Invalid skill slug");

72+

}

73+3974

describe("skills-clawhub", () => {

4075

beforeEach(() => {

4176

fetchClawHubSkillDetailMock.mockReset();

@@ -90,13 +125,8 @@ describe("skills-clawhub", () => {

90125

version: "1.0.0",

91126

baseUrl: undefined,

92127

});

93-

expect(installPackageDirMock).toHaveBeenCalledWith(

94-

expect.objectContaining({

95-

sourceDir: "/tmp/extracted-skill",

96-

}),

97-

);

98-

expect(result).toMatchObject({

99-

ok: true,

128+

expectInstallPackageSourceDir("/tmp/extracted-skill");

129+

expectInstalledSkill(result, {

100130

slug: "agentreceipt",

101131

version: "1.0.0",

102132

targetDir: "/tmp/workspace/skills/agentreceipt",

@@ -114,12 +144,8 @@ describe("skills-clawhub", () => {

114144

slug: "agentreceipt",

115145

});

116146117-

expect(result).toMatchObject({ ok: true });

118-

expect(installPackageDirMock).toHaveBeenCalledWith(

119-

expect.objectContaining({

120-

sourceDir: "/tmp/extracted-skill",

121-

}),

122-

);

147+

expectInstalledSkill(result);

148+

expectInstallPackageSourceDir("/tmp/extracted-skill");

123149

},

124150

);

125151

@@ -165,15 +191,13 @@ describe("skills-clawhub", () => {

165191

}

166192167193

function expectLegacyUpdateSuccess(results: unknown, workspaceDir: string, slug: string) {

168-

expect(results).toMatchObject([

169-

{

170-

ok: true,

171-

slug,

172-

previousVersion: "0.9.0",

173-

version: "1.0.0",

174-

targetDir: path.join(workspaceDir, "skills", slug),

175-

},

176-

]);

194+

expect(Array.isArray(results)).toBe(true);

195+

const first = (results as Array<Record<string, unknown>>)[0];

196+

expect(first?.ok).toBe(true);

197+

expect(first?.slug).toBe(slug);

198+

expect(first?.previousVersion).toBe("0.9.0");

199+

expect(first?.version).toBe("1.0.0");

200+

expect(first?.targetDir).toBe(path.join(workspaceDir, "skills", slug));

177201

}

178202179203

it("updates all tracked legacy Unicode slugs in place", async () => {

@@ -246,54 +270,39 @@ describe("skills-clawhub", () => {

246270

workspaceDir: "/tmp/workspace",

247271

slug: "re\u0430ct",

248272

});

249-

expect(result).toMatchObject({

250-

ok: false,

251-

error: expect.stringContaining("Invalid skill slug"),

252-

});

273+

expectInvalidSlug(result);

253274

});

254275255276

it("rejects Cyrillic homograph 'е' (U+0435) in slug", async () => {

256277

const result = await installSkillFromClawHub({

257278

workspaceDir: "/tmp/workspace",

258279

slug: "r\u0435act",

259280

});

260-

expect(result).toMatchObject({

261-

ok: false,

262-

error: expect.stringContaining("Invalid skill slug"),

263-

});

281+

expectInvalidSlug(result);

264282

});

265283266284

it("rejects Cyrillic homograph 'о' (U+043E) in slug", async () => {

267285

const result = await installSkillFromClawHub({

268286

workspaceDir: "/tmp/workspace",

269287

slug: "t\u043Edo",

270288

});

271-

expect(result).toMatchObject({

272-

ok: false,

273-

error: expect.stringContaining("Invalid skill slug"),

274-

});

289+

expectInvalidSlug(result);

275290

});

276291277292

it("rejects slug with mixed Unicode and ASCII", async () => {

278293

const result = await installSkillFromClawHub({

279294

workspaceDir: "/tmp/workspace",

280295

slug: "cаlеndаr",

281296

});

282-

expect(result).toMatchObject({

283-

ok: false,

284-

error: expect.stringContaining("Invalid skill slug"),

285-

});

297+

expectInvalidSlug(result);

286298

});

287299288300

it("rejects slug with non-Latin scripts", async () => {

289301

const result = await installSkillFromClawHub({

290302

workspaceDir: "/tmp/workspace",

291303

slug: "技能",

292304

});

293-

expect(result).toMatchObject({

294-

ok: false,

295-

error: expect.stringContaining("Invalid skill slug"),

296-

});

305+

expectInvalidSlug(result);

297306

});

298307299308

it("rejects Unicode that case-folds to ASCII (Kelvin sign U+212A)", async () => {

@@ -302,48 +311,39 @@ describe("skills-clawhub", () => {

302311

workspaceDir: "/tmp/workspace",

303312

slug: "\u212Aalendar",

304313

});

305-

expect(result).toMatchObject({

306-

ok: false,

307-

error: expect.stringContaining("Invalid skill slug"),

308-

});

314+

expectInvalidSlug(result);

309315

});

310316311317

it("rejects slug starting with a hyphen", async () => {

312318

const result = await installSkillFromClawHub({

313319

workspaceDir: "/tmp/workspace",

314320

slug: "-calendar",

315321

});

316-

expect(result).toMatchObject({

317-

ok: false,

318-

error: expect.stringContaining("Invalid skill slug"),

319-

});

322+

expectInvalidSlug(result);

320323

});

321324322325

it("rejects slug ending with a hyphen", async () => {

323326

const result = await installSkillFromClawHub({

324327

workspaceDir: "/tmp/workspace",

325328

slug: "calendar-",

326329

});

327-

expect(result).toMatchObject({

328-

ok: false,

329-

error: expect.stringContaining("Invalid skill slug"),

330-

});

330+

expectInvalidSlug(result);

331331

});

332332333333

it("accepts uppercase ASCII slugs (preserves original casing behavior)", async () => {

334334

const result = await installSkillFromClawHub({

335335

workspaceDir: "/tmp/workspace",

336336

slug: "React",

337337

});

338-

expect(result).toMatchObject({ ok: true });

338+

expectInstalledSkill(result);

339339

});

340340341341

it("accepts valid lowercase ASCII slugs", async () => {

342342

const result = await installSkillFromClawHub({

343343

workspaceDir: "/tmp/workspace",

344344

slug: "calendar-2",

345345

});

346-

expect(result).toMatchObject({ ok: true });

346+

expectInstalledSkill(result);

347347

});

348348

});

349349