mirror of
https://github.com/QwenLM/qwen-code.git
synced 2026-04-28 19:52:02 +00:00
refactor(tests): reorganize integration tests by execution mode
Move non-interactive tests to cli/, interactive tests to interactive/. Add cron-interactive.test.ts wrapping terminal-capture E2E in vitest. Update npm scripts and release workflow for new directory layout.
This commit is contained in:
parent
707b06ca48
commit
ded89618ec
28 changed files with 261 additions and 327 deletions
73
integration-tests/cli/todo_write.test.ts
Normal file
73
integration-tests/cli/todo_write.test.ts
Normal file
|
|
@ -0,0 +1,73 @@
|
|||
/**
|
||||
* @license
|
||||
* Copyright 2025 Google LLC
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
|
||||
import { describe, it, expect } from 'vitest';
|
||||
import {
|
||||
TestRig,
|
||||
printDebugInfo,
|
||||
validateModelOutput,
|
||||
} from '../test-helper.js';
|
||||
|
||||
describe('todo_write', () => {
|
||||
it('should be able to create and manage a todo list', async () => {
|
||||
const rig = new TestRig();
|
||||
await rig.setup('should be able to create and manage a todo list');
|
||||
|
||||
const prompt = `Please create a todo list with these three simple tasks:
|
||||
1. Buy milk
|
||||
2. Walk the dog
|
||||
3. Read a book
|
||||
|
||||
Use the todo_write tool to create this list.`;
|
||||
|
||||
const result = await rig.run(prompt);
|
||||
|
||||
const foundToolCall = await rig.waitForToolCall('todo_write');
|
||||
|
||||
// Add debugging information
|
||||
if (!foundToolCall) {
|
||||
printDebugInfo(rig, result);
|
||||
}
|
||||
|
||||
expect(
|
||||
foundToolCall,
|
||||
'Expected to find a todo_write tool call',
|
||||
).toBeTruthy();
|
||||
|
||||
// Validate model output - will throw if no output
|
||||
validateModelOutput(result, null, 'Todo write test');
|
||||
|
||||
// Check that the tool was called with the right parameters
|
||||
const toolLogs = rig.readToolLogs();
|
||||
const todoWriteCalls = toolLogs.filter(
|
||||
(t) => t.toolRequest.name === 'todo_write',
|
||||
);
|
||||
|
||||
expect(todoWriteCalls.length).toBeGreaterThan(0);
|
||||
|
||||
// Parse the arguments to verify they contain our tasks
|
||||
const todoArgs = JSON.parse(todoWriteCalls[0].toolRequest.args);
|
||||
|
||||
expect(todoArgs.todos).toBeDefined();
|
||||
expect(Array.isArray(todoArgs.todos)).toBe(true);
|
||||
expect(todoArgs.todos.length).toBeGreaterThanOrEqual(3);
|
||||
|
||||
// Check that all todos have the correct structure
|
||||
for (const todo of todoArgs.todos) {
|
||||
expect(todo.id).toBeDefined();
|
||||
expect(todo.content).toBeDefined();
|
||||
expect(['pending', 'in_progress', 'completed', 'cancelled']).toContain(
|
||||
todo.status,
|
||||
);
|
||||
}
|
||||
|
||||
// Log success info if verbose
|
||||
if (process.env['VERBOSE'] === 'true') {
|
||||
console.log('Todo list created successfully');
|
||||
console.log(`Created ${todoArgs.todos.length} todos`);
|
||||
}
|
||||
});
|
||||
});
|
||||
Loading…
Add table
Add a link
Reference in a new issue