import 'package:flutter_test/flutter_test.dart'; import 'package:halkyon_app/assistant_models.dart'; import 'package:halkyon_llm/halkyon_llm.dart' show LlmProtocol; void main() { test("links the terms of the providers it knows, by their API's host", () { expect( providerTermsOf('api.anthropic.com'), Uri.parse('https://www.anthropic.com/legal/commercial-terms'), ); expect( providerTermsOf('API.OpenAI.com'), Uri.parse('https://openai.com/policies/services-agreement/'), ); expect( providerTermsOf('generativelanguage.googleapis.com'), Uri.parse('https://ai.google.dev/gemini-api/terms'), ); expect( providerTermsOf('openrouter.ai'), Uri.parse('https://openrouter.ai/terms'), ); }); test('links nothing for another host, which is named alone', () { expect(providerTermsOf('api.mistral.ai'), isNull); expect(providerTermsOf('192.168.1.20'), isNull); expect(providerTermsOf('anthropic.com.example.org'), isNull); }); test('knows an own assistant on this machine, never one elsewhere', () { OwnAssistant at(String? baseUrl) => OwnAssistant( id: 'own', name: 'Mine', protocol: LlmProtocol.openai, baseUrl: baseUrl, model: 'm', apiKey: '', ); expect(at('http://localhost:11434/v1').onThisMachine, isTrue); expect(at('http://192.168.1.20:11434/v1').onThisMachine, isFalse); expect(at(null).onThisMachine, isFalse); }); }