fix(flows): only offer install for capabilities the store resolves
Some checks are pending
Security / Security check (push) Waiting to run
Some checks are pending
Security / Security check (push) Waiting to run
The capability set behind the flow editor's Install quick-fix and the flow list's install badge ingested every store entry's requiresCapabilities (dependencies, not provided capabilities) and ignored entry status/kind. Clicking Install on such a capability ended in the hub's "no store entry for '<name>'" error. The set now mirrors the hub's install resolver (entry names only, no planned or federated entries) via installableStoreCapabilities() with unit tests for both classification states. Unresolvable capabilities render the editor's 'not in store' state, which explains the three recovery paths before any click; the editor pin moves to 0.25.0 (commit-pinned until its tag exists) and the dialog harness captures the badge states light+dark. Studio 0.78.0. Signed-off-by: flemming-it <stefan.a.flemming@googlemail.com>
This commit is contained in:
parent
bef2dbe988
commit
08227410e6
8 changed files with 203 additions and 16 deletions
|
|
@ -16,6 +16,9 @@ import 'package:flutter_test/flutter_test.dart';
|
|||
import 'package:integration_test/integration_test.dart';
|
||||
import 'package:shared_preferences/shared_preferences.dart';
|
||||
|
||||
import 'package:chain_studio_flow_editor/src/l10n.dart';
|
||||
import 'package:chain_studio_flow_editor/src/widgets/missing_modules_badge.dart';
|
||||
|
||||
import 'package:chain_studio/data/hub.dart' show StoreItem;
|
||||
import 'package:chain_studio/l10n/app_localizations.dart';
|
||||
import 'package:chain_studio/pages/federation.dart';
|
||||
|
|
@ -104,6 +107,65 @@ void main() {
|
|||
});
|
||||
}
|
||||
|
||||
// Flow-list resolvability badge, both classified states side by
|
||||
// side: store-resolvable missing capability (amber chip +
|
||||
// Install link) vs. capability no store can install (quiet
|
||||
// "nicht im Store" chip; recovery paths live in its tooltip).
|
||||
for (final (themeName, mode) in [
|
||||
('light', ThemeMode.light),
|
||||
('dark', ThemeMode.dark),
|
||||
]) {
|
||||
testWidgets('flow-list badge states — $themeName', (tester) async {
|
||||
SharedPreferences.setMockInitialValues({});
|
||||
await tester.pumpWidget(
|
||||
MaterialApp(
|
||||
debugShowCheckedModeBanner: false,
|
||||
themeMode: mode,
|
||||
theme: ThemeData.light(useMaterial3: true),
|
||||
darkTheme: ThemeData.dark(useMaterial3: true),
|
||||
localizationsDelegates: AppLocalizations.localizationsDelegates,
|
||||
supportedLocales: AppLocalizations.supportedLocales,
|
||||
locale: const Locale('de'),
|
||||
builder: (context, child) =>
|
||||
RepaintBoundary(key: _shotKey, child: child),
|
||||
home: Scaffold(
|
||||
body: Center(
|
||||
child: ConstrainedBox(
|
||||
constraints: const BoxConstraints(maxWidth: 260),
|
||||
child: Column(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
MissingModulesBadge(
|
||||
installable: const ['text.extract'],
|
||||
notInStore: const [],
|
||||
strings:
|
||||
const FlowEditorStrings(FlowEditorLocale.de),
|
||||
onInstall: () {},
|
||||
),
|
||||
const SizedBox(height: 16),
|
||||
MissingModulesBadge(
|
||||
installable: const [],
|
||||
notInStore: const ['acme.internal/lookup'],
|
||||
strings:
|
||||
const FlowEditorStrings(FlowEditorLocale.de),
|
||||
onInstall: null,
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
await tester.pump(const Duration(milliseconds: 200));
|
||||
await _shot(tester, 'flow-badge-states-$themeName');
|
||||
expect(find.text('1 Modul fehlt'), findsOneWidget);
|
||||
expect(find.text('Installieren'), findsOneWidget);
|
||||
expect(find.text('nicht im Store'), findsOneWidget);
|
||||
});
|
||||
}
|
||||
|
||||
// Trust gate with the hub-reported verification statement — the
|
||||
// pinned-key (good) and policy-off (warning) variants.
|
||||
for (final (name, verification) in [
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue