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

推荐订阅源

宝玉的分享
宝玉的分享
B
Blog RSS Feed
Cyber Security Advisories - MS-ISAC
Cyber Security Advisories - MS-ISAC
MyScale Blog
MyScale Blog
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More
S
SegmentFault 最新的问题
Y
Y Combinator Blog
月光博客
月光博客
IT之家
IT之家
T
Tailwind CSS Blog
Last Week in AI
Last Week in AI
L
LangChain Blog
博客园_首页
MongoDB | Blog
MongoDB | Blog
P
Proofpoint News Feed
博客园 - Franky
WordPress大学
WordPress大学
云风的 BLOG
云风的 BLOG
M
MIT News - Artificial intelligence
V
Visual Studio Blog
小众软件
小众软件
博客园 - 叶小钗
博客园 - 三生石上(FineUI控件)
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 talk session controller assertions · opencl...
steipete · 2026-05-09 · via Recent Commits to openclaw:main

@@ -1,14 +1,23 @@

11

import { describe, expect, it } from "vitest";

2+

import type { TalkEvent } from "./talk-events.js";

23

import { createTalkSessionController, normalizeTalkTransport } from "./talk-session-controller.js";

345+

const TEST_TALK_CONTEXT = {

6+

brain: "agent-consult",

7+

mode: "realtime",

8+

provider: "test",

9+

sessionId: "talk-session",

10+

transport: "gateway-relay",

11+

} as const;

12+13+

function expectTalkEvent(event: TalkEvent | undefined, expected: TalkEvent) {

14+

expect(event).toStrictEqual(expected);

15+

}

16+417

function createController() {

518

return createTalkSessionController(

619

{

7-

sessionId: "talk-session",

8-

mode: "realtime",

9-

transport: "gateway-relay",

10-

brain: "agent-consult",

11-

provider: "test",

20+

...TEST_TALK_CONTEXT,

1221

maxRecentEvents: 3,

1322

},

1423

{ now: () => "2026-05-05T00:00:00.000Z" },

@@ -33,17 +42,19 @@ describe("createTalkSessionController", () => {

3342

final: true,

3443

});

354436-

expect(firstTurn.event).toMatchObject({

45+

expectTalkEvent(firstTurn.event, {

46+

...TEST_TALK_CONTEXT,

47+

callId: undefined,

48+

captureId: undefined,

49+

final: undefined,

3750

id: "talk-session:2",

38-

type: "turn.started",

39-

sessionId: "talk-session",

40-

turnId: "turn-1",

41-

mode: "realtime",

42-

transport: "gateway-relay",

43-

brain: "agent-consult",

44-

provider: "test",

51+

itemId: undefined,

52+

parentId: undefined,

53+

payload: {},

4554

seq: 2,

4655

timestamp: "2026-05-05T00:00:00.000Z",

56+

turnId: "turn-1",

57+

type: "turn.started",

4758

});

4859

expect(talk.recentEvents.map((event) => event.type)).toEqual([

4960

"turn.started",

@@ -63,15 +74,23 @@ describe("createTalkSessionController", () => {

63746475

const ended = talk.endTurn({ turnId: "turn-old", payload: { reason: "done" } });

657666-

expect(ended).toMatchObject({

67-

ok: true,

68-

turnId: "turn-old",

77+

expect(ended).toStrictEqual({

6978

event: {

70-

type: "turn.ended",

71-

turnId: "turn-old",

72-

payload: { reason: "done" },

79+

...TEST_TALK_CONTEXT,

80+

callId: undefined,

81+

captureId: undefined,

7382

final: true,

83+

id: "talk-session:2",

84+

itemId: undefined,

85+

parentId: undefined,

86+

payload: { reason: "done" },

87+

seq: 2,

88+

timestamp: "2026-05-05T00:00:00.000Z",

89+

turnId: "turn-old",

90+

type: "turn.ended",

7491

},

92+

ok: true,

93+

turnId: "turn-old",

7594

});

7695

expect(talk.activeTurnId).toBeUndefined();

7796

});

@@ -83,16 +102,34 @@ describe("createTalkSessionController", () => {

83102

const second = talk.startOutputAudio({ payload: { callId: "call-1" } });

84103

const done = talk.finishOutputAudio({ payload: { reason: "mark" } });

8510486-

expect(first.event).toMatchObject({

87-

type: "output.audio.started",

105+

expectTalkEvent(first.event, {

106+

...TEST_TALK_CONTEXT,

107+

callId: undefined,

108+

captureId: undefined,

109+

final: undefined,

110+

id: "talk-session:2",

111+

itemId: undefined,

112+

parentId: undefined,

113+

payload: { callId: "call-1" },

114+

seq: 2,

115+

timestamp: "2026-05-05T00:00:00.000Z",

88116

turnId: "turn-1",

117+

type: "output.audio.started",

89118

});

90119

expect(second).toEqual({ turnId: "turn-1" });

91-

expect(done).toMatchObject({

92-

type: "output.audio.done",

93-

turnId: "turn-1",

94-

payload: { reason: "mark" },

120+

expectTalkEvent(done, {

121+

...TEST_TALK_CONTEXT,

122+

callId: undefined,

123+

captureId: undefined,

95124

final: true,

125+

id: "talk-session:3",

126+

itemId: undefined,

127+

parentId: undefined,

128+

payload: { reason: "mark" },

129+

seq: 3,

130+

timestamp: "2026-05-05T00:00:00.000Z",

131+

turnId: "turn-1",

132+

type: "output.audio.done",

96133

});

97134

expect(talk.outputAudioActive).toBe(false);

98135

});

@@ -127,9 +164,22 @@ describe("createTalkSessionController", () => {

127164128165

const current = talk.startTurn({ turnId: "turn-current" });

129166130-

expect(current).toMatchObject({

167+

expect(current).toStrictEqual({

168+

event: {

169+

...TEST_TALK_CONTEXT,

170+

callId: undefined,

171+

captureId: undefined,

172+

final: undefined,

173+

id: "talk-session:3",

174+

itemId: undefined,

175+

parentId: undefined,

176+

payload: {},

177+

seq: 3,

178+

timestamp: "2026-05-05T00:00:00.000Z",

179+

turnId: "turn-current",

180+

type: "turn.started",

181+

},

131182

turnId: "turn-current",

132-

event: expect.objectContaining({ type: "turn.started", turnId: "turn-current" }),

133183

});

134184

expect(talk.activeTurnId).toBe("turn-current");

135185

expect(talk.outputAudioActive).toBe(false);