refactor(mobile): move timeline methods to timeline repo (#16526)

* refactor: move timeline calls to timeline repo

* refactor: review changes

---------

Co-authored-by: shenlong-tanwen <139912620+shalong-tanwen@users.noreply.github.com>
This commit is contained in:
shenlong 2025-03-03 20:40:09 +05:30 committed by GitHub
parent 3d6a6f77a8
commit 4db8f0c666
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
12 changed files with 64 additions and 61 deletions

View file

@ -2,6 +2,7 @@ import 'package:flutter_test/flutter_test.dart';
import 'package:immich_mobile/entities/backup_album.entity.dart';
import 'package:immich_mobile/services/album.service.dart';
import 'package:mocktail/mocktail.dart';
import '../fixtures/album.stub.dart';
import '../fixtures/asset.stub.dart';
import '../fixtures/user.stub.dart';
@ -83,7 +84,9 @@ void main() {
group('refreshRemoteAlbums', () {
test('is working', () async {
when(() => userService.refreshUsers()).thenAnswer((_) async => true);
when(() => userService.getUsersFromServer()).thenAnswer((_) async => []);
when(() => syncService.syncUsersFromServer(any()))
.thenAnswer((_) async => true);
when(() => albumApiRepository.getAll(shared: true))
.thenAnswer((_) async => [AlbumStub.sharedWithUser]);
@ -99,7 +102,8 @@ void main() {
).thenAnswer((_) async => true);
final result = await sut.refreshRemoteAlbums();
expect(result, true);
verify(() => userService.refreshUsers()).called(1);
verify(() => userService.getUsersFromServer()).called(1);
verify(() => syncService.syncUsersFromServer([])).called(1);
verify(() => albumApiRepository.getAll(shared: true)).called(1);
verify(() => albumApiRepository.getAll(shared: null)).called(1);
verify(