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

推荐订阅源

月光博客
月光博客
人人都是产品经理
人人都是产品经理
博客园 - 聂微东
WordPress大学
WordPress大学
S
SegmentFault 最新的问题
博客园 - Franky
V
V2EX
Y
Y Combinator Blog
Google DeepMind News
Google DeepMind News
J
Java Code Geeks
T
The Blog of Author Tim Ferriss
罗磊的独立博客
钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知
Jina AI
Jina AI
博客园 - 叶小钗
F
Fortinet All Blogs
让小产品的独立变现更简单 - ezindie.com
让小产品的独立变现更简单 - ezindie.com
A
About on SuperTechFans
M
MIT News - Artificial intelligence
云风的 BLOG
云风的 BLOG
Last Week in AI
Last Week in AI
D
Docker
博客园 - 【当耐特】
阮一峰的网络日志
阮一峰的网络日志

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: guard slack lazy mock calls · openclaw/openclaw@b77...
steipete · 2026-05-12 · via Recent Commits to openclaw:main

@@ -71,6 +71,26 @@ function makeMinimalSlackConfig(

7171

return { channels: { slack } } as OpenClawConfig;

7272

}

737374+

type MockWithCalls = {

75+

mock: { calls: unknown[][] };

76+

};

77+78+

function mockCallAt(mock: MockWithCalls, index: number): unknown[] {

79+

const call = mock.mock.calls[index];

80+

if (!call) {

81+

throw new Error(`expected mock call ${index}`);

82+

}

83+

return call;

84+

}

85+86+

function mockRecordArgAt(mock: MockWithCalls, callIndex: number, argIndex: number) {

87+

const value = mockCallAt(mock, callIndex)[argIndex];

88+

if (!value || typeof value !== "object" || Array.isArray(value)) {

89+

throw new Error(`expected mock call ${callIndex} argument ${argIndex} to be an object`);

90+

}

91+

return value as Record<string, unknown>;

92+

}

93+7494

// --- Status: buildChannelSummary -------------------------------------------------

75957696

describe("slackPlugin.status.buildChannelSummary lazy SDK forwarding", () => {

@@ -100,8 +120,10 @@ describe("slackPlugin.status.buildChannelSummary lazy SDK forwarding", () => {

100120

} as never);

101121102122

expect(buildPassiveProbedChannelStatusSummaryMock).toHaveBeenCalledTimes(1);

103-

const [forwardedSnapshot, forwardedExtras] =

104-

buildPassiveProbedChannelStatusSummaryMock.mock.calls[0] ?? [];

123+

const [forwardedSnapshot, forwardedExtras] = mockCallAt(

124+

buildPassiveProbedChannelStatusSummaryMock,

125+

0,

126+

);

105127

// Snapshot must be forwarded by reference / structurally intact.

106128

expect(forwardedSnapshot).toBe(snapshot);

107129

// The channel must forward the (possibly fallback'd) token sources.

@@ -125,7 +147,7 @@ describe("slackPlugin.status.buildChannelSummary lazy SDK forwarding", () => {

125147

runtime: undefined,

126148

} as never);

127149128-

const [, forwardedExtras] = buildPassiveProbedChannelStatusSummaryMock.mock.calls[0] ?? [];

150+

const [, forwardedExtras] = mockCallAt(buildPassiveProbedChannelStatusSummaryMock, 0);

129151

expect(forwardedExtras).toEqual({ botTokenSource: "none", appTokenSource: "none" });

130152

});

131153

});

@@ -166,8 +188,8 @@ describe("slackPlugin.status.buildCapabilitiesDiagnostics lazy scopes loader", (

166188

const result = await buildDiagnostics({ account, timeoutMs: 5000, cfg } as never);

167189168190

expect(fetchSlackScopesMock).toHaveBeenCalledTimes(2);

169-

expect(fetchSlackScopesMock.mock.calls[0]).toEqual(["xoxb-bot", 5000]);

170-

expect(fetchSlackScopesMock.mock.calls[1]).toEqual(["xoxp-user", 5000]);

191+

expect(mockCallAt(fetchSlackScopesMock, 0)).toEqual(["xoxb-bot", 5000]);

192+

expect(mockCallAt(fetchSlackScopesMock, 1)).toEqual(["xoxp-user", 5000]);

171193

expect(result?.details).toEqual({

172194

botScopes: { ok: true, scopes: ["chat:write"] },

173195

userScopes: { ok: true, scopes: ["users:read"] },

@@ -215,7 +237,7 @@ describe("slackPlugin.security.collectAuditFindings lazy module forwarding", ()

215237

const result = await collectAuditFindings({ cfg, accountId: "default", account } as never);

216238217239

expect(collectAuditFindingsMock).toHaveBeenCalledTimes(1);

218-

expect(collectAuditFindingsMock.mock.calls[0]?.[0]).toEqual({

240+

expect(mockCallAt(collectAuditFindingsMock, 0)[0]).toEqual({

219241

cfg,

220242

accountId: "default",

221243

account,

@@ -260,18 +282,20 @@ describe("slackPlugin.resolver.resolveTargets lazy SDK forwarding", () => {

260282

} as never);

261283262284

expect(resolveTargetsWithOptionalTokenMock).toHaveBeenCalledTimes(1);

263-

const [params] = resolveTargetsWithOptionalTokenMock.mock.calls[0] ?? [];

285+

const params = mockRecordArgAt(resolveTargetsWithOptionalTokenMock, 0, 0);

264286

expect(params.token).toBe("xoxb-bot");

265287

expect(params.inputs).toEqual(["U123"]);

266288

expect(params.missingTokenNote).toBe("missing Slack token");

267-

if (typeof params.resolveWithToken !== "function") {

289+

const resolveWithToken = params.resolveWithToken;

290+

if (typeof resolveWithToken !== "function") {

268291

throw new Error("expected Slack target resolver callback");

269292

}

270-

if (typeof params.mapResolved !== "function") {

293+

const mapResolved = params.mapResolved;

294+

if (typeof mapResolved !== "function") {

271295

throw new Error("expected Slack target mapper callback");

272296

}

273297

expect(

274-

params.mapResolved({

298+

mapResolved({

275299

input: "U123",

276300

resolved: true,

277301

id: "U123",

@@ -303,7 +327,7 @@ describe("slackPlugin.resolver.resolveTargets lazy SDK forwarding", () => {

303327

kind: "user",

304328

} as never);

305329306-

const [params] = resolveTargetsWithOptionalTokenMock.mock.calls[0] ?? [];

330+

const params = mockRecordArgAt(resolveTargetsWithOptionalTokenMock, 0, 0);

307331

expect(params.token).toBe("xoxp-user");

308332

});

309333

@@ -323,7 +347,7 @@ describe("slackPlugin.resolver.resolveTargets lazy SDK forwarding", () => {

323347

} as never);

324348325349

expect(resolveTargetsWithOptionalTokenMock).toHaveBeenCalledTimes(1);

326-

const [params] = resolveTargetsWithOptionalTokenMock.mock.calls[0] ?? [];

350+

const params = mockRecordArgAt(resolveTargetsWithOptionalTokenMock, 0, 0);

327351

expect(params.token).toBe("xoxb-bot");

328352

expect(params.inputs).toEqual(["C1"]);

329353

});