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

推荐订阅源

Microsoft Security Blog
Microsoft Security Blog
J
Java Code Geeks
GbyAI
GbyAI
aimingoo的专栏
aimingoo的专栏
L
LangChain Blog
I
InfoQ
D
Docker
F
Fortinet All Blogs
Y
Y Combinator Blog
Martin Fowler
Martin Fowler
月光博客
月光博客
B
Blog
Engineering at Meta
Engineering at Meta
T
Tailwind CSS Blog
罗磊的独立博客
博客园_首页
G
Google Developers Blog
Stack Overflow Blog
Stack Overflow Blog
Recent Announcements
Recent Announcements
D
DataBreaches.Net
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More
B
Blog RSS Feed
IT之家
IT之家
V
V2EX

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 msteams graph mock calls · openclaw/openclaw@...
steipete · 2026-05-12 · via Recent Commits to openclaw:main
Original file line numberDiff line numberDiff line change

@@ -35,6 +35,14 @@ function mockFetchWithRedirect(redirectMap: Record<string, string>, finalBody =

3535

});

3636

}

3737
38+

function fetchInitAt(fetchMock: ReturnType<typeof vi.fn>, index: number): unknown {

39+

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

40+

if (!call) {

41+

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

42+

}

43+

return call[1];

44+

}

45+
3846

async function expectSafeFetchStatus(params: {

3947

fetchMock: ReturnType<typeof vi.fn>;

4048

url: string;

@@ -150,7 +158,7 @@ describe("safeFetch", () => {

150158

});

151159

expect(fetchMock).toHaveBeenCalledOnce();

152160

// Should have used redirect: "manual"

153-

expect(fetchMock.mock.calls[0][1]).toHaveProperty("redirect", "manual");

161+

expect(fetchInitAt(fetchMock, 0)).toHaveProperty("redirect", "manual");

154162

});

155163
156164

it("follows a redirect to an allowlisted host with public IP", async () => {

Original file line numberDiff line numberDiff line change

@@ -37,6 +37,18 @@ const TOKEN = "test-graph-token";

3737

const CHAT_ID = "19:abc@thread.tacv2";

3838

const CHANNEL_TO = "team-id-1/channel-id-1";

3939
40+

function postGraphBodyAt(index: number): Record<string, unknown> {

41+

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

42+

if (!call) {

43+

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

44+

}

45+

const body = call[0]?.body;

46+

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

47+

throw new Error(`expected Graph post call ${index} body`);

48+

}

49+

return body as Record<string, unknown>;

50+

}

51+
4052

describe("addParticipantMSTeams", () => {

4153

beforeEach(() => {

4254

vi.clearAllMocks();

@@ -129,7 +141,7 @@ describe("addParticipantMSTeams", () => {

129141

userId: "abc-def-123",

130142

});

131143
132-

const calledBody = mockState.postGraphJson.mock.calls[0][0].body;

144+

const calledBody = postGraphBodyAt(0);

133145

expect(calledBody["user@odata.bind"]).toBe(

134146

"https://graph.microsoft.com/v1.0/users('abc-def-123')",

135147

);

@@ -144,7 +156,7 @@ describe("addParticipantMSTeams", () => {

144156

userId: "o'hara@example.com",

145157

});

146158
147-

const calledBody = mockState.postGraphJson.mock.calls[0][0].body;

159+

const calledBody = postGraphBodyAt(0);

148160

expect(calledBody["user@odata.bind"]).toBe(

149161

"https://graph.microsoft.com/v1.0/users('o''hara@example.com')",

150162

);

Original file line numberDiff line numberDiff line change

@@ -18,6 +18,14 @@ vi.mock("./graph.js", async (importOriginal) => {

1818
1919

const TOKEN = "test-graph-token";

2020
21+

function graphFetchPathAt(index: number): string | undefined {

22+

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

23+

if (!call) {

24+

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

25+

}

26+

return call[0]?.path;

27+

}

28+
2129

describe("listChannelsMSTeams", () => {

2230

beforeEach(() => {

2331

mockState.resolveGraphToken.mockReset().mockResolvedValue(TOKEN);

@@ -122,8 +130,7 @@ describe("listChannelsMSTeams", () => {

122130

expect(mockState.fetchGraphJson).toHaveBeenCalledTimes(3);

123131
124132

// Second call should use the relative path stripped from the nextLink

125-

const secondCallPath = mockState.fetchGraphJson.mock.calls[1]?.[0]?.path;

126-

expect(secondCallPath).toBe(

133+

expect(graphFetchPathAt(1)).toBe(

127134

"/teams/team-paged/channels?$select=id,displayName,description,membershipType&$skip=1",

128135

);

129136

});