From c38f5af5acfc38444b00ed716755c241d297216a Mon Sep 17 00:00:00 2001 From: Tom graham Date: Thu, 9 Jan 2025 14:32:28 +1100 Subject: [PATCH] Fixed tests. --- mobile/test/fixtures/album.stub.dart | 8 ++++++-- mobile/test/services/album.service_test.dart | 10 +++------- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/mobile/test/fixtures/album.stub.dart b/mobile/test/fixtures/album.stub.dart index e820f193d5..d57b876bd7 100644 --- a/mobile/test/fixtures/album.stub.dart +++ b/mobile/test/fixtures/album.stub.dart @@ -26,7 +26,9 @@ final class AlbumStub { shared: true, activityEnabled: false, endDate: DateTime(2020), - )..sharedUsers.addAll([UserStub.admin]); + ) + ..sharedUsers.addAll([UserStub.admin]) + ..owner.value = UserStub.user2; static final oneAsset = Album( name: "album-with-single-asset", @@ -38,7 +40,9 @@ final class AlbumStub { activityEnabled: false, startDate: DateTime(2020), endDate: DateTime(2023), - )..assets.addAll([AssetStub.image1]); + ) + ..assets.addAll([AssetStub.image1]) + ..owner.value = UserStub.user1; static final twoAsset = Album( name: "album-with-two-assets", diff --git a/mobile/test/services/album.service_test.dart b/mobile/test/services/album.service_test.dart index c0775a1c3e..6decf72e1e 100644 --- a/mobile/test/services/album.service_test.dart +++ b/mobile/test/services/album.service_test.dart @@ -84,11 +84,8 @@ void main() { group('refreshRemoteAlbums', () { test('is working', () async { when(() => userService.refreshUsers()).thenAnswer((_) async => true); - when(() => albumApiRepository.getAll(shared: true)) - .thenAnswer((_) async => [AlbumStub.sharedWithUser]); - - when(() => albumApiRepository.getAll(shared: null)) - .thenAnswer((_) async => [AlbumStub.oneAsset, AlbumStub.twoAsset]); + when(() => albumApiRepository.getAll()) + .thenAnswer((_) async => [AlbumStub.oneAsset, AlbumStub.twoAsset, AlbumStub.sharedWithUser]); when( () => syncService.syncRemoteAlbumsToDb([ @@ -100,8 +97,7 @@ void main() { final result = await sut.refreshRemoteAlbums(); expect(result, true); verify(() => userService.refreshUsers()).called(1); - verify(() => albumApiRepository.getAll(shared: true)).called(1); - verify(() => albumApiRepository.getAll(shared: null)).called(1); + verify(() => albumApiRepository.getAll()).called(1); verify( () => syncService.syncRemoteAlbumsToDb( [