MCPcopy Create free account
hub / github.com/MoonshotAI/kimi-code / task

Function task

apps/kimi-code/test/tui/background-task-status.test.ts:6–35  ·  view source on GitHub ↗
(overrides: Partial<BackgroundTaskInfo> = {})

Source from the content-addressed store, hash-verified

4import { formatBackgroundTaskTranscript } from '@/tui/utils/background-task-status';
5
6function task(overrides: Partial<BackgroundTaskInfo> = {}): BackgroundTaskInfo {
7 const taskId = overrides.taskId ?? 'bash-abcd1234';
8 const kind = overrides.kind ?? (taskId.startsWith('agent-') ? 'agent' : 'process');
9 const base = {
10 taskId,
11 kind,
12 description: 'dev server',
13 status: 'running',
14 startedAt: Date.now() - 1000,
15 endedAt: null,
16 ...overrides,
17 };
18 if (kind === 'agent') {
19 return {
20 ...base,
21 kind: 'agent',
22 agentId: 'agent-child',
23 subagentType: 'coder',
24 ...overrides,
25 } as BackgroundTaskInfo;
26 }
27 return {
28 ...base,
29 kind: 'process',
30 command: 'npm run dev',
31 pid: 1234,
32 exitCode: null,
33 ...overrides,
34 } as BackgroundTaskInfo;
35}
36
37describe('formatBackgroundTaskTranscript', () => {
38 it('renders a bash started entry', () => {

Callers 1

Calls 1

nowMethod · 0.65

Tested by

no test coverage detected