0
Fork 0
mirror of https://github.com/immich-app/immich.git synced 2025-01-21 00:52:43 -05:00

Fixed tests.

This commit is contained in:
Tom graham 2025-01-09 14:32:28 +11:00
parent 3a92fa896e
commit c38f5af5ac
2 changed files with 9 additions and 9 deletions

View file

@ -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",

View file

@ -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(
[