mirror of
https://github.com/immich-app/immich.git
synced 2025-03-31 21:29:38 +02:00
Fixed tests.
This commit is contained in:
parent
3a92fa896e
commit
c38f5af5ac
2 changed files with 9 additions and 9 deletions
mobile/test
8
mobile/test/fixtures/album.stub.dart
vendored
8
mobile/test/fixtures/album.stub.dart
vendored
|
@ -26,7 +26,9 @@ final class AlbumStub {
|
||||||
shared: true,
|
shared: true,
|
||||||
activityEnabled: false,
|
activityEnabled: false,
|
||||||
endDate: DateTime(2020),
|
endDate: DateTime(2020),
|
||||||
)..sharedUsers.addAll([UserStub.admin]);
|
)
|
||||||
|
..sharedUsers.addAll([UserStub.admin])
|
||||||
|
..owner.value = UserStub.user2;
|
||||||
|
|
||||||
static final oneAsset = Album(
|
static final oneAsset = Album(
|
||||||
name: "album-with-single-asset",
|
name: "album-with-single-asset",
|
||||||
|
@ -38,7 +40,9 @@ final class AlbumStub {
|
||||||
activityEnabled: false,
|
activityEnabled: false,
|
||||||
startDate: DateTime(2020),
|
startDate: DateTime(2020),
|
||||||
endDate: DateTime(2023),
|
endDate: DateTime(2023),
|
||||||
)..assets.addAll([AssetStub.image1]);
|
)
|
||||||
|
..assets.addAll([AssetStub.image1])
|
||||||
|
..owner.value = UserStub.user1;
|
||||||
|
|
||||||
static final twoAsset = Album(
|
static final twoAsset = Album(
|
||||||
name: "album-with-two-assets",
|
name: "album-with-two-assets",
|
||||||
|
|
|
@ -84,11 +84,8 @@ void main() {
|
||||||
group('refreshRemoteAlbums', () {
|
group('refreshRemoteAlbums', () {
|
||||||
test('is working', () async {
|
test('is working', () async {
|
||||||
when(() => userService.refreshUsers()).thenAnswer((_) async => true);
|
when(() => userService.refreshUsers()).thenAnswer((_) async => true);
|
||||||
when(() => albumApiRepository.getAll(shared: true))
|
when(() => albumApiRepository.getAll())
|
||||||
.thenAnswer((_) async => [AlbumStub.sharedWithUser]);
|
.thenAnswer((_) async => [AlbumStub.oneAsset, AlbumStub.twoAsset, AlbumStub.sharedWithUser]);
|
||||||
|
|
||||||
when(() => albumApiRepository.getAll(shared: null))
|
|
||||||
.thenAnswer((_) async => [AlbumStub.oneAsset, AlbumStub.twoAsset]);
|
|
||||||
|
|
||||||
when(
|
when(
|
||||||
() => syncService.syncRemoteAlbumsToDb([
|
() => syncService.syncRemoteAlbumsToDb([
|
||||||
|
@ -100,8 +97,7 @@ void main() {
|
||||||
final result = await sut.refreshRemoteAlbums();
|
final result = await sut.refreshRemoteAlbums();
|
||||||
expect(result, true);
|
expect(result, true);
|
||||||
verify(() => userService.refreshUsers()).called(1);
|
verify(() => userService.refreshUsers()).called(1);
|
||||||
verify(() => albumApiRepository.getAll(shared: true)).called(1);
|
verify(() => albumApiRepository.getAll()).called(1);
|
||||||
verify(() => albumApiRepository.getAll(shared: null)).called(1);
|
|
||||||
verify(
|
verify(
|
||||||
() => syncService.syncRemoteAlbumsToDb(
|
() => syncService.syncRemoteAlbumsToDb(
|
||||||
[
|
[
|
||||||
|
|
Loading…
Add table
Reference in a new issue