From ee9295ec0adbe2f78d29b175fbcfab9b85a4e43b Mon Sep 17 00:00:00 2001 From: Kiril Ivonchik Date: Tue, 1 Aug 2023 18:07:08 +0200 Subject: [PATCH] chore: test fixes --- example/pubspec.lock | 8 -------- lib/src/data/repositories/suggestion_repository.dart | 3 ++- test/presentation/cubits/suggestions_cubit_test.dart | 11 +++++------ 3 files changed, 7 insertions(+), 15 deletions(-) diff --git a/example/pubspec.lock b/example/pubspec.lock index 04c43a3..a894061 100644 --- a/example/pubspec.lock +++ b/example/pubspec.lock @@ -208,14 +208,6 @@ packages: url: "https://pub.dev" source: hosted version: "6.0.5" - rxdart: - dependency: transitive - description: - name: rxdart - sha256: "0c7c0cedd93788d996e33041ffecda924cc54389199cde4e6a34b440f50044cb" - url: "https://pub.dev" - source: hosted - version: "0.27.7" sky_engine: dependency: transitive description: flutter diff --git a/lib/src/data/repositories/suggestion_repository.dart b/lib/src/data/repositories/suggestion_repository.dart index 26acc2c..711ac06 100644 --- a/lib/src/data/repositories/suggestion_repository.dart +++ b/lib/src/data/repositories/suggestion_repository.dart @@ -19,7 +19,8 @@ class SuggestionRepositoryImpl implements SuggestionRepository { SimpleBehaviorSubject>([]); @override - Stream> get suggestionsStream => _suggestionsSubject.stream(); + Stream> get suggestionsStream => + _suggestionsSubject.stream(); @override List get suggestions => _suggestionsSubject.value; diff --git a/test/presentation/cubits/suggestions_cubit_test.dart b/test/presentation/cubits/suggestions_cubit_test.dart index d4186a6..a54a8c7 100644 --- a/test/presentation/cubits/suggestions_cubit_test.dart +++ b/test/presentation/cubits/suggestions_cubit_test.dart @@ -1,8 +1,8 @@ import 'package:bloc_test/bloc_test.dart'; import 'package:flutter_test/flutter_test.dart'; import 'package:mockito/mockito.dart'; -import 'package:rxdart/rxdart.dart'; import 'package:suggest_a_feature/src/domain/entities/suggestion.dart'; +import 'package:suggest_a_feature/src/domain/utils/simple_behavior_subject.dart'; import 'package:suggest_a_feature/src/presentation/di/injector.dart'; import 'package:suggest_a_feature/src/presentation/pages/suggestions/suggestions_cubit.dart'; import 'package:suggest_a_feature/src/presentation/pages/suggestions/suggestions_state.dart'; @@ -119,19 +119,18 @@ void main() { blocTest( 'vote requested suggestion', build: () { - final dataStream = BehaviorSubject.seeded([ + final dataStream = SimpleBehaviorSubject([ mockedRequestSuggestion, mockedRequestSuggestion2, ]); when(mockSuggestionRepository.suggestionsStream).thenAnswer( - (_) => dataStream, + (_) => dataStream.stream(), ); when(mockSuggestionRepository.upvote(any)).thenAnswer( - (_) async => dataStream.add( - [mockedRequestSuggestion, upvotedSuggestion], - ), + (_) async => + dataStream.value = [mockedRequestSuggestion, upvotedSuggestion], ); return SuggestionsCubit(