mirror of
https://github.com/kuhyx/diet-guard.git
synced 2026-11-20 09:52:29 +01:00
Flutter 3.50 deprecates package:flutter/material.dart; 73 deprecation infos failed flutter analyze --fatal-infos, and four Dart pins were behind (crdt_sync_flutter 0.8.2, flutter_local_notifications 23.0.2, github_device_auth 0.5.0, sync_settings_ui 0.8.2). Those UI packages now sit on material_ui, so the app has to as well or their widgets lose MaterialLocalizations. Imports swap one-for-one and dart fix re-sorted the directives; no behaviour change. analyze is clean and all six test shards pass. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01WzxdWWfb63jncj9Lca2jeX
59 lines
1.9 KiB
Dart
59 lines
1.9 KiB
Dart
import 'package:diet_guard_app/models/day_status.dart';
|
|
import 'package:diet_guard_app/widgets/streak_summary_row.dart';
|
|
import 'package:material_ui/material_ui.dart';
|
|
import 'package:flutter_test/flutter_test.dart';
|
|
import '../label_finders.dart';
|
|
|
|
Widget _wrap(Widget child) => MaterialApp(home: Scaffold(body: child));
|
|
|
|
void main() {
|
|
group('StreakSummaryRow', () {
|
|
testWidgets('renders plural streak counts', (tester) async {
|
|
await tester.pumpWidget(
|
|
_wrap(
|
|
const StreakSummaryRow(
|
|
loggingStreak: 3,
|
|
adherenceStreak: 2,
|
|
tally: YtdTally(loggedDays: 10, elapsedDays: 14, adherentDays: 8),
|
|
),
|
|
),
|
|
);
|
|
expect(find.text('3'), findsWidgets);
|
|
expect(byIconLabel('Logging streak'), findsOneWidget);
|
|
expect(byIconLabel('Adherence streak'), findsOneWidget);
|
|
expect(find.text('10/14'), findsOneWidget);
|
|
expect(find.text('8'), findsOneWidget);
|
|
});
|
|
|
|
testWidgets('renders singular streak counts', (tester) async {
|
|
await tester.pumpWidget(
|
|
_wrap(
|
|
const StreakSummaryRow(
|
|
loggingStreak: 1,
|
|
adherenceStreak: 1,
|
|
tally: YtdTally(loggedDays: 1, elapsedDays: 1, adherentDays: 1),
|
|
),
|
|
),
|
|
);
|
|
expect(find.text('1'), findsWidgets);
|
|
expect(byIconLabel('Logging streak'), findsOneWidget);
|
|
expect(byIconLabel('Adherence streak'), findsOneWidget);
|
|
});
|
|
|
|
testWidgets('renders zero streaks', (tester) async {
|
|
await tester.pumpWidget(
|
|
_wrap(
|
|
const StreakSummaryRow(
|
|
loggingStreak: 0,
|
|
adherenceStreak: 0,
|
|
tally: YtdTally(loggedDays: 0, elapsedDays: 5, adherentDays: 0),
|
|
),
|
|
),
|
|
);
|
|
expect(find.text('0'), findsWidgets);
|
|
expect(byIconLabel('Logging streak'), findsOneWidget);
|
|
expect(byIconLabel('Adherence streak'), findsOneWidget);
|
|
});
|
|
});
|
|
}
|