import 'package:nontonki/core/data/repositories/watch_history_repository.dart'; /// Records every history interaction so tests can assert on the key it used. class FakeWatchHistory implements WatchHistoryRepository { final List reads = []; final List writes = []; /// Position returned by [positionFor] when [failReads] is false. Duration? saved; /// Last episode returned by [lastEpisodeId]. String? lastEpisode; bool failReads = false; bool failWrites = false; @override Future positionFor( String profileId, String dramaId, String episodeId, ) async { reads.add('$profileId|$dramaId|$episodeId'); if (failReads) throw StateError('history unavailable'); return saved; } @override Future lastEpisodeId(String profileId, String dramaId) async { if (failReads) throw StateError('history unavailable'); return lastEpisode; } @override Future save( String profileId, String dramaId, String episodeId, Duration position, ) async { if (failWrites) throw StateError('history unavailable'); writes.add('$profileId|$dramaId|$episodeId|${position.inMilliseconds}'); } }