import 'package:chain_studio/data/hub.dart'; import 'package:chain_studio/data/store_caps.dart'; import 'package:flutter_test/flutter_test.dart'; StoreItem _item( String name, { String status = 'published', String kind = 'native', List requires = const [], }) { return StoreItem( name: name, taglineEn: '', taglineDe: '', descriptionEn: '', descriptionDe: '', category: 'data', tags: const [], requiresCapabilities: requires, requiresServices: const [], license: 'Apache-2.0', repository: '', bestVersion: '1.0.0', status: status, installed: false, featured: false, iconUrl: '', screenshotUrls: const [], docsUrl: '', kind: kind, provider: '', ); } void main() { group('installableStoreCapabilities', () { test('published and alpha entries are installable by name', () { final caps = installableStoreCapabilities([ _item('text.extract'), _item('text.anonymize', status: 'alpha'), ]); expect(caps, {'text.extract', 'text.anonymize'}); }); test('required capabilities of an entry are NOT installable', () { // The repro class behind "no store entry for '/'": // a capability that only appears as some entry's requirement // must never be offered as an install target. final caps = installableStoreCapabilities([ _item( 'doc.pipeline', requires: ['example-provider/tool.summarize', 'llm.generate'], ), ]); expect(caps, {'doc.pipeline'}); expect(caps.contains('example-provider/tool.summarize'), isFalse); expect(caps.contains('llm.generate'), isFalse); }); test('planned entries have nothing to download and are excluded', () { final caps = installableStoreCapabilities([ _item('web.scrape', status: 'planned'), ]); expect(caps, isEmpty); }); test('federated entries do not use the bundle-install path', () { final caps = installableStoreCapabilities([ _item('mcp.files.read', kind: 'federated'), ]); expect(caps, isEmpty); }); test('empty status (older hub) keeps the entry installable', () { final caps = installableStoreCapabilities([_item('debug.echo', status: '')]); expect(caps, {'debug.echo'}); }); }); }