mirror of
https://github.com/kuhyx/screen-locker.git
synced 2026-11-22 23:02:21 +01:00
Cover home_screen navigation/resume flows toward 100%
Add widget tests for the manual-workout icon navigation, starting a workout (navigates to WorkoutScreen), and auto-resume of a saved active session. home_screen down to 4 uncovered lines. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01PM3auNTifaVgcXWDizZrjH
This commit is contained in:
parent
0d0e6e4481
commit
a5ea2ff206
@ -4,6 +4,8 @@ import 'package:sqflite_common_ffi/sqflite_ffi.dart';
|
|||||||
import 'package:workout_app/screens/home_screen.dart';
|
import 'package:workout_app/screens/home_screen.dart';
|
||||||
import 'package:workout_app/services/storage_service.dart';
|
import 'package:workout_app/services/storage_service.dart';
|
||||||
|
|
||||||
|
import '../fake_secure_storage.dart';
|
||||||
|
|
||||||
void main() {
|
void main() {
|
||||||
setUpAll(() {
|
setUpAll(() {
|
||||||
sqfliteFfiInit();
|
sqfliteFfiInit();
|
||||||
@ -83,4 +85,37 @@ void main() {
|
|||||||
await _pump(tester, _wrap());
|
await _pump(tester, _wrap());
|
||||||
expect(find.text('HTTP sync (no ADB needed)'), findsOneWidget);
|
expect(find.text('HTTP sync (no ADB needed)'), findsOneWidget);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
testWidgets('manual-workout icon navigates to the manual form', (tester) async {
|
||||||
|
installFakeSecureStorage(); // ManualWorkoutScreen loads its sync budget
|
||||||
|
await _pump(tester, _wrap());
|
||||||
|
await tester.tap(find.byIcon(Icons.edit_note));
|
||||||
|
await tester.pump();
|
||||||
|
await tester.pump(const Duration(milliseconds: 300));
|
||||||
|
expect(find.text('Log Manual Workout'), findsOneWidget);
|
||||||
|
});
|
||||||
|
|
||||||
|
testWidgets('starting a workout navigates to the workout screen',
|
||||||
|
(tester) async {
|
||||||
|
await _pump(tester, _wrap());
|
||||||
|
await tester.tap(find.text('Start Workout A'));
|
||||||
|
await tester.pump();
|
||||||
|
await tester.pump(const Duration(milliseconds: 300));
|
||||||
|
expect(find.textContaining('Workout A'), findsWidgets);
|
||||||
|
});
|
||||||
|
|
||||||
|
testWidgets('an active session auto-resumes into the workout screen',
|
||||||
|
(tester) async {
|
||||||
|
await tester.runAsync(
|
||||||
|
() => StorageService.instance.saveActiveSession({
|
||||||
|
'workoutType': 'A',
|
||||||
|
'startTime': DateTime.now().toIso8601String(),
|
||||||
|
'exercises': <dynamic>[],
|
||||||
|
}),
|
||||||
|
);
|
||||||
|
await _pump(tester, _wrap());
|
||||||
|
await tester.pump(const Duration(milliseconds: 300));
|
||||||
|
// The post-frame auto-resume pushed the workout screen.
|
||||||
|
expect(find.textContaining('Workout A'), findsWidgets);
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user