Skip to content

armgit / cindy

Public Imported from GitHub
0

Consider it done. The open-source AI agent that works out of the box · 想到,就能做到。开源、开箱即用的 AI Agent。

test(desktop): align companion voice entry contract

JiangJiahaoeed074cea596
diff --git a/apps/desktop/src/renderer/features/bots/__tests__/botChatSurface.test.ts b/apps/desktop/src/renderer/features/bots/__tests__/botChatSurface.test.ts
index dfd579e59c..b90895bfc9 100644
--- a/apps/desktop/src/renderer/features/bots/__tests__/botChatSurface.test.ts
+++ b/apps/desktop/src/renderer/features/bots/__tests__/botChatSurface.test.ts
@@ -34,8 +34,10 @@ describe('Bot 对话的判定条件', () => {
it('伙伴对话换掉任务顶栏,而不是在它旁边再加一个', () => {
expect(sessionView).toMatch(/botChatIdentity\s*\?\s*\(\s*<BotSessionContentHeaderRegistration bot=\{botChatIdentity\}/);
- expect(sessionView).toContain('onVoice={voiceModeAvailable ? toggleVoiceMode : undefined}');
expect(sessionView).toContain('<SessionContentHeaderRegistration');
+ const botHeader = sessionView.match(/<BotSessionContentHeaderRegistration\b[\s\S]*?\/>/)?.[0];
+ expect(botHeader).toBeTruthy();
+ expect(botHeader).not.toMatch(/\bonVoice(?:Active)?\s*=/);
});
});
@@ -57,6 +59,12 @@ describe('消息流的头像挂载', () => {
});
describe('伙伴输入框只保留对话动作', () => {
+ it('语音对话入口接入输入框,并传递可用与通话状态', () => {
+ expect(sessionView).toContain('onStartVoiceConversation={voiceModeAvailable ? startVoiceMode : undefined}');
+ expect(sessionView).toContain('voiceConversationDisabled={voiceModeBlocked}');
+ expect(sessionView).toContain('voiceConversationActive={voiceModeOpen}');
+ });
+
it('伙伴保留标准权限 chip,仅隐藏模型选择器', () => {
expect(chatInput.match(/!hideRuntimeControls \? \(/g)?.length).toBe(1);
expect(chatInput.indexOf('<PermissionSelector')).toBeLessThan(chatInput.indexOf('!hideRuntimeControls ? ('));