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 teammate projection tests with the finished-turn rule

zqchris1ff2187bb705
diff --git a/apps/desktop/src/renderer/__tests__/botGeneratedArtifactsCard.test.tsx b/apps/desktop/src/renderer/__tests__/botGeneratedArtifactsCard.test.tsx
index a583017511..516bc7a1cf 100644
--- a/apps/desktop/src/renderer/__tests__/botGeneratedArtifactsCard.test.tsx
+++ b/apps/desktop/src/renderer/__tests__/botGeneratedArtifactsCard.test.tsx
@@ -192,7 +192,7 @@ describe('伙伴成果卡', () => {
expect(screen.getByTestId('bot-generated-artifacts')).toBeTruthy();
});
- it.each(['stop', 'error', 'history'])('omits the preamble once a real generated file is visible, keeping only the work fold: %s', async (ending) => {
+ it.each(['stop', 'error', 'history'])('omits the preamble once a real generated file is visible: %s', async (ending) => {
let finish!: (value: FileStat) => void;
const stat = vi.fn(() => new Promise<FileStat>((resolve) => { finish = resolve; }));
window.electronAPI.fsBrowse.statPath = stat;
@@ -208,8 +208,9 @@ describe('伙伴成果卡', () => {
await act(async () => finish({ kind: 'file', resolvedPath: '/bot/workspace/result.pdf', birthtimeMs: START + 100, mtimeMs: START + 100 }));
expect(screen.getByText('result.pdf')).toBeTruthy();
expect(screen.queryByTestId('main-prose')).toBeNull();
- // The tool run stays in the normal work fold; the preamble never resurfaces there.
- expect(screen.getByTestId('public-process').textContent).toBe('');
+ // The turn is over, so its work process has left (cindy-bots-runtime.md); the preamble
+ // does not resurface anywhere.
+ expect(screen.queryByTestId('public-process')).toBeNull();
expect(screen.queryByText('Generating the report')).toBeNull();
if (ending === 'error') expect(screen.getByTestId('error').textContent).toBe('Generation interrupted');
expect(stat).toHaveBeenCalledTimes(1);
diff --git a/apps/desktop/src/renderer/__tests__/workGroupHistoryGap.test.ts b/apps/desktop/src/renderer/__tests__/workGroupHistoryGap.test.ts
index 79c56f2ea2..17781b163b 100644
--- a/apps/desktop/src/renderer/__tests__/workGroupHistoryGap.test.ts
+++ b/apps/desktop/src/renderer/__tests__/workGroupHistoryGap.test.ts
@@ -125,17 +125,17 @@ describe('历史窗口空洞 — 跨空洞不合并工作组', () => {
expect(groupContains(beforeGap[0], 't2')).toBe(false);
});
- it.each([false, true])('伙伴投影保留空洞前答复,两侧过程各自留在普通工作组里,active=%s', (streaming) => {
+ it.each([false, true])('伙伴投影保留空洞前答复,只有仍在运行的一轮露出工作过程,active=%s', (streaming) => {
const { items } = buildRenderItems(gapMessages());
const projected = simplifyBotRenderItems(groupWorkRuns(items, streaming), streaming);
const prose = projected.flatMap((item) => item.type === 'message' && item.message.role === 'assistant'
? [item.message.clientId] : []);
expect(prose).toEqual(streaming ? ['a1'] : ['a1', 'a2']);
const groups = workGroups(projected);
- expect(groups.some((group) => groupContains(group, 't1'))).toBe(true);
- expect(groups.some((group) => groupContains(group, 't2'))).toBe(true);
- // 与普通任务一样:同一个组不能同时装着空洞两侧的动作。
- expect(groups.some((group) => groupContains(group, 't1') && groupContains(group, 't2'))).toBe(false);
+ // 空洞前那一轮已做完,工作过程随之离开(cindy-bots-runtime.md,2026-10-20「做完了,去掉」);
+ // 运行中的空洞后一轮仍露出自己的工作组,且不吞进空洞前的动作。
+ expect(groups.some((group) => groupContains(group, 't1'))).toBe(false);
+ expect(groups.some((group) => groupContains(group, 't2'))).toBe(streaming);
expect(projected.some(item => item.type === 'tool_segment')).toBe(false);
});
@@ -233,8 +233,8 @@ describe('历史窗口空洞 — 长任务不被误判', () => {
const projected = simplifyBotRenderItems(grouped, false);
expect(projected.flatMap((item) => item.type === 'message' && item.message.role === 'assistant'
? [item.message.clientId] : [])).toEqual(['a1']);
- // 伙伴与普通任务同一个「已工作」组,进度文字留在组内。
- expect(workGroups(projected)).toEqual(groups);
+ // 伙伴的这一轮已做完:工作过程整块离开,进度文字也不外露,只留最终答复。
+ expect(workGroups(projected)).toEqual([]);
});
});
diff --git a/apps/desktop/src/renderer/components/chat/__tests__/imageClipboardInteractions.test.tsx b/apps/desktop/src/renderer/components/chat/__tests__/imageClipboardInteractions.test.tsx
index 7be4a1423c..827a186e7e 100644
--- a/apps/desktop/src/renderer/components/chat/__tests__/imageClipboardInteractions.test.tsx
+++ b/apps/desktop/src/renderer/components/chat/__tests__/imageClipboardInteractions.test.tsx
@@ -113,9 +113,18 @@ describe('shared production image interactions', () => {
expect(fileCopy).toHaveBeenCalledWith({ filePath: '/fixture/preview.png' }),
);
expect(toast.success).toHaveBeenCalledWith(label('chat.media.imageCopied'));
- // The message toolbar copies Markdown text, never the image or its path.
- fireEvent.click(screen.getByRole('button', { name: label('chat.messageActionBar.copy') }));
- expect(writeText).toHaveBeenCalledWith('![preview](/fixture/preview.png)');
+ // The message toolbar copies Markdown text, never the image or its path. A teammate
+ // reply hangs the compact toolbar beside its bubble, with Copy inside More.
+ if (simplified) {
+ fireEvent.pointerDown(
+ screen.getByRole('button', { name: label('chat.messageActionBar.moreActions') }),
+ { button: 0, ctrlKey: false },
+ );
+ fireEvent.click(screen.getByRole('menuitem', { name: label('chat.messageActionBar.copy') }));
+ } else {
+ fireEvent.click(screen.getByRole('button', { name: label('chat.messageActionBar.copy') }));
+ }
+ await waitFor(() => expect(writeText).toHaveBeenCalledWith('![preview](/fixture/preview.png)'));
expect(nativeCopy).not.toHaveBeenCalled();
},
);