feat: 添加自动化任务(automation_jobs)功能模块
This commit is contained in:
@@ -0,0 +1,42 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_test/flutter_test.dart';
|
||||
import 'package:social_app/features/chat/data/models/chat_list_item.dart';
|
||||
import 'package:social_app/features/home/ui/widgets/home_chat_item_renderer.dart';
|
||||
|
||||
void main() {
|
||||
ToolCallItem _toolCallItem(String toolName) {
|
||||
return ToolCallItem(
|
||||
id: 'tc-1',
|
||||
callId: 'tc-1',
|
||||
toolName: toolName,
|
||||
args: const {},
|
||||
status: ToolCallStatus.pending,
|
||||
timestamp: DateTime(2026, 1, 1),
|
||||
sender: MessageSender.ai,
|
||||
);
|
||||
}
|
||||
|
||||
Future<void> _pumpToolCallItem(WidgetTester tester, String toolName) async {
|
||||
final widget = MaterialApp(
|
||||
home: Scaffold(body: HomeChatItemRenderer.build(_toolCallItem(toolName))),
|
||||
);
|
||||
await tester.pumpWidget(widget);
|
||||
}
|
||||
|
||||
group('HomeChatItemRenderer tool name localization', () {
|
||||
testWidgets('renders dot style name in Chinese', (tester) async {
|
||||
await _pumpToolCallItem(tester, 'memory.write');
|
||||
expect(find.text('写入记忆'), findsOneWidget);
|
||||
});
|
||||
|
||||
testWidgets('renders snake style alias in Chinese', (tester) async {
|
||||
await _pumpToolCallItem(tester, 'memory_write');
|
||||
expect(find.text('写入记忆'), findsOneWidget);
|
||||
});
|
||||
|
||||
testWidgets('falls back to raw name for unknown tool', (tester) async {
|
||||
await _pumpToolCallItem(tester, 'unknown.tool');
|
||||
expect(find.text('unknown.tool'), findsOneWidget);
|
||||
});
|
||||
});
|
||||
}
|
||||
Reference in New Issue
Block a user