import 'package:flutter/material.dart'; import 'package:flutter_test/flutter_test.dart'; import 'package:manager/core/theme/app_theme.dart'; import 'package:manager/core/theme/status_colors.dart'; import 'package:manager/core/widgets/stat_tile.dart'; void main() { testWidgets('renders label, value, qualifier and caption', (tester) async { await tester.pumpWidget( MaterialApp( theme: AppTheme.light(), home: const Scaffold( body: StatTile( label: 'Services', value: '7', valueQualifier: '/ 9 up', caption: '1 down · 1 unknown', severity: Severity.critical, ), ), ), ); expect(find.text('Services'), findsOneWidget); expect(find.textContaining('7'), findsOneWidget); expect(find.textContaining('/ 9 up'), findsOneWidget); expect(find.text('1 down · 1 unknown'), findsOneWidget); }); testWidgets('severity stripe color matches the resolved status color', (tester) async { final key = GlobalKey(); await tester.pumpWidget( MaterialApp( theme: AppTheme.light(), home: Scaffold( body: StatTile(key: key, label: 'X', value: '1', severity: Severity.critical), ), ), ); final context = key.currentContext!; final statusColors = Theme.of(context).extension()!; final stripe = tester.widgetList(find.byType(Container)).firstWhere( (c) => c.color == statusColors.critical, orElse: () => throw StateError('No stripe container with critical color found'), ); expect(stripe.color, statusColors.critical); }); }