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

推荐订阅源

B
Blog RSS Feed
Jina AI
Jina AI
雷峰网
雷峰网
Blog — PlanetScale
Blog — PlanetScale
Hugging Face - Blog
Hugging Face - Blog
奇客Solidot–传递最新科技情报
奇客Solidot–传递最新科技情报
Last Week in AI
Last Week in AI
博客园 - 司徒正美
罗磊的独立博客
J
Java Code Geeks
Engineering at Meta
Engineering at Meta
WordPress大学
WordPress大学
Vercel News
Vercel News
A
About on SuperTechFans
I
InfoQ
D
DataBreaches.Net
爱范儿
爱范儿
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More
U
Unit 42
aimingoo的专栏
aimingoo的专栏
宝玉的分享
宝玉的分享
P
Proofpoint News Feed
Microsoft Azure Blog
Microsoft Azure Blog
美团技术团队

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 google chat action assertions · openclaw/op...
shakkernerd · 2026-05-11 · via Recent Commits to openclaw:main

@@ -51,6 +51,28 @@ describe("googlechat message actions", () => {

5151

vi.resetModules();

5252

});

535354+

function buildAccount(overrides: Record<string, unknown> = {}) {

55+

return {

56+

accountId: "default",

57+

enabled: true,

58+

credentialSource: "service-account",

59+

config: {},

60+

...overrides,

61+

};

62+

}

63+64+

function expectJsonResult(result: unknown, details: Record<string, unknown>) {

65+

expect(result).toEqual({

66+

content: [

67+

{

68+

type: "text",

69+

text: JSON.stringify(details, null, 2),

70+

},

71+

],

72+

details,

73+

});

74+

}

75+5476

