import 'package:flutter/material.dart'; import 'package:flutter_test/flutter_test.dart'; import 'package:manager/core/theme/app_theme.dart'; import 'package:manager/core/widgets/empty_state.dart'; void main() { testWidgets('renders title/message and invokes the action callback', (tester) async { var tapped = false; await tester.pumpWidget( MaterialApp( theme: AppTheme.light(), home: Scaffold( body: EmptyState( icon: Icons.layers_outlined, title: 'No services yet', message: 'Scan a compose folder to discover services.', actionLabel: 'Scan now', onAction: () => tapped = true, ), ), ), ); expect(find.text('No services yet'), findsOneWidget); expect(find.text('Scan a compose folder to discover services.'), findsOneWidget); await tester.tap(find.widgetWithText(OutlinedButton, 'Scan now')); await tester.pump(); expect(tapped, isTrue); }); testWidgets('omits the action button when none is given', (tester) async { await tester.pumpWidget( MaterialApp( theme: AppTheme.light(), home: const Scaffold( body: EmptyState(icon: Icons.inbox_outlined, title: 'Nothing here'), ), ), ); expect(find.byType(OutlinedButton), findsNothing); }); }