Some checks failed
Security / Security check (push) Failing after 2s
The detail sheet always answers 'who maintains this?': one selectable line per maintainer from the store index's new maintainers list, or an honest 'not specified' when the index names nobody (StoreMaintainersSection, public for the widget tests). The install trust gate carries the same fact when present and stays terse otherwise. DE+EN; dialog-harness proof captured with the maintainer row. Signed-off-by: flemming-it <stefan.a.flemming@googlemail.com>
97 lines
2.8 KiB
Dart
97 lines
2.8 KiB
Dart
// Maintainer transparency in the store (decision-maker finding
|
|
// class): the detail sheet always answers "who maintains this?" —
|
|
// with the index's list, or an honest "not specified" — and the
|
|
// install trust gate carries the same fact when present.
|
|
|
|
import 'package:flutter/material.dart';
|
|
import 'package:flutter_test/flutter_test.dart';
|
|
|
|
import 'package:chain_studio/data/hub.dart';
|
|
import 'package:chain_studio/l10n/app_localizations.dart';
|
|
import 'package:chain_studio/pages/store.dart' show StoreMaintainersSection;
|
|
import 'package:chain_studio/widgets/chain_install_confirm.dart';
|
|
|
|
Widget _host(Widget child) => MaterialApp(
|
|
localizationsDelegates: AppLocalizations.localizationsDelegates,
|
|
supportedLocales: AppLocalizations.supportedLocales,
|
|
locale: const Locale('de'),
|
|
home: Scaffold(body: SingleChildScrollView(child: child)),
|
|
);
|
|
|
|
StoreItem _item({List<String> maintainers = const []}) => StoreItem(
|
|
name: 'text.extract',
|
|
taglineEn: '',
|
|
taglineDe: '',
|
|
descriptionEn: '',
|
|
descriptionDe: '',
|
|
category: 'text',
|
|
tags: const [],
|
|
requiresCapabilities: const [],
|
|
requiresServices: const [],
|
|
license: 'Apache-2.0',
|
|
repository: '',
|
|
bestVersion: '0.1.0',
|
|
status: 'alpha',
|
|
installed: false,
|
|
featured: false,
|
|
iconUrl: '',
|
|
screenshotUrls: const [],
|
|
docsUrl: '',
|
|
kind: 'native',
|
|
provider: '',
|
|
source: 'bundled',
|
|
maintainers: maintainers,
|
|
);
|
|
|
|
void main() {
|
|
testWidgets('lists every maintainer on its own selectable line', (
|
|
tester,
|
|
) async {
|
|
await tester.pumpWidget(
|
|
_host(
|
|
const StoreMaintainersSection(
|
|
maintainers: [
|
|
'Jane Doe (Example Org) <a@example.org>',
|
|
'John Roe <b@example.org>',
|
|
],
|
|
),
|
|
),
|
|
);
|
|
expect(
|
|
find.text('Jane Doe (Example Org) <a@example.org>'),
|
|
findsOneWidget,
|
|
);
|
|
expect(find.text('John Roe <b@example.org>'), findsOneWidget);
|
|
expect(find.text('nicht angegeben'), findsNothing);
|
|
});
|
|
|
|
testWidgets('an empty list renders the honest fallback', (tester) async {
|
|
await tester.pumpWidget(
|
|
_host(const StoreMaintainersSection(maintainers: [])),
|
|
);
|
|
expect(find.text('MAINTAINER'), findsOneWidget);
|
|
expect(find.text('nicht angegeben'), findsOneWidget);
|
|
});
|
|
|
|
testWidgets('the trust gate names the maintainers when present', (
|
|
tester,
|
|
) async {
|
|
await tester.pumpWidget(
|
|
_host(
|
|
ChainInstallConfirmDialog(
|
|
item: _item(maintainers: ['Jane Doe <a@example.org>']),
|
|
),
|
|
),
|
|
);
|
|
await tester.pumpAndSettle();
|
|
expect(find.text('Jane Doe <a@example.org>'), findsOneWidget);
|
|
});
|
|
|
|
testWidgets('the trust gate stays terse without maintainer data', (
|
|
tester,
|
|
) async {
|
|
await tester.pumpWidget(_host(ChainInstallConfirmDialog(item: _item())));
|
|
await tester.pumpAndSettle();
|
|
expect(find.text('Maintainer'), findsNothing);
|
|
});
|
|
}
|