feat(app): show template stage counts

This commit is contained in:
2026-10-23 12:20:06 +01:00
parent c089ecd8af
commit 23b8ee8f7c
8 changed files with 117 additions and 19 deletions
@@ -31,10 +31,31 @@ void main() {
expect(find.byKey(templatesGalleryKey), findsOneWidget);
expect(find.text('Release workflow'), findsOneWidget);
expect(find.text('Ship a version'), findsOneWidget);
expect(find.text('2 stages'), findsNWidgets(2));
expect(find.text('(unnamed template)'), findsOneWidget);
expect(find.byKey(templatesLoadingKey), findsNothing);
});
testWidgets('stage count is unavailable when server parsing refuses', (
tester,
) async {
final gateway =
GalleryGateway((type, fields) async => templatesReply(galleryTemplates))
..validationHandler = (type, fields) async {
throw Exception('invalid definition');
};
await pumpGallery(tester, gateway);
expect(find.text('stage count unavailable'), findsNWidgets(2));
expect(find.text('0 stages'), findsNothing);
expect(gateway.callsOf('validate'), hasLength(2));
expect(
gateway.callsOf('validate').first.fields['source'],
galleryTemplates.first['source'],
);
});
testWidgets('an empty catalogue states it without inventing rows', (
tester,
) async {
@@ -148,7 +169,11 @@ void main() {
expect(selectableSource(source), findsOneWidget);
expect(selectableSource('release'), findsOneWidget);
expect(find.text(templateCreateActionLabel), findsOneWidget);
expect(gateway.callsOf('validate'), isEmpty);
expect(gateway.callsOf('validate'), hasLength(2));
expect(
gateway.callsOf('validate').map((call) => call.fields['source']),
everyElement(source),
);
expect(gateway.callsOf('submit'), isEmpty);
await tester.tap(find.byKey(templatesBackKey));