mirror of
https://github.com/immich-app/immich.git
synced 2025-07-17 20:38:25 +02:00
refactor(mobile): album api repository for album service (#12791)
* refactor(mobile): album api repository for album service
This commit is contained in:
parent
94fc1f213a
commit
3868736799
20 changed files with 751 additions and 223 deletions
mobile/test/modules/shared
|
@ -39,8 +39,10 @@ void main() {
|
|||
group('Test SyncService grouped', () {
|
||||
late final Isar db;
|
||||
final MockHashService hs = MockHashService();
|
||||
final MockEntityService entityService = MockEntityService();
|
||||
final MockAlbumMediaRepository albumMediaRepository =
|
||||
MockAlbumMediaRepository();
|
||||
final MockAlbumApiRepository albumApiRepository = MockAlbumApiRepository();
|
||||
final owner = User(
|
||||
id: "1",
|
||||
updatedAt: DateTime.now(),
|
||||
|
@ -48,6 +50,7 @@ void main() {
|
|||
name: "first last",
|
||||
isAdmin: false,
|
||||
);
|
||||
late SyncService s;
|
||||
setUpAll(() async {
|
||||
WidgetsFlutterBinding.ensureInitialized();
|
||||
db = await TestUtils.initIsar();
|
||||
|
@ -68,9 +71,15 @@ void main() {
|
|||
db.assets.clearSync();
|
||||
db.assets.putAllSync(initialAssets);
|
||||
});
|
||||
s = SyncService(
|
||||
db,
|
||||
hs,
|
||||
entityService,
|
||||
albumMediaRepository,
|
||||
albumApiRepository,
|
||||
);
|
||||
});
|
||||
test('test inserting existing assets', () async {
|
||||
SyncService s = SyncService(db, hs, albumMediaRepository);
|
||||
final List<Asset> remoteAssets = [
|
||||
makeAsset(checksum: "a", remoteId: "0-1"),
|
||||
makeAsset(checksum: "b", remoteId: "2-1"),
|
||||
|
@ -88,7 +97,6 @@ void main() {
|
|||
});
|
||||
|
||||
test('test inserting new assets', () async {
|
||||
SyncService s = SyncService(db, hs, albumMediaRepository);
|
||||
final List<Asset> remoteAssets = [
|
||||
makeAsset(checksum: "a", remoteId: "0-1"),
|
||||
makeAsset(checksum: "b", remoteId: "2-1"),
|
||||
|
@ -109,7 +117,6 @@ void main() {
|
|||
});
|
||||
|
||||
test('test syncing duplicate assets', () async {
|
||||
SyncService s = SyncService(db, hs, albumMediaRepository);
|
||||
final List<Asset> remoteAssets = [
|
||||
makeAsset(checksum: "a", remoteId: "0-1"),
|
||||
makeAsset(checksum: "b", remoteId: "1-1"),
|
||||
|
@ -157,7 +164,6 @@ void main() {
|
|||
});
|
||||
|
||||
test('test efficient sync', () async {
|
||||
SyncService s = SyncService(db, hs, albumMediaRepository);
|
||||
final List<Asset> toUpsert = [
|
||||
makeAsset(checksum: "a", remoteId: "0-1"), // changed
|
||||
makeAsset(checksum: "f", remoteId: "0-2"), // new
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue