From 4ac416dd2e4f75ad7c43137f9f92d72e94eb5f23 Mon Sep 17 00:00:00 2001 From: Frederik Bendix Date: Wed, 6 Dec 2023 17:38:23 +0100 Subject: [PATCH] Started writing new unit test for deleteweekmodel, but it is not done yet --- test/blocs/weekplans_bloc_test.dart | 20 +++++++++++++++----- 1 file changed, 15 insertions(+), 5 deletions(-) diff --git a/test/blocs/weekplans_bloc_test.dart b/test/blocs/weekplans_bloc_test.dart index bc68a7043..015c49ccc 100644 --- a/test/blocs/weekplans_bloc_test.dart +++ b/test/blocs/weekplans_bloc_test.dart @@ -263,7 +263,6 @@ void main() { test('Check deletion of a weekmodel from WeekModels', async((DoneFn done) { - when(() => weekApi.get( mockUser.id!, weekNameModel1.weekYear!, weekNameModel1.weekNumber!)) .thenAnswer( @@ -272,16 +271,25 @@ void main() { when(() => weekApi.getNames(mockUser.id!)).thenAnswer((_) => rx_dart.BehaviorSubject>.seeded(weekNameModelList)); - bloc.load(mockUser); - + bloc.weekNameModels.listen((List? response) { - bloc.weekModels.listen((List? response) { - expect(response, isNull); }); + /* + when(() => weekApi.get( + mockUser.id!, weekNameModel1.weekYear!, weekNameModel1.weekNumber!)) + .thenAnswer( + (_) => rx_dart.BehaviorSubject.seeded(weekModel1)); + + when(() => weekApi.getNames(mockUser.id!)).thenAnswer((_) => + rx_dart.BehaviorSubject>.seeded(weekNameModelList)); + */ + bloc.load(mockUser); + + done(); @@ -291,6 +299,8 @@ void main() { + + test('Checks if the edit mode toggles from true', async((DoneFn done) { /// Edit mode stream initial value is false. bloc.toggleEditMode();