π End-to-end encrypted cloud for everything.
Dart 2faandroidauthye2eeencryptionend-to-end-encryptionfluttergolanggoogle-photosgoogle-photos-alternativeiosopensourcephotosprivacyprivacy-toolstypescriptzero-knowledge
Remove changelog tests
ashilknc3d755f7319b
diff --git a/mobile/apps/photos/lib/services/update_service.dart b/mobile/apps/photos/lib/services/update_service.dartindex 8637357e25..de9c5808fb 100644--- a/mobile/apps/photos/lib/services/update_service.dart+++ b/mobile/apps/photos/lib/services/update_service.dart@@ -23,27 +23,10 @@ class UpdateService {final _logger = Logger("UpdateService");final PackageInfo _packageInfo;final SharedPreferences _prefs;- final bool _isAndroid;- final bool Function(Locale locale, bool isLocalGallery, bool isAndroid)- _hasChangeLogContent;-- UpdateService(- SharedPreferences prefs,- PackageInfo packageInfo, {- bool? isAndroid,- bool Function(Locale locale, bool isLocalGallery, bool isAndroid)?- hasChangeLogContent,- }) : _prefs = prefs,- _packageInfo = packageInfo,- _isAndroid = isAndroid ?? Platform.isAndroid,- _hasChangeLogContent =- hasChangeLogContent ??- ((locale, isLocalGallery, isAndroid) =>- ChangeLogStrings.hasContentForLocale(- locale,- isLocalGallery: isLocalGallery,- isAndroid: isAndroid,- )) {++ UpdateService(SharedPreferences prefs, PackageInfo packageInfo)+ : _prefs = prefs,+ _packageInfo = packageInfo {debugPrint("UpdateService constructor");}@@ -70,7 +53,11 @@ class UpdateService {return ChangeLogAction.skip;}- return _hasChangeLogContent(locale, isLocalGallery, _isAndroid)+ return ChangeLogStrings.hasContentForLocale(+ locale,+ isLocalGallery: isLocalGallery,+ isAndroid: Platform.isAndroid,+ )? ChangeLogAction.show: ChangeLogAction.consumeWithoutShowing;}diff --git a/mobile/apps/photos/test/services/update_service_test.dart b/mobile/apps/photos/test/services/update_service_test.dartdeleted file mode 100644index 5b86ffdee0..0000000000--- a/mobile/apps/photos/test/services/update_service_test.dart+++ /dev/null@@ -1,122 +0,0 @@-import 'dart:ui';--import 'package:flutter_test/flutter_test.dart';-import 'package:package_info_plus/package_info_plus.dart';-import 'package:photos/services/update_service.dart';-import 'package:shared_preferences/shared_preferences.dart';--void main() {- TestWidgetsFlutterBinding.ensureInitialized();-- test('fresh installs consume the current sheet without showing it', () async {- final service = await _serviceWithPreferences({});-- expect(- await service.getChangeLogAction(- locale: const Locale('en'),- isLocalGallery: false,- isSignedIn: true,- ),- ChangeLogAction.skip,- );- final prefs = await SharedPreferences.getInstance();- expect(- prefs.getInt(UpdateService.changeLogVersionKey),- UpdateService.currentChangeLogVersion,- );- });-- test('already consumed sheets are skipped', () async {- final service = await _serviceWithPreferences({- UpdateService.changeLogVersionKey: UpdateService.currentChangeLogVersion,- });-- expect(- await service.getChangeLogAction(- locale: const Locale('en'),- isLocalGallery: false,- isSignedIn: true,- ),- ChangeLogAction.skip,- );- });-- test(- 'outdated signed-in and Local Gallery installs show the sheet',- () async {- for (final mode in [- (isLocalGallery: false, isSignedIn: true),- (isLocalGallery: true, isSignedIn: false),- ]) {- final service = await _serviceWithPreferences({- UpdateService.changeLogVersionKey:- UpdateService.currentChangeLogVersion - 1,- });-- expect(- await service.getChangeLogAction(- locale: const Locale('en'),- isLocalGallery: mode.isLocalGallery,- isSignedIn: mode.isSignedIn,- ),- ChangeLogAction.show,- );- }- },- );-- test('outdated unauthenticated installs skip the sheet', () async {- final service = await _serviceWithPreferences({- UpdateService.changeLogVersionKey:- UpdateService.currentChangeLogVersion - 1,- });-- expect(- await service.getChangeLogAction(- locale: const Locale('en'),- isLocalGallery: false,- isSignedIn: false,- ),- ChangeLogAction.skip,- );- });-- test(- 'outdated installs consume a sheet with no applicable content',- () async {- final service = await _serviceWithPreferences({- UpdateService.changeLogVersionKey:- UpdateService.currentChangeLogVersion - 1,- }, hasChangeLogContent: (_, _, _) => false);-- expect(- await service.getChangeLogAction(- locale: const Locale('en'),- isLocalGallery: true,- isSignedIn: false,- ),- ChangeLogAction.consumeWithoutShowing,- );- },- );-}--Future<UpdateService> _serviceWithPreferences(- Map<String, Object> values, {- bool Function(Locale locale, bool isLocalGallery, bool isAndroid)?- hasChangeLogContent,-}) async {- SharedPreferences.setMockInitialValues(values);- final prefs = await SharedPreferences.getInstance();- return UpdateService(- prefs,- PackageInfo(- appName: 'Ente Photos',- packageName: 'io.ente.photos',- version: '1.3.64',- buildNumber: '2158',- ),- isAndroid: false,- hasChangeLogContent: hasChangeLogContent,- );-}diff --git a/mobile/apps/photos/test/ui/notification/update/change_log_strings_test.dart b/mobile/apps/photos/test/ui/notification/update/change_log_strings_test.dartdeleted file mode 100644index 646461f896..0000000000--- a/mobile/apps/photos/test/ui/notification/update/change_log_strings_test.dart+++ /dev/null@@ -1,135 +0,0 @@-import 'dart:ui';--import 'package:flutter_test/flutter_test.dart';-import 'package:photos/locale.dart';-import 'package:photos/ui/notification/update/change_log_strings.dart';--void main() {- test('resolves exact, language-only, and English fallback locales', () {- final portuguese = ChangeLogStrings.maybeForLocale(- const Locale('pt', 'BR'),- isAndroid: true,- );- final german = ChangeLogStrings.maybeForLocale(- const Locale('de'),- isAndroid: true,- );- final regionalGerman = ChangeLogStrings.maybeForLocale(- const Locale('de', 'DE'),- isAndroid: true,- );- final fallback = ChangeLogStrings.maybeForLocale(- const Locale('xx'),- isAndroid: true,- );-- expect(portuguese, isNotNull);- expect(german, isNotNull);- expect(- regionalGerman!.entries.map((entry) => entry.title),- german!.entries.map((entry) => entry.title),- );- expect(fallback!.entries.first.title, 'Preview strip in the viewer');- });-- test('filters the English sheet by platform and app mode', () {- final signedInAndroid = ChangeLogStrings.maybeForLocale(- const Locale('en'),- isAndroid: true,- )!;- final signedInIOS = ChangeLogStrings.maybeForLocale(- const Locale('en'),- isAndroid: false,- )!;- final localGalleryAndroid = ChangeLogStrings.maybeForLocale(- const Locale('en'),- isLocalGallery: true,- isAndroid: true,- )!;- final localGalleryIOS = ChangeLogStrings.maybeForLocale(- const Locale('en'),- isLocalGallery: true,- isAndroid: false,- )!;-- expect(signedInAndroid.entries.map((entry) => entry.title), [- 'Preview strip in the viewer',- 'Share photos of a person',- 'Set photos as wallpaper',- 'Hold for 2Γ playback',- 'And more!',- ]);- expect(signedInIOS.entries.map((entry) => entry.title), [- 'Preview strip in the viewer',- 'Share photos of a person',- 'Hold for 2Γ playback',- 'And more!',- ]);- expect(localGalleryAndroid.entries.map((entry) => entry.title), [- 'Preview strip in the viewer',- 'Set photos as wallpaper',- 'Hold for 2Γ playback',- 'And more!',- ]);- expect(localGalleryIOS.entries.map((entry) => entry.title), [- 'Preview strip in the viewer',- 'Hold for 2Γ playback',- 'And more!',- ]);- expect(signedInIOS.entries.last.description, contains('improved backups'));- expect(- localGalleryIOS.entries.last.description,- isNot(contains('backups')),- );- });-- test('returns null when filtering removes every entry', () {- const onlineOnly = ChangeLogStrings(- entries: [- ChangeLogEntryStrings(- title: 'Online feature',- description: 'Only available to signed-in users.',- isOnlineOnly: true,- ),- ],- );-- expect(- onlineOnly.forAudience(isLocalGallery: true, isAndroid: true),- isNull,- );- });-- test('every supported locale preserves platform and audience structure', () {- for (final locale in appSupportedLocales) {- expect(- ChangeLogStrings.maybeForLocale(locale, isAndroid: true)!.entries,- hasLength(5),- reason: '$locale signed-in Android',- );- expect(- ChangeLogStrings.maybeForLocale(locale, isAndroid: false)!.entries,- hasLength(4),- reason: '$locale signed-in iOS',- );- expect(- ChangeLogStrings.maybeForLocale(- locale,- isLocalGallery: true,- isAndroid: true,- )!.entries,- hasLength(4),- reason: '$locale Local Gallery Android',- );- expect(- ChangeLogStrings.maybeForLocale(- locale,- isLocalGallery: true,- isAndroid: false,- )!.entries,- hasLength(3),- reason: '$locale Local Gallery iOS',- );- }- });-}