mirror of
https://github.com/QwenLM/qwen-code.git
synced 2026-04-29 20:20:57 +00:00
🚀 Add Todo Write Tool for Task Management and Progress Tracking (#478)
Some checks failed
E2E Tests / E2E Test (Linux) - sandbox:docker (push) Has been cancelled
E2E Tests / E2E Test (Linux) - sandbox:none (push) Has been cancelled
Qwen Code CI / Lint (GitHub Actions) (push) Has been cancelled
Qwen Code CI / Lint (Javascript) (push) Has been cancelled
Qwen Code CI / Lint (Shell) (push) Has been cancelled
Qwen Code CI / Lint (YAML) (push) Has been cancelled
Qwen Code CI / CodeQL (push) Has been cancelled
E2E Tests / E2E Test - macOS (push) Has been cancelled
Qwen Code CI / Lint (push) Has been cancelled
Qwen Code CI / Test (push) Has been cancelled
Qwen Code CI / Post Coverage Comment (push) Has been cancelled
Some checks failed
E2E Tests / E2E Test (Linux) - sandbox:docker (push) Has been cancelled
E2E Tests / E2E Test (Linux) - sandbox:none (push) Has been cancelled
Qwen Code CI / Lint (GitHub Actions) (push) Has been cancelled
Qwen Code CI / Lint (Javascript) (push) Has been cancelled
Qwen Code CI / Lint (Shell) (push) Has been cancelled
Qwen Code CI / Lint (YAML) (push) Has been cancelled
Qwen Code CI / CodeQL (push) Has been cancelled
E2E Tests / E2E Test - macOS (push) Has been cancelled
Qwen Code CI / Lint (push) Has been cancelled
Qwen Code CI / Test (push) Has been cancelled
Qwen Code CI / Post Coverage Comment (push) Has been cancelled
This commit is contained in:
parent
c1498668b6
commit
1610c1586e
13 changed files with 1901 additions and 103 deletions
97
packages/cli/src/ui/components/TodoDisplay.test.tsx
Normal file
97
packages/cli/src/ui/components/TodoDisplay.test.tsx
Normal file
|
|
@ -0,0 +1,97 @@
|
|||
/**
|
||||
* @license
|
||||
* Copyright 2025 Google LLC
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
|
||||
import { render } from 'ink-testing-library';
|
||||
import { describe, it, expect } from 'vitest';
|
||||
import { TodoItem, TodoDisplay } from './TodoDisplay.js';
|
||||
|
||||
describe('TodoDisplay', () => {
|
||||
const mockTodos: TodoItem[] = [
|
||||
{
|
||||
id: '1',
|
||||
content: 'Complete feature implementation',
|
||||
status: 'completed',
|
||||
},
|
||||
{
|
||||
id: '2',
|
||||
content: 'Write unit tests',
|
||||
status: 'in_progress',
|
||||
},
|
||||
{
|
||||
id: '3',
|
||||
content: 'Update documentation',
|
||||
status: 'pending',
|
||||
},
|
||||
];
|
||||
|
||||
it('should render todo list', () => {
|
||||
const { lastFrame } = render(<TodoDisplay todos={mockTodos} />);
|
||||
|
||||
const output = lastFrame();
|
||||
|
||||
// Check all todo items are displayed
|
||||
expect(output).toContain('Complete feature implementation');
|
||||
expect(output).toContain('Write unit tests');
|
||||
expect(output).toContain('Update documentation');
|
||||
});
|
||||
|
||||
it('should display correct status icons', () => {
|
||||
const { lastFrame } = render(<TodoDisplay todos={mockTodos} />);
|
||||
|
||||
const output = lastFrame();
|
||||
|
||||
// Check status icons are present
|
||||
expect(output).toContain('●'); // completed
|
||||
expect(output).toContain('◐'); // in_progress
|
||||
expect(output).toContain('○'); // pending
|
||||
});
|
||||
|
||||
it('should handle empty todo list', () => {
|
||||
const { lastFrame } = render(<TodoDisplay todos={[]} />);
|
||||
|
||||
const output = lastFrame();
|
||||
|
||||
// Should render nothing for empty todos
|
||||
expect(output).toBe('');
|
||||
});
|
||||
|
||||
it('should handle undefined todos', () => {
|
||||
const { lastFrame } = render(
|
||||
<TodoDisplay todos={undefined as unknown as TodoItem[]} />,
|
||||
);
|
||||
|
||||
const output = lastFrame();
|
||||
|
||||
// Should render nothing for undefined todos
|
||||
expect(output).toBe('');
|
||||
});
|
||||
|
||||
it('should render tasks with different statuses', () => {
|
||||
const allCompleted: TodoItem[] = [
|
||||
{ id: '1', content: 'Task 1', status: 'completed' },
|
||||
{ id: '2', content: 'Task 2', status: 'completed' },
|
||||
];
|
||||
|
||||
const { lastFrame } = render(<TodoDisplay todos={allCompleted} />);
|
||||
|
||||
const output = lastFrame();
|
||||
expect(output).toContain('Task 1');
|
||||
expect(output).toContain('Task 2');
|
||||
});
|
||||
|
||||
it('should render tasks with mixed statuses', () => {
|
||||
const mixedTodos: TodoItem[] = [
|
||||
{ id: '1', content: 'Task 1', status: 'pending' },
|
||||
{ id: '2', content: 'Task 2', status: 'in_progress' },
|
||||
];
|
||||
|
||||
const { lastFrame } = render(<TodoDisplay todos={mixedTodos} />);
|
||||
|
||||
const output = lastFrame();
|
||||
expect(output).toContain('Task 1');
|
||||
expect(output).toContain('Task 2');
|
||||
});
|
||||
});
|
||||
Loading…
Add table
Add a link
Reference in a new issue