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

推荐订阅源

Google DeepMind News
Google DeepMind News
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More
酷 壳 – CoolShell
酷 壳 – CoolShell
WordPress大学
WordPress大学
小众软件
小众软件
博客园 - 司徒正美
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻
Jina AI
Jina AI
Hugging Face - Blog
Hugging Face - Blog
博客园 - Franky
奇客Solidot–传递最新科技情报
奇客Solidot–传递最新科技情报
量子位
钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知
雷峰网
雷峰网
云风的 BLOG
云风的 BLOG
M
MIT News - Artificial intelligence
F
Fortinet All Blogs
T
Tailwind CSS Blog
Martin Fowler
Martin Fowler
I
InfoQ
The GitHub Blog
The GitHub Blog
有赞技术团队
有赞技术团队
The Cloudflare 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: guard discord provider proxy mock calls · openclaw/...
steipete · 2026-05-12 · via Recent Commits to openclaw:main

@@ -199,6 +199,20 @@ describe("createDiscordGatewayPlugin", () => {

199199

};

200200

}

201201202+

type MockWithCalls = { mock: { calls: unknown[][] } };

203+204+

function firstMockCall(mock: MockWithCalls, label: string): unknown[] {

205+

const call = mock.mock.calls.at(0);

206+

if (!call) {

207+

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

208+

}

209+

return call;

210+

}

211+212+

function firstMockArg(mock: MockWithCalls, label: string, index = 0) {

213+

return firstMockCall(mock, label)[index];

214+

}

215+202216

function createProxyTestingOverrides() {

203217

return {

204218

HttpsProxyAgentCtor:

@@ -279,7 +293,7 @@ describe("createDiscordGatewayPlugin", () => {

279293

"wss://gateway.discord.gg/",

280294

);

281295

expect(runtime.log).toHaveBeenCalledTimes(1);

282-

expect(String(runtime.log.mock.calls[0]?.[0])).toContain(

296+

expect(String(firstMockArg(runtime.log, "runtime.log"))).toContain(

283297

"discord: gateway metadata lookup failed transiently",

284298

);

285299

}

@@ -328,10 +342,12 @@ describe("createDiscordGatewayPlugin", () => {

328342

await registerGatewayClientWithMetadata({ plugin, fetchMock: globalFetchMock });

329343330344

expect(globalFetchMock).toHaveBeenCalledTimes(1);

331-

const fetchInit = globalFetchMock.mock.calls[0]?.[1] as

345+

const fetchInit = firstMockArg(globalFetchMock, "globalFetchMock", 1) as

332346

| { headers?: Record<string, string>; signal?: unknown }

333347

| undefined;

334-

expect(globalFetchMock.mock.calls[0]?.[0]).toBe("https://discord.com/api/v10/gateway/bot");

348+

expect(firstMockArg(globalFetchMock, "globalFetchMock")).toBe(

349+

"https://discord.com/api/v10/gateway/bot",

350+

);

335351

expect(fetchInit?.headers).toEqual({ Authorization: "Bot token-123" });

336352

expect(fetchInit?.signal).toBeInstanceOf(AbortSignal);

337353

expect(baseRegisterClientSpy).toHaveBeenCalledTimes(1);

@@ -349,7 +365,9 @@ describe("createDiscordGatewayPlugin", () => {

349365

createWebSocket("wss://gateway.discord.gg");

350366351367

expect(httpsAgentSpy).toHaveBeenCalledTimes(1);

352-

const httpsAgentOptions = httpsAgentSpy.mock.calls[0]?.[0] as { lookup?: unknown } | undefined;

368+

const httpsAgentOptions = firstMockArg(httpsAgentSpy, "httpsAgentSpy") as

369+

| { lookup?: unknown }

370+

| undefined;

353371

expect(Object.keys(httpsAgentOptions ?? {})).toEqual(["lookup"]);

354372

expect(typeof httpsAgentOptions?.lookup).toBe("function");

355373

expect(webSocketSpy).toHaveBeenCalledWith("wss://gateway.discord.gg", {

@@ -499,10 +517,12 @@ describe("createDiscordGatewayPlugin", () => {

499517

await registerGatewayClientWithMetadata({ plugin, fetchMock: globalFetchMock });

500518501519

expect(globalFetchMock).toHaveBeenCalledTimes(1);

502-

const fetchInit = globalFetchMock.mock.calls[0]?.[1] as

520+

const fetchInit = firstMockArg(globalFetchMock, "globalFetchMock", 1) as

503521

| { headers?: Record<string, string>; signal?: unknown }

504522

| undefined;

505-

expect(globalFetchMock.mock.calls[0]?.[0]).toBe("https://discord.com/api/v10/gateway/bot");

523+

expect(firstMockArg(globalFetchMock, "globalFetchMock")).toBe(

524+

"https://discord.com/api/v10/gateway/bot",

525+

);

506526

expect(fetchInit?.headers).toEqual({ Authorization: "Bot token-123" });

507527

expect(fetchInit?.signal).toBeInstanceOf(AbortSignal);

508528

expect(baseRegisterClientSpy).toHaveBeenCalledTimes(1);

@@ -548,7 +568,7 @@ describe("createDiscordGatewayPlugin", () => {

548568549569

expect(Object.getPrototypeOf(plugin)).not.toBe(GatewayPlugin.prototype);

550570

expect(runtime.error).toHaveBeenCalledTimes(1);

551-

expect(String(runtime.error.mock.calls[0]?.[0])).toContain("loopback host");

571+

expect(String(firstMockArg(runtime.error, "runtime.error"))).toContain("loopback host");

552572

expect(runtime.log).not.toHaveBeenCalled();

553573

});

554574

@@ -580,7 +600,7 @@ describe("createDiscordGatewayPlugin", () => {

580600

"wss://gateway.discord.gg/",

581601

);

582602

expect(runtime.log).toHaveBeenCalledTimes(1);

583-

expect(String(runtime.log.mock.calls[0]?.[0])).toContain(

603+

expect(String(firstMockArg(runtime.log, "runtime.log"))).toContain(

584604

"discord: gateway metadata lookup failed transiently",

585605

);

586606

});