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

推荐订阅源

大猫的无限游戏
大猫的无限游戏
MyScale Blog
MyScale Blog
雷峰网
雷峰网
量子位
小众软件
小众软件
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻
博客园 - 叶小钗
T
Tailwind CSS Blog
月光博客
月光博客
博客园 - 【当耐特】
博客园_首页
罗磊的独立博客
博客园 - 三生石上(FineUI控件)
IT之家
IT之家
爱范儿
爱范儿
阮一峰的网络日志
阮一峰的网络日志
钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知
WordPress大学
WordPress大学
The Cloudflare Blog
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More
S
SegmentFault 最新的问题
人人都是产品经理
人人都是产品经理
V
V2EX
酷 壳 – CoolShell
酷 壳 – CoolShell

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: dedupe codex shared client mock calls · openclaw/op...
steipete · 2026-05-12 · via Recent Commits to openclaw:main

@@ -56,6 +56,53 @@ async function sendEmptyModelList(harness: ReturnType<typeof createClientHarness

5656

harness.send({ id: modelList.id, result: { data: [] } });

5757

}

585859+

function firstMockArg(mock: unknown, label: string): unknown {

60+

const call = (mock as { mock?: { calls?: unknown[][] } }).mock?.calls?.at(0);

61+

if (!call) {

62+

throw new Error(`Expected ${label} first call`);

63+

}

64+

return call[0];

65+

}

66+67+

function bridgeStartOptionsCall() {

68+

return firstMockArg(mocks.bridgeCodexAppServerStartOptions, "bridge start options") as {

69+

agentDir?: string;

70+

authProfileId?: string;

71+

config?: unknown;

72+

startOptions: { command?: string; commandSource?: string };

73+

};

74+

}

75+76+

function applyAuthProfileCall() {

77+

return firstMockArg(mocks.applyCodexAppServerAuthProfile, "apply auth profile") as {

78+

agentDir?: string;

79+

authProfileId?: string;

80+

config?: unknown;

81+

};

82+

}

83+84+

function resolveAuthProfileCall() {

85+

return firstMockArg(mocks.resolveCodexAppServerAuthProfileIdForAgent, "resolve auth profile") as {

86+

agentDir?: string;

87+

authProfileId?: string;

88+

config?: unknown;

89+

};

90+

}

91+92+

function managedStartOptionsCall() {

93+

return firstMockArg(mocks.resolveManagedCodexAppServerStartOptions, "managed start options") as {

94+

command?: string;

95+

commandSource?: string;

96+

};

97+

}

98+99+

function clientStartCall(startSpy: unknown) {

100+

return firstMockArg(startSpy, "CodexAppServerClient.start") as {

101+

command?: string;

102+

commandSource?: string;

103+

};

104+

}

105+59106

describe("shared Codex app-server client", () => {

60107

beforeAll(async () => {

61108

({ listCodexAppServerModels } = await import("./models.js"));

@@ -145,9 +192,9 @@ describe("shared Codex app-server client", () => {

145192

await sendEmptyModelList(harness);

146193147194

await expect(listPromise).resolves.toEqual({ models: [] });

148-

const [bridgeCall] = mocks.bridgeCodexAppServerStartOptions.mock.calls[0] ?? [];

195+

const bridgeCall = bridgeStartOptionsCall();

149196

expect(bridgeCall?.authProfileId).toBe("openai-codex:work");

150-

const [applyCall] = mocks.applyCodexAppServerAuthProfile.mock.calls[0] ?? [];

197+

const applyCall = applyAuthProfileCall();

151198

expect(applyCall?.authProfileId).toBe("openai-codex:work");

152199

});

153200

@@ -165,16 +212,16 @@ describe("shared Codex app-server client", () => {

165212

await sendEmptyModelList(harness);

166213167214

await expect(listPromise).resolves.toEqual({ models: [] });

168-

const [resolveCall] = mocks.resolveCodexAppServerAuthProfileIdForAgent.mock.calls[0] ?? [];

215+

const resolveCall = resolveAuthProfileCall();

169216

expect(resolveCall).toStrictEqual({

170217

authProfileId: undefined,

171218

agentDir: "/tmp/openclaw-agent",

172219

config,

173220

});

174-

const [bridgeCall] = mocks.bridgeCodexAppServerStartOptions.mock.calls[0] ?? [];

221+

const bridgeCall = bridgeStartOptionsCall();

175222

expect(bridgeCall?.authProfileId).toBe("openai-codex:work");

176223

expect(bridgeCall?.config).toBe(config);

177-

const [applyCall] = mocks.applyCodexAppServerAuthProfile.mock.calls[0] ?? [];

224+

const applyCall = applyAuthProfileCall();

178225

expect(applyCall?.authProfileId).toBe("openai-codex:work");

179226

expect(applyCall?.config).toBe(config);

180227

});

@@ -192,10 +239,10 @@ describe("shared Codex app-server client", () => {

192239

await sendEmptyModelList(harness);

193240194241

await expect(listPromise).resolves.toEqual({ models: [] });

195-

const [bridgeCall] = mocks.bridgeCodexAppServerStartOptions.mock.calls[0] ?? [];

242+

const bridgeCall = bridgeStartOptionsCall();

196243

expect(bridgeCall?.agentDir).toBe("/tmp/openclaw-agent-nova");

197244

expect(bridgeCall?.authProfileId).toBe("openai-codex:work");

198-

const [applyCall] = mocks.applyCodexAppServerAuthProfile.mock.calls[0] ?? [];

245+

const applyCall = applyAuthProfileCall();

199246

expect(applyCall?.agentDir).toBe("/tmp/openclaw-agent-nova");

200247

expect(applyCall?.authProfileId).toBe("openai-codex:work");

201248

});

@@ -214,13 +261,13 @@ describe("shared Codex app-server client", () => {

214261

await sendEmptyModelList(harness);

215262216263

await expect(listPromise).resolves.toEqual({ models: [] });

217-

const [managedCall] = mocks.resolveManagedCodexAppServerStartOptions.mock.calls[0] ?? [];

264+

const managedCall = managedStartOptionsCall();

218265

expect(managedCall?.command).toBe("codex");

219266

expect(managedCall?.commandSource).toBe("managed");

220-

const [bridgeCall] = mocks.bridgeCodexAppServerStartOptions.mock.calls[0] ?? [];

267+

const bridgeCall = bridgeStartOptionsCall();

221268

expect(bridgeCall?.startOptions.command).toBe("/cache/openclaw/codex");

222269

expect(bridgeCall?.startOptions.commandSource).toBe("resolved-managed");

223-

const [startCall] = startSpy.mock.calls[0] ?? [];

270+

const startCall = clientStartCall(startSpy);

224271

expect(startCall?.command).toBe("/cache/openclaw/codex");

225272

expect(startCall?.commandSource).toBe("resolved-managed");

226273

});