import 'package:eaimar/data/services/deapsound_ai_service.dart'; import 'package:flutter_test/flutter_test.dart'; /// 后台 llm_qwen.base_url 是不带路径的根地址,客户端要自己补 /chat/completions; /// 万一运维填了完整地址也不能拼成两段。 void main() { Uri build(String base) { final s = DeapsoundAIService.debugWithBaseUrl(base); return s.chatUrl; } test('根地址补路径', () { expect(build('https://dashscope.aliyuncs.com/compatible-mode/v1').toString(), 'https://dashscope.aliyuncs.com/compatible-mode/v1/chat/completions'); }); test('尾部斜杠不重复', () { expect(build('https://x/v1/').toString(), 'https://x/v1/chat/completions'); }); test('已带完整路径原样用', () { expect(build('https://x/v1/chat/completions').toString(), 'https://x/v1/chat/completions'); }); }