it("describes send and reaction actions only when enabled accounts exist", () => {

5577

listEnabledGoogleChatAccounts.mockReturnValueOnce([]);

5678

expect(googlechatMessageActions.describeMessageTool?.({ cfg: {} as never })).toBeNull();

@@ -90,19 +112,20 @@ describe("googlechat message actions", () => {

90112

});

9111392114

it("sends messages with uploaded media through the resolved space", async () => {

93-

resolveGoogleChatAccount.mockReturnValue({

94-

credentialSource: "service-account",

115+

const account = buildAccount({

95116

config: { mediaMaxMb: 5 },

96117

});

118+

resolveGoogleChatAccount.mockReturnValue(account);

97119

resolveGoogleChatOutboundSpace.mockResolvedValue("spaces/AAA");

120+

const fetchRemoteMedia = vi.fn(async () => ({

121+

buffer: Buffer.from("remote-bytes"),

122+

fileName: "remote.png",

123+

contentType: "image/png",

124+

}));

98125

getGoogleChatRuntime.mockReturnValue({

99126

channel: {

100127

media: {

101-

fetchRemoteMedia: vi.fn(async () => ({

102-

buffer: Buffer.from("remote-bytes"),

103-

fileName: "remote.png",

104-

contentType: "image/png",

105-

})),

128+

fetchRemoteMedia,

106129

},

107130

},

108131

});

@@ -128,37 +151,36 @@ describe("googlechat message actions", () => {

128151

accountId: "default",

129152

} as never);

130153131-

expect(resolveGoogleChatOutboundSpace).toHaveBeenCalledWith(

132-

expect.objectContaining({

133-

target: "spaces/AAA",

134-

}),

135-

);

136-

expect(uploadGoogleChatAttachment).toHaveBeenCalledWith(

137-

expect.objectContaining({

138-

space: "spaces/AAA",

139-

filename: "remote.png",

140-

}),

141-

);

142-

expect(sendGoogleChatMessage).toHaveBeenCalledWith(

143-

expect.objectContaining({

144-

space: "spaces/AAA",

145-

text: "caption",

146-

thread: "thread-1",

147-

}),

148-

);

149-

expect(result).toMatchObject({

150-

details: {

151-

ok: true,

152-

to: "spaces/AAA",

153-

},

154+

expect(resolveGoogleChatOutboundSpace).toHaveBeenCalledWith({

155+

account,

156+

target: "spaces/AAA",

157+

});

158+

expect(fetchRemoteMedia).toHaveBeenCalledWith({

159+

url: "https://example.com/file.png",

160+

maxBytes: 5 * 1024 * 1024,

154161

});

162+

expect(uploadGoogleChatAttachment).toHaveBeenCalledWith({

163+

account,

164+

space: "spaces/AAA",

165+

filename: "remote.png",

166+

buffer: Buffer.from("remote-bytes"),

167+

contentType: "image/png",

168+

});

169+

expect(sendGoogleChatMessage).toHaveBeenCalledWith({

170+

account,

171+

space: "spaces/AAA",

172+

text: "caption",

173+

thread: "thread-1",

174+

attachments: [{ attachmentUploadToken: "token-1", contentName: "remote.png" }],

175+

});

176+

expectJsonResult(result, { ok: true, to: "spaces/AAA" });

155177

});

156178157179

it("routes upload-file through the same attachment upload path with filename override", async () => {

158-

resolveGoogleChatAccount.mockReturnValue({

159-

credentialSource: "service-account",

180+

const account = buildAccount({

160181

config: { mediaMaxMb: 5 },

161182

});

183+

resolveGoogleChatAccount.mockReturnValue(account);

162184

resolveGoogleChatOutboundSpace.mockResolvedValue("spaces/BBB");

163185

const localRoot = "/tmp/googlechat-action-test";

164186

const localPath = path.join(localRoot, "local.md");

@@ -195,33 +217,28 @@ describe("googlechat message actions", () => {

195217

} as never);

196218197219

expect(readFile).toHaveBeenCalledWith(localPath);

198-

expect(uploadGoogleChatAttachment).toHaveBeenCalledWith(

199-

expect.objectContaining({

200-

space: "spaces/BBB",

201-

filename: "renamed.txt",

202-

buffer: Buffer.from("local-bytes"),

203-

}),

204-

);

205-

expect(sendGoogleChatMessage).toHaveBeenCalledWith(

206-

expect.objectContaining({

207-

space: "spaces/BBB",

208-

text: "notes",

209-

attachments: [{ attachmentUploadToken: "token-2", contentName: "renamed.txt" }],

210-

}),

211-

);

212-

expect(result).toMatchObject({

213-

details: {

214-

ok: true,

215-

to: "spaces/BBB",

216-

},

220+

expect(uploadGoogleChatAttachment).toHaveBeenCalledWith({

221+

account,

222+

space: "spaces/BBB",

223+

filename: "renamed.txt",

224+

buffer: Buffer.from("local-bytes"),

225+

contentType: "text/markdown",

217226

});

227+

expect(sendGoogleChatMessage).toHaveBeenCalledWith({

228+

account,

229+

space: "spaces/BBB",

230+

text: "notes",

231+

thread: undefined,

232+

attachments: [{ attachmentUploadToken: "token-2", contentName: "renamed.txt" }],

233+

});

234+

expectJsonResult(result, { ok: true, to: "spaces/BBB" });

218235

});

219236220237

it("removes only matching app reactions on react remove", async () => {

221-

resolveGoogleChatAccount.mockReturnValue({

222-

credentialSource: "service-account",

238+

const account = buildAccount({

223239

config: { botUser: "users/app-bot" },

224240

});

241+

resolveGoogleChatAccount.mockReturnValue(account);

225242

listGoogleChatReactions.mockResolvedValue([

226243

{

227244

name: "reactions/1",

@@ -254,20 +271,19 @@ describe("googlechat message actions", () => {

254271

accountId: "default",

255272

} as never);

256273274+

expect(listGoogleChatReactions).toHaveBeenCalledWith({

275+

account,

276+

messageName: "spaces/AAA/messages/msg-1",

277+

});

257278

expect(deleteGoogleChatReaction).toHaveBeenCalledTimes(2);

258279

expect(deleteGoogleChatReaction).toHaveBeenNthCalledWith(1, {

259-

account: expect.anything(),

280+

account,

260281

reactionName: "reactions/1",

261282

});

262283

expect(deleteGoogleChatReaction).toHaveBeenNthCalledWith(2, {

263-

account: expect.anything(),

284+

account,

264285

reactionName: "reactions/2",

265286

});

266-

expect(result).toMatchObject({

267-

details: {

268-

ok: true,

269-

removed: 2,

270-

},

271-

});

287+

expectJsonResult(result, { ok: true, removed: 2 });

272288

});

273289

});