screen-locker/stronglift_replacement/workout_app/test/fake_run_uploader.dart
Krzysztof kuhy Rudnicki 66e9948777 WIP run screen
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

Claude-Session: https://claude.ai/code/session_01WzxdWZ9CKZsNxtD5Jr9bYD
2026-11-10 16:12:59 +01:00

29 lines
798 B
Dart

/// A queue whose state the test sets by hand.
library;
import 'package:flutter/foundation.dart';
import 'package:workout_app/services/run_uploader.dart';
/// Stands in for [RunUploader] where a widget only reads its state.
class FakeRunUploader extends RunUploader {
/// Creates a fake queue at [initial].
FakeRunUploader([
RunUploadStatus initial = const RunUploadStatus(UploadHealth.idle, 0),
]) : state = ValueNotifier(initial);
/// The state the badge listens to; assign `.value` to change it.
final ValueNotifier<RunUploadStatus> state;
/// How many times a pass was requested.
int passes = 0;
@override
ValueListenable<RunUploadStatus> get status => state;
@override
Future<RunUploadStatus> uploadPending() async {
passes++;
return state.value;
}
}