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

推荐订阅源

博客园_首页
B
Blog RSS Feed
Microsoft Azure Blog
Microsoft Azure Blog
J
Java Code Geeks
Cyber Security Advisories - MS-ISAC
Cyber Security Advisories - MS-ISAC
Google DeepMind News
Google DeepMind News
F
Fortinet All Blogs
V
V2EX
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More
Engineering at Meta
Engineering at Meta
月光博客
月光博客
阮一峰的网络日志
阮一峰的网络日志
M
MIT News - Artificial intelligence
IT之家
IT之家
博客园 - 【当耐特】
U
Unit 42
云风的 BLOG
云风的 BLOG
L
LangChain Blog
小众软件
小众软件
Microsoft Security Blog
Microsoft Security Blog
B
Blog
H
Hackread – Cybersecurity News, Data Breaches, AI and More
宝玉的分享
宝玉的分享
N
Netflix TechBlog - Medium

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: tighten telegram target writeback assertions · open...
steipete · 2026-05-11 · via Recent Commits to openclaw:main

@@ -14,6 +14,20 @@ const loadCronStore: AsyncUnknownMock = vi.fn();

1414

const resolveCronStorePath: UnknownMock = vi.fn();

1515

const saveCronStore: AsyncUnknownMock = vi.fn();

161617+

type TelegramConfigWrite = {

18+

channels?: {

19+

telegram?: {

20+

defaultTo?: string;

21+

accounts?: Record<string, { defaultTo?: string }>;

22+

};

23+

};

24+

};

25+26+

type CronStoreWrite = {

27+

version: number;

28+

jobs: Array<{ id: string; delivery: { channel: string; to: string } }>;

29+

};

30+1731

vi.mock("openclaw/plugin-sdk/config-mutation", async () => {

1832

const actual = await vi.importActual<typeof import("openclaw/plugin-sdk/config-mutation")>(

1933

"openclaw/plugin-sdk/config-mutation",

@@ -44,6 +58,24 @@ export function installMaybePersistResolvedTelegramTargetTests(params?: {

4458

describe("maybePersistResolvedTelegramTarget", () => {

4559

let maybePersistResolvedTelegramTarget: typeof import("./target-writeback.js").maybePersistResolvedTelegramTarget;

466061+

function requireWriteConfigCall(index = 0): [TelegramConfigWrite, Record<string, unknown>] {

62+

const call = writeConfigFile.mock.calls[index] as

63+

| [TelegramConfigWrite, Record<string, unknown>]

64+

| undefined;

65+

if (!call) {

66+

throw new Error(`expected writeConfigFile call #${index + 1}`);

67+

}

68+

return call;

69+

}

70+71+

function requireSaveCronStoreCall(index = 0): [string, CronStoreWrite] {

72+

const call = saveCronStore.mock.calls[index] as [string, CronStoreWrite] | undefined;

73+

if (!call) {

74+

throw new Error(`expected saveCronStore call #${index + 1}`);

75+

}

76+

return call;

77+

}

78+4779

beforeAll(async () => {

4880

({ maybePersistResolvedTelegramTarget } = await import("./target-writeback.js"));

4981

});

@@ -138,31 +170,17 @@ export function installMaybePersistResolvedTelegramTargetTests(params?: {

138170

});

139171140172

expect(writeConfigFile).toHaveBeenCalledTimes(1);

141-

expect(writeConfigFile).toHaveBeenCalledWith(

142-

expect.objectContaining({

143-

channels: {

144-

telegram: {

145-

defaultTo: "-100123",

146-

accounts: {

147-

alerts: {

148-

defaultTo: "-100123",

149-

},

150-

},

151-

},

152-

},

153-

}),

154-

expect.objectContaining({ expectedConfigPath: "/tmp/openclaw.json" }),

155-

);

173+

const [writtenConfig, writeOptions] = requireWriteConfigCall();

174+

expect(writtenConfig.channels?.telegram?.defaultTo).toBe("-100123");

175+

expect(writtenConfig.channels?.telegram?.accounts?.alerts?.defaultTo).toBe("-100123");

176+

expect(writeOptions.expectedConfigPath).toBe("/tmp/openclaw.json");

156177

expect(saveCronStore).toHaveBeenCalledTimes(1);

157-

expect(saveCronStore).toHaveBeenCalledWith(

158-

"/tmp/cron/jobs.json",

159-

expect.objectContaining({

160-

jobs: [

161-

{ id: "a", delivery: { channel: "telegram", to: "-100123" } },

162-

{ id: "b", delivery: { channel: "slack", to: "C123" } },

163-

],

164-

}),

165-

);

178+

const [cronPath, cronStore] = requireSaveCronStoreCall();

179+

expect(cronPath).toBe("/tmp/cron/jobs.json");

180+

expect(cronStore.jobs).toEqual([

181+

{ id: "a", delivery: { channel: "telegram", to: "-100123" } },

182+

{ id: "b", delivery: { channel: "slack", to: "C123" } },

183+

]);

166184

});

167185168186

it("preserves topic suffix style in writeback target", async () => {

@@ -186,16 +204,10 @@ export function installMaybePersistResolvedTelegramTargetTests(params?: {

186204

resolvedChatId: "-100123",

187205

});

188206189-

expect(writeConfigFile).toHaveBeenCalledWith(

190-

expect.objectContaining({

191-

channels: {

192-

telegram: {

193-

defaultTo: "-100123:topic:9",

194-

},

195-

},

196-

}),

197-

expect.any(Object),

198-

);

207+

expect(writeConfigFile).toHaveBeenCalledTimes(1);

208+

const [writtenConfig, writeOptions] = requireWriteConfigCall();

209+

expect(writtenConfig.channels?.telegram?.defaultTo).toBe("-100123:topic:9");

210+

expect(writeOptions).toEqual({});

199211

});

200212201213

it("matches username targets case-insensitively", async () => {

@@ -222,22 +234,16 @@ export function installMaybePersistResolvedTelegramTargetTests(params?: {

222234

resolvedChatId: "-100123",

223235

});

224236225-

expect(writeConfigFile).toHaveBeenCalledWith(

226-

expect.objectContaining({

227-

channels: {

228-

telegram: {

229-

defaultTo: "-100123",

230-

},

231-

},

232-

}),

233-

expect.any(Object),

234-

);

235-

expect(saveCronStore).toHaveBeenCalledWith(

236-

"/tmp/cron/jobs.json",

237-

expect.objectContaining({

238-

jobs: [{ id: "a", delivery: { channel: "telegram", to: "-100123" } }],

239-

}),

240-

);

237+

expect(writeConfigFile).toHaveBeenCalledTimes(1);

238+

const [writtenConfig, writeOptions] = requireWriteConfigCall();

239+

expect(writtenConfig.channels?.telegram?.defaultTo).toBe("-100123");

240+

expect(writeOptions).toEqual({});

241+

expect(saveCronStore).toHaveBeenCalledTimes(1);

242+

const [cronPath, cronStore] = requireSaveCronStoreCall();

243+

expect(cronPath).toBe("/tmp/cron/jobs.json");

244+

expect(cronStore.jobs).toEqual([

245+

{ id: "a", delivery: { channel: "telegram", to: "-100123" } },

246+

]);

241247

});

242248

});

243249

}