refactor(mobile): split store into repo and service (#16199)

* refactor(mobile): migrate store

* refactor(mobile): expand abbreviations

* chore(mobile): fix lint

---------

Co-authored-by: shenlong-tanwen <139912620+shalong-tanwen@users.noreply.github.com>
Co-authored-by: Alex <alex.tran1502@gmail.com>
This commit is contained in:
shenlong 2025-02-20 00:35:24 +05:30 committed by GitHub
parent 8634c59850
commit aeb3e0a84f
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
33 changed files with 582 additions and 287 deletions

View file

@ -1,10 +1,13 @@
import 'package:flutter/widgets.dart';
import 'package:flutter_test/flutter_test.dart';
import 'package:immich_mobile/entities/store.entity.dart';
import 'package:immich_mobile/domain/services/store.service.dart';
import 'package:immich_mobile/infrastructure/repositories/store.repository.dart';
import 'package:immich_mobile/models/auth/auxilary_endpoint.model.dart';
import 'package:immich_mobile/services/auth.service.dart';
import 'package:isar/isar.dart';
import 'package:mocktail/mocktail.dart';
import 'package:openapi/api.dart';
import '../repository.mocks.dart';
import '../service.mocks.dart';
import '../test_utils.dart';
@ -15,6 +18,7 @@ void main() {
late MockAuthRepository authRepository;
late MockApiService apiService;
late MockNetworkService networkService;
late Isar db;
setUp(() async {
authApiRepository = MockAuthApiRepository();
@ -32,12 +36,18 @@ void main() {
registerFallbackValue(Uri());
});
setUpAll(() async {
db = await TestUtils.initIsar();
db.writeTxnSync(() => db.clearSync());
await StoreService.init(storeRepository: IsarStoreRepository(db));
});
group('validateServerUrl', () {
setUpAll(() async {
WidgetsFlutterBinding.ensureInitialized();
final db = await TestUtils.initIsar();
db.writeTxnSync(() => db.clearSync());
Store.init(db);
await StoreService.init(storeRepository: IsarStoreRepository(db));
});
test('Should resolve HTTP endpoint', () async {