Consider it done. The open-source AI agent that works out of the box · 想到,就能做到。开源、开箱即用的 AI Agent。
TypeScript agentai-agentai-assistantandroidclaude-codecodexelectroniosllmmacosreact-nativetypescriptwindows
// @vitest-environment jsdom
import { afterEach, describe, expect, it, vi } from 'vitest';
import type { ReactElement } from 'react';
import { MemoryRouter } from 'react-router-dom';
import { cleanup, render as renderUI, screen } from '@testing-library/react';
import { SystemCard } from '../SystemCard';
import { CindyMakeCompleteCard } from '@/components/cindy-make/CindyMakeCompleteCard';
vi.mock('react-i18next', () => ({
useTranslation: () => ({
t: (key: string, opts?: Record<string, unknown>) =>
opts && Object.keys(opts).length > 0 ? `${key}:${JSON.stringify(opts)}` : key,
i18n: { language: 'en' },
}),
}));
vi.mock('@/features/bots/useRemoteBots', () => ({ useRemoteBots: () => [] }));
// Partner task cards have their own integration suite; isolate this sibling variant.
vi.mock('@/features/bots/BotCollaborationCard', () => ({
BotSessionTaskCard: () => null,
BotSessionTaskMessageTrace: () => null,
}));
vi.mock('@/features/bots/BotSessionTaskResultCard', () => ({
BotSessionTaskResultCard: () => null,
}));
vi.mock('@/features/learn/LearnStatusCard', () => ({ LearnStatusCard: () => null }));
vi.mock('@/components/chat/MarkdownRenderer', () => ({ MarkdownRenderer: () => null }));
vi.mock('@/hooks/useReducedMotion', () => ({ useReducedMotion: () => true }));
const render = (ui: ReactElement) => renderUI(ui, { wrapper: MemoryRouter });
afterEach(() => cleanup());
describe('cindy-make-complete system card', () => {
it('hides completion cards in the message stream while Make is disabled', () => {
const view = render(<SystemCard cardType="cindy-make-complete" sessionId="make-task" data={{ changedFiles: 3 }} />);
expect(view.container.childElementCount).toBe(0);
});
it('renders one completion summary with code-verified facts', () => {
render(
<CindyMakeCompleteCard
data={{
reportedAt: Date.UTC(2026, 8, 10, 12, 0),
changedFiles: 3,
commit: 'abcdef1234567890',
}}
/>,
);
expect(screen.getAllByRole('region', { name: 'cindyMake.complete.title' })).toHaveLength(1);
expect(screen.getByText('cindyMake.complete.description')).toBeTruthy();
expect(
screen.getByRole('region', { name: 'cindyMake.complete.title' }).querySelector('svg'),
).toBeTruthy();
const meta = screen.getByText(/cindyMake\.complete\.changedFiles/).textContent ?? '';
expect(meta).toContain('"count":3');
expect(meta).toContain('"commit":"abcdef123456"');
expect(meta).not.toContain('abcdef1234567890');
});
it('omits the meta line when no facts were collected', () => {
render(<CindyMakeCompleteCard data={{}} />);
expect(screen.getByRole('region', { name: 'cindyMake.complete.title' })).toBeTruthy();
expect(screen.queryByText(/changedFiles|commit/)).toBeNull();
});
});