π End-to-end encrypted cloud for everything.
Dart 2faandroidauthye2eeencryptionend-to-end-encryptionfluttergolanggoogle-photosgoogle-photos-alternativeiosopensourcephotosprivacyprivacy-toolstypescriptzero-knowledge
Prune more low-value tests
Manav Rathiaf2da7efacd2
diff --git a/cli/internal/api/login_type_test.go b/cli/internal/api/login_type_test.goindex 123ee9de17..fd19e3c042 100644--- a/cli/internal/api/login_type_test.go+++ b/cli/internal/api/login_type_test.go@@ -1,14 +1,9 @@package apiimport (- "context""encoding/json"- "net/http"- "net/http/httptest""strings""testing"-- "github.com/google/uuid")func TestAuthorizationResponseRequiresAccountsURLOnlyForPasskey(t *testing.T) {@@ -51,25 +46,3 @@ func TestAuthorizationResponseRequiresAccountsURLOnlyForPasskey(t *testing.T) {})}}--func TestVerifySRPSessionRejectsPasskeyResponseWithoutAccountsURL(t *testing.T) {- server := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {- if r.URL.Path != "/users/srp/verify-session" {- t.Fatalf("unexpected path: %s", r.URL.Path)- }- w.Header().Set("Content-Type", "application/json")- _, _ = w.Write([]byte(`{"id":1,"passkeySessionID":"passkey-session"}`))- }))- defer server.Close()-- client := NewClient(Params{Host: server.URL})- ctx := context.WithValue(t.Context(), "app", string(AppPhotos))-- _, err := client.VerifySRPSession(ctx, uuid.New(), uuid.New(), "client-m1")- if err == nil {- t.Fatal("expected response parsing to reject missing accounts URL")- }- if !strings.Contains(err.Error(), "accountsUrl is required") {- t.Fatalf("unexpected error: %v", err)- }-}diff --git a/cli/internal/crypto/crypto_test.go b/cli/internal/crypto/crypto_test.goindex b0a793f6f1..cead0f392f 100644--- a/cli/internal/crypto/crypto_test.go+++ b/cli/internal/crypto/crypto_test.go@@ -1,7 +1,6 @@package cryptoimport (- "crypto/rand""encoding/base64""testing")@@ -52,22 +51,6 @@ func TestDecryptChaCha20poly1305(t *testing.T) {}}-func TestEncryptAndDecryptChaCha20Ploy1305(t *testing.T) {- key := make([]byte, 32)- rand.Read(key)- cipher, nonce, err := EncryptChaCha20poly1305([]byte("plain_text"), key)- if err != nil {- return- }- plainText, err := decryptChaCha20poly1305(cipher, key, nonce)- if err != nil {- t.Fatalf("Failed to decrypt: %v", err)- }- if string(plainText) != "plain_text" {- t.Fatalf("Decrypted text : %s does not match the expected text: %s", string(plainText), "plain_text")- }-}-func TestSecretBoxOpenBase64(t *testing.T) {sealedCipherText := "KHwRN+RzvTu+jC7mCdkMsqnTPSLvevtZILmcR2OYFbIRPqDyjAl+m8KxD9B5fiEo"sealNonce := "jgfPDOsQh2VdIHWJVSBicMPF2sQW3HIY"diff --git a/cli/internal/promt_test.go b/cli/internal/promt_test.godeleted file mode 100644index cc663f1953..0000000000--- a/cli/internal/promt_test.go+++ /dev/null@@ -1,122 +0,0 @@-package internal--import (- "os"- "path/filepath"- "testing"-)--func TestResolvePath(t *testing.T) {- cwd, err := os.Getwd()- if err != nil {- t.Fatalf("Failed to get current working directory: %v", err)- }-- home, err := os.UserHomeDir()- if err != nil {- t.Fatalf("Failed to get home directory: %v", err)- }-- tests := []struct {- name string- input string- expected string- expectError bool- }{- {- name: "current directory dot",- input: ".",- expected: cwd,- expectError: false,- },- {- name: "tilde only",- input: "~",- expected: home,- expectError: false,- },- {- name: "tilde with slash",- input: "~/",- expected: home,- expectError: false,- },- {- name: "tilde with subdirectory",- input: "~/Documents",- expected: filepath.Join(home, "Documents"),- expectError: false,- },- {- name: "tilde with nested path",- input: "~/Documents/test/file.txt",- expected: filepath.Join(home, "Documents", "test", "file.txt"),- expectError: false,- },- {- name: "relative path",- input: "test/dir",- expected: filepath.Join(cwd, "test", "dir"),- expectError: false,- },- {- name: "parent directory",- input: "..",- expected: filepath.Dir(cwd),- expectError: false,- },- {- name: "parent with subdirectory",- input: "../sibling",- expected: filepath.Join(filepath.Dir(cwd), "sibling"),- expectError: false,- },- {- name: "cleaned path",- input: "/tmp/../test",- expected: "/test",- expectError: false,- },- {- name: "absolute path unchanged",- input: "/tmp/test",- expected: "/tmp/test",- expectError: false,- },- {- name: "empty string",- input: "",- expected: cwd,- expectError: false,- },- }-- for _, tt := range tests {- t.Run(tt.name, func(t *testing.T) {- result, err := ResolvePath(tt.input)-- if tt.expectError {- if err == nil {- t.Errorf("Expected error but got none")- }- return- }-- if err != nil {- t.Errorf("Unexpected error: %v", err)- return- }-- expectedClean := filepath.Clean(tt.expected)- resultClean := filepath.Clean(result)-- if resultClean != expectedClean {- t.Errorf("Expected %q, got %q", expectedClean, resultClean)- }-- if !filepath.IsAbs(result) {- t.Errorf("Result %q is not an absolute path", result)- }- })- }-}diff --git a/cli/pkg/disk_test.go b/cli/pkg/disk_test.godeleted file mode 100644index ccb5e5af1a..0000000000--- a/cli/pkg/disk_test.go+++ /dev/null@@ -1,30 +0,0 @@-package pkg--import (- "path/filepath"- "strings"- "testing"-)--func TestGenerateUniqueFileName(t *testing.T) {- existingFilenames := make(map[string]bool)- testFilename := "FullSizeRender.jpg"-- existingFilenames[strings.ToLower(testFilename)] = true-- a := &albumDiskInfo{- FileNames: &existingFilenames,- }-- extension := filepath.Ext(testFilename)- baseFileName := strings.TrimSuffix(filepath.Clean(filepath.Base(testFilename)), extension)-- for range 100 {- newFilename := a.GenerateUniqueFileName(baseFileName, extension)- if strings.Contains(newFilename, "_1_2") {- t.Fatalf("Filename contained _1_2")- } else {- existingFilenames[strings.ToLower(newFilename)] = true- }- }-}diff --git a/cli/pkg/model/filter_test.go b/cli/pkg/model/filter_test.goindex 50a8d32adb..fd28fcb900 100644--- a/cli/pkg/model/filter_test.go+++ b/cli/pkg/model/filter_test.go@@ -1,10 +1,8 @@package model-import (- "testing"-)+import "testing"-func TestFilter_excludeByName(t *testing.T) {+func TestFilterExcludeByName(t *testing.T) {tests := []struct {name stringfilter Filter@@ -12,77 +10,37 @@ func TestFilter_excludeByName(t *testing.T) {want bool}{{- name: "no filters - should not exclude",- filter: Filter{},- album: RemoteAlbum{AlbumName: "Vacation"},- want: false,- },- {- name: "album in Albums list - should not exclude",- filter: Filter{Albums: []string{"Vacation", "Family"}},- album: RemoteAlbum{AlbumName: "Vacation"},- want: false,- },- {- name: "album not in Albums list - should exclude",- filter: Filter{Albums: []string{"Vacation", "Family"}},- album: RemoteAlbum{AlbumName: "Work"},- want: true,- },- {- name: "album in Albums list case insensitive - should not exclude",+ name: "includes matching album without case or surrounding whitespace",filter: Filter{Albums: []string{"vacation"}},- album: RemoteAlbum{AlbumName: "Vacation"},- want: false,- },- {- name: "album with whitespace in Albums list - should not exclude",- filter: Filter{Albums: []string{"Vacation"}},album: RemoteAlbum{AlbumName: " Vacation "},- want: false,},{- name: "album in ExcludeAlbums list - should exclude",- filter: Filter{ExcludeAlbums: []string{"Work", "Private"}},+ name: "excludes album absent from include list",+ filter: Filter{Albums: []string{"Vacation"}},album: RemoteAlbum{AlbumName: "Work"},want: true,},{- name: "album not in ExcludeAlbums list - should not exclude",- filter: Filter{ExcludeAlbums: []string{"Work", "Private"}},- album: RemoteAlbum{AlbumName: "Vacation"},- want: false,- },- {- name: "album in ExcludeAlbums case insensitive - should exclude",+ name: "excludes matching album without case or surrounding whitespace",filter: Filter{ExcludeAlbums: []string{"work"}},- album: RemoteAlbum{AlbumName: "Work"},- want: true,- },- {- name: "album with whitespace in ExcludeAlbums - should exclude",- filter: Filter{ExcludeAlbums: []string{"Work"}},album: RemoteAlbum{AlbumName: " Work "},want: true,},{- name: "album in both Albums and ExcludeAlbums - ExcludeAlbums takes precedence",- filter: Filter{Albums: []string{"Vacation"}, ExcludeAlbums: []string{"Vacation"}},- album: RemoteAlbum{AlbumName: "Vacation"},- want: true,- },- {- name: "album in Albums but different one in ExcludeAlbums - should not exclude",- filter: Filter{Albums: []string{"Vacation", "Family"}, ExcludeAlbums: []string{"Work"}},- album: RemoteAlbum{AlbumName: "Vacation"},- want: false,+ name: "exclude list takes precedence",+ filter: Filter{+ Albums: []string{"Vacation"},+ ExcludeAlbums: []string{"Vacation"},+ },+ album: RemoteAlbum{AlbumName: "Vacation"},+ want: true,},}for _, tt := range tests {t.Run(tt.name, func(t *testing.T) {if got := tt.filter.excludeByName(tt.album); got != tt.want {- t.Errorf("Filter.excludeByName() = %v, want %v", got, tt.want)+ t.Fatalf("excludeByName() = %v, want %v", got, tt.want)}})}diff --git a/mobile/apps/auth/test/models/code_test.dart b/mobile/apps/auth/test/models/code_test.dartindex 79ce27b29b..1cb3fd826c 100644--- a/mobile/apps/auth/test/models/code_test.dart+++ b/mobile/apps/auth/test/models/code_test.dart@@ -33,12 +33,6 @@ void main() {expect(code.counter, 15);});- test("shareCodesSupport", () {- expect(Type.totp.canShareCodes, true);- expect(Type.steam.canShareCodes, true);- expect(Type.hotp.canShareCodes, false);- });-test("validateDisplay", () {Code code = Code.fromOTPAuthUrl("otpauth://hotp/[email protected]?secret=ASKZNWOU6SVYAMVS&issuer=GitHub&counter=15",diff --git a/mobile/apps/auth/test/onboarding/setup_enter_secret_key_page_test.dart b/mobile/apps/auth/test/onboarding/setup_enter_secret_key_page_test.dartindex b0c417615c..acfc80c2a3 100644--- a/mobile/apps/auth/test/onboarding/setup_enter_secret_key_page_test.dart+++ b/mobile/apps/auth/test/onboarding/setup_enter_secret_key_page_test.dart@@ -5,17 +5,6 @@ import 'package:flutter/material.dart';import 'package:flutter_test/flutter_test.dart';void main() {- test('new and short manual codes retain the entry limit', () {- expect(- SetupEnterSecretKeyPage.manualCodeTextLimitFor(null),- SetupEnterSecretKeyPage.manualCodeTextLimit,- );- expect(- SetupEnterSecretKeyPage.manualCodeTextLimitFor(_code()),- SetupEnterSecretKeyPage.manualCodeTextLimit,- );- });-test('legacy manual codes at the limit remain unrestricted', () {final boundaryValue = _repeated('a',diff --git a/mobile/apps/auth/test/ui/components/component_dialog_adapters_test.dart b/mobile/apps/auth/test/ui/components/component_dialog_adapters_test.dartdeleted file mode 100644index b16a849709..0000000000--- a/mobile/apps/auth/test/ui/components/component_dialog_adapters_test.dart+++ /dev/null@@ -1,155 +0,0 @@-import 'package:ente_auth/ui/components/action_sheet_widget.dart';-import 'package:ente_auth/ui/components/dialog_widget.dart';-import 'package:ente_auth/utils/dialog_util.dart';-import 'package:ente_components/ente_components.dart';-import 'package:ente_strings/ente_strings.dart';-import 'package:ente_ui/components/buttons/button_widget.dart';-import 'package:ente_ui/components/buttons/models/button_result.dart';-import 'package:ente_ui/components/buttons/models/button_type.dart';-import 'package:flutter/material.dart';-import 'package:flutter_test/flutter_test.dart';--void main() {- testWidgets('legacy action sheets render with Ente components', (- tester,- ) async {- await _pumpLauncher(- tester,- (context) => showActionSheet(- context: context,- title: 'Trash code?',- body: 'The code can be restored later.',- buttons: const [- ButtonWidget(- buttonType: ButtonType.critical,- labelText: 'Trash',- isInAlert: true,- buttonAction: ButtonAction.first,- ),- ButtonWidget(- buttonType: ButtonType.secondary,- labelText: 'Cancel',- isInAlert: true,- buttonAction: ButtonAction.cancel,- ),- ],- ),- );-- await _openLauncher(tester);-- expect(find.byType(BottomSheetComponent), findsOneWidget);- expect(find.byType(ButtonWidget), findsNothing);- expect(find.text('Trash code?'), findsOneWidget);- expect(find.text('The code can be restored later.'), findsOneWidget);- expect(find.text('Cancel'), findsNothing);- expect(find.byTooltip('Close'), findsOneWidget);- final button = tester.widget<ButtonComponent>(- find.widgetWithText(ButtonComponent, 'Trash'),- );- expect(button.variant, ButtonComponentVariant.critical);- });-- testWidgets('legacy dialog returns its component button action', (- tester,- ) async {- ButtonResult? result;- await _pumpLauncher(tester, (context) async {- result = await showDialogWidget(- context: context,- title: 'Continue?',- buttons: const [- ButtonWidget(- buttonType: ButtonType.neutral,- labelText: 'Continue',- isInAlert: true,- buttonAction: ButtonAction.first,- ),- ],- );- });-- await _openLauncher(tester);- expect(find.byType(BottomSheetComponent), findsOneWidget);- expect(find.byType(Dialog), findsNothing);-- await tester.tap(find.text('Continue'));- await tester.pumpAndSettle();-- expect(result?.action, ButtonAction.first);- expect(find.byType(BottomSheetComponent), findsNothing);- });-- testWidgets('text input dialogs use component input and submit button', (- tester,- ) async {- String? submittedValue;- await _pumpLauncher(- tester,- (context) => showTextInputDialog(- context,- title: 'Create tag',- submitButtonLabel: 'Create',- onSubmit: (value) async => submittedValue = value,- ),- );-- await _openLauncher(tester);-- expect(find.byType(BottomSheetComponent), findsOneWidget);- expect(find.byType(TextInputComponent), findsOneWidget);- expect(- tester- .widget<ButtonComponent>(- find.widgetWithText(ButtonComponent, 'Create'),- )- .isDisabled,- isTrue,- );-- await tester.enterText(find.byType(TextField), 'Work');- await tester.pump();- expect(- tester- .widget<ButtonComponent>(- find.widgetWithText(ButtonComponent, 'Create'),- )- .isDisabled,- isFalse,- );-- await tester.tap(find.text('Create'));- await tester.pumpAndSettle();-- expect(submittedValue, 'Work');- expect(find.byType(BottomSheetComponent), findsNothing);- });-}--Future<void> _pumpLauncher(- WidgetTester tester,- Future<dynamic> Function(BuildContext context) onOpen,-) {- return tester.pumpWidget(- MaterialApp(- theme: ComponentTheme.lightTheme(app: ComponentApp.auth),- localizationsDelegates: StringsLocalizations.localizationsDelegates,- supportedLocales: StringsLocalizations.supportedLocales,- home: Builder(- builder: (context) => Scaffold(- body: Center(- child: ElevatedButton(- onPressed: () => onOpen(context),- child: const Text('Open'),- ),- ),- ),- ),- ),- );-}--Future<void> _openLauncher(WidgetTester tester) async {- await tester.tap(find.text('Open'));- await tester.pumpAndSettle();-}diff --git a/mobile/apps/auth/test/ui/settings/data/import/import_page_test.dart b/mobile/apps/auth/test/ui/settings/data/import/import_page_test.dartindex 1d4415bf94..0497d126df 100644--- a/mobile/apps/auth/test/ui/settings/data/import/import_page_test.dart+++ b/mobile/apps/auth/test/ui/settings/data/import/import_page_test.dart@@ -5,34 +5,6 @@ import 'package:flutter/material.dart';import 'package:flutter_test/flutter_test.dart';void main() {- testWidgets(- 'import page uses a grouped source list with stable identifiers',- (tester) async {- await tester.pumpWidget(- MaterialApp(- theme: ComponentTheme.lightTheme(app: ComponentApp.auth),- localizationsDelegates: StringsLocalizations.localizationsDelegates,- supportedLocales: StringsLocalizations.supportedLocales,- home: const ImportCodePage(),- ),- );-- expect(find.text('Import codes'), findsOneWidget);- expect(find.byType(MenuGroupComponent), findsOneWidget);- expect(find.text('Plain text'), findsOneWidget);- expect(find.text('Ente encrypted export'), findsOneWidget);- expect(find.text('OTP Auth'), findsOneWidget);- expect(- find.byWidgetPredicate(- (widget) =>- widget is Semantics &&- widget.properties.identifier == 'auth_import_plainText',- ),- findsOneWidget,- );- },- );-testWidgets('plain text source opens an Ente instruction sheet', (tester,) async {diff --git a/mobile/apps/locker/test/utils/file_util_test.dart b/mobile/apps/locker/test/utils/file_util_test.dartindex aeb735a680..602047f94c 100644--- a/mobile/apps/locker/test/utils/file_util_test.dart+++ b/mobile/apps/locker/test/utils/file_util_test.dart@@ -63,25 +63,6 @@ void main() {expect(p.basename(handoffFile.path), 'file-123.pdf');});- test('uses UI display name with metadata-derived extension', () async {- final source = File(p.join(root.path, 'source.bin'));- await source.writeAsString('renamed file bytes');- final file = lockerFile(uploadedFileID: 456, title: 'passport.png');-- final handoffFile = await FileUtil.prepareOpenFileForTest(- source,- displayName: 'Front side',- lockerFile: file,- );-- expect(p.basename(handoffFile.path), 'Front side.png');- expect(await handoffFile.readAsString(), 'renamed file bytes');- expect(- cacheRelativePath(handoffFile),- startsWith(p.join('open_handoff', '456')),- );- });-test('creates distinct handoff paths for repeated same-file opens',() async {@@ -145,49 +126,6 @@ void main() {expect(handoffFile.path, isNot(staleLocalPath.path));});- test(- 'partitions handoff copies by uploaded file ID, not source path',- () async {- final source = File(p.join(root.path, 'shared-source.bin'));- final staleLocalPath = File(p.join(root.path, 'same-stale-local.txt'));- await source.writeAsString('shared source bytes');- await staleLocalPath.writeAsString('shared stale bytes');- final firstFile = lockerFile(- uploadedFileID: 111,- title: 'first.pdf',- localPath: staleLocalPath.path,- );- final secondFile = lockerFile(- uploadedFileID: 222,- title: 'second.pdf',- localPath: staleLocalPath.path,- );-- final firstHandoff = await FileUtil.prepareOpenFileForTest(- source,- displayName: 'Document',- lockerFile: firstFile,- );- final secondHandoff = await FileUtil.prepareOpenFileForTest(- source,- displayName: 'Document',- lockerFile: secondFile,- );-- expect(- cacheRelativePath(firstHandoff),- startsWith(p.join('open_handoff', '111')),- );- expect(- cacheRelativePath(secondHandoff),- startsWith(p.join('open_handoff', '222')),- );- expect(await firstHandoff.readAsString(), 'shared source bytes');- expect(await secondHandoff.readAsString(), 'shared source bytes');- expect(await staleLocalPath.readAsString(), 'shared stale bytes');- },- );-test('replaces stale display extension with Locker metadata extension',() async {@@ -206,24 +144,6 @@ void main() {},);- test(- 'keeps display extension when it already matches metadata extension',- () async {- final source = File(p.join(root.path, 'invoice.tmp'));- await source.writeAsString('invoice bytes');- final file = lockerFile(uploadedFileID: 655, title: 'invoice.pdf');-- final handoffFile = await FileUtil.prepareOpenFileForTest(- source,- displayName: 'Invoice.PDF',- lockerFile: file,- );-- expect(p.basename(handoffFile.path), 'Invoice.PDF');- expect(await handoffFile.readAsString(), 'invoice bytes');- },- );-test('falls back to source extension when metadata has no extension',() async {diff --git a/mobile/apps/photos/test/models/backup/backup_item_test.dart b/mobile/apps/photos/test/models/backup/backup_item_test.dartdeleted file mode 100644index 748b8d7aef..0000000000--- a/mobile/apps/photos/test/models/backup/backup_item_test.dart+++ /dev/null@@ -1,49 +0,0 @@-import 'package:flutter_test/flutter_test.dart';-import 'package:photos/models/backup/backup_item.dart';-import 'package:photos/models/backup/backup_item_status.dart';-import 'package:photos/models/file/file.dart';--void main() {- test('status transitions replace retry details', () {- final error = StateError('retry');- final retryItem = BackupItem(- status: BackupItemStatus.retry,- file: EnteFile(),- collectionID: 1,- error: error,- );-- const replacementError = Object();- expect(- retryItem- .withStatus(BackupItemStatus.retry, error: replacementError)- .error,- same(replacementError),- );- expect(retryItem.withStatus(BackupItemStatus.retry).error, isNull);- });-- test('non-retry statuses cannot retain an error', () {- final retryItem = BackupItem(- status: BackupItemStatus.retry,- file: EnteFile(),- collectionID: 1,- error: StateError('retry'),- );-- final uploadingItem = retryItem.withStatus(BackupItemStatus.uploading);-- expect(uploadingItem.error, isNull);- });-- test('normalizes an error on a non-retry item', () {- final item = BackupItem(- status: BackupItemStatus.uploading,- file: EnteFile(),- collectionID: 1,- error: StateError('unexpected'),- );-- expect(item.error, isNull);- });-}diff --git a/mobile/apps/photos/test/models/ml/face/person_contact_link_test.dart b/mobile/apps/photos/test/models/ml/face/person_contact_link_test.dartindex 7cc41ab8ec..18286b4b4e 100644--- a/mobile/apps/photos/test/models/ml/face/person_contact_link_test.dart+++ b/mobile/apps/photos/test/models/ml/face/person_contact_link_test.dart@@ -15,35 +15,6 @@ import "package:photos/utils/person_contact_linking_util.dart";import "package:shared_preferences/shared_preferences.dart";void main() {- group("PersonData contact link", () {- test("copyWith preserves link fields when omitted", () {- final data = PersonData(- name: "Alex",- email: "[email protected]",- userID: 7,- );-- final updated = data.copyWith(name: "Alex R");-- expect(updated.name, "Alex R");- expect(updated.email, "[email protected]");- expect(updated.userID, 7);- });-- test("copyWith clears email and userID", () {- final data = PersonData(- name: "Alex",- email: "[email protected]",- userID: 7,- );-- final updated = data.copyWith(email: null, userID: null);-- expect(updated.email, isNull);- expect(updated.userID, isNull);- });- });-group("PersonService contact link", () {late _FakeEntityService entityService;late _FakePhotosContactsService contactsService;@@ -166,18 +137,6 @@ void main() {expect(contactsService.lastUpdatedName, isNull);});- test("updateAttributes can skip linked contact name sync", () async {- final updated = await personService.updateAttributes(- "person-1",- name: "Alex R",- syncLinkedContactName: false,- );-- expect(updated.data.name, "Alex R");- expect(contactsService.createOrUpdateCalls, 0);- expect(contactsService.lastUpdatedName, isNull);- });-test("does not auto-create a contact without a configured person avatar",() async {diff --git a/mobile/apps/photos/test/services/free_space/deletion_batch_runner_test.dart b/mobile/apps/photos/test/services/free_space/deletion_batch_runner_test.dartindex 17725574a6..7069fcf51c 100644--- a/mobile/apps/photos/test/services/free_space/deletion_batch_runner_test.dart+++ b/mobile/apps/photos/test/services/free_space/deletion_batch_runner_test.dart@@ -2,21 +2,6 @@ import "package:flutter_test/flutter_test.dart";import "package:photos/services/free_space/deletion_batch_runner.dart";void main() {- test("distinguishes fallback-eligible and terminal failures", () {- const recoverableFailure = LocalDeletionResult(- status: LocalDeletionStatus.failed,- shouldTryNextFallback: true,- );- const terminalFailure = LocalDeletionResult(- status: LocalDeletionStatus.failed,- );-- expect(recoverableFailure.shouldTryNextFallback, isTrue);- expect(recoverableFailure.isTerminalFailure, isFalse);- expect(terminalFailure.shouldTryNextFallback, isFalse);- expect(terminalFailure.isTerminalFailure, isTrue);- });-test("stops after the first platform exception", () async {final attemptedBatches = <List<String>>[];diff --git a/mobile/apps/photos/test/services/memories/photo_selector_test.dart b/mobile/apps/photos/test/services/memories/photo_selector_test.dartindex 050208a5f5..cbc811aa0e 100644--- a/mobile/apps/photos/test/services/memories/photo_selector_test.dart+++ b/mobile/apps/photos/test/services/memories/photo_selector_test.dart@@ -80,203 +80,7 @@ FaceWithoutEmbedding _face(String faceID, int fileID) {}void main() {- group('PhotoSelector utilities', () {- test(- 'memoryFileId returns uploadedFileID when not in local gallery mode',- () {- final f = _file(uploadedFileID: 42, creationTime: _baseTime);- expect(- PhotoSelector.memoryFileId(f, isLocalGalleryMode: false),- equals(42),- );- },- );-- test('memoryFileId returns generatedID when in local gallery mode', () {- final f = _file(- uploadedFileID: 42,- creationTime: _baseTime,- generatedID: 99,- );- expect(- PhotoSelector.memoryFileId(f, isLocalGalleryMode: true),- equals(99),- );- });-- test('isTooCloseInTime detects gap < 10 minutes', () {- expect(- PhotoSelector.isTooCloseInTime(_baseTime, [- _baseTime + 5 * 60 * 1000000,- ]),- isTrue,- );- });-- test('isTooCloseInTime allows gap >= 10 minutes', () {- expect(- PhotoSelector.isTooCloseInTime(_baseTime, [- _baseTime + 15 * 60 * 1000000,- ]),- isFalse,- );- });-- test('isTooCloseInTime returns false for null creationTime', () {- expect(PhotoSelector.isTooCloseInTime(null, [_baseTime]), isFalse);- });-- test('isNearDuplicate detects similar embeddings', () {- final e1 = _emb(1, seed: 100);- final e2 = _nearDuplicateEmb(2, e1);- final map = _embMap([e1, e2]);- expect(PhotoSelector.isNearDuplicate(2, [1], map), isTrue);- });-- test('isNearDuplicate allows distinct embeddings', () {- final e1 = _emb(1, seed: 100);- final e2 = _emb(2, seed: 200);- final map = _embMap([e1, e2]);- expect(PhotoSelector.isNearDuplicate(2, [1], map), isFalse);- });-- test('filterNearDuplicates removes visually similar memories', () {- final e1 = _emb(1, seed: 100);- final e2 = _nearDuplicateEmb(2, e1);- final e3 = _emb(3, seed: 300);- final map = _embMap([e1, e2, e3]);- final memories = [- _mem(_file(uploadedFileID: 1, creationTime: _baseTime)),- _mem(_file(uploadedFileID: 2, creationTime: _baseTime + _hour)),- _mem(_file(uploadedFileID: 3, creationTime: _baseTime + 2 * _hour)),- ];- final result = PhotoSelector.filterNearDuplicates(- memories,- map,- isLocalGalleryMode: false,- );- final ids = result.map((m) => m.file.uploadedFileID).toList();- expect(ids, contains(1));- expect(ids, contains(3));- expect(ids, isNot(contains(2)));- });-- test('filterByTimeSpacing removes memories too close in time', () {- final memories = [- _mem(_file(uploadedFileID: 1, creationTime: _baseTime)),- _mem(- _file(uploadedFileID: 2, creationTime: _baseTime + 5 * 60 * 1000000),- ),- _mem(_file(uploadedFileID: 3, creationTime: _baseTime + _hour)),- ];- final result = PhotoSelector.filterByTimeSpacing(memories);- final ids = result.map((m) => m.file.uploadedFileID).toList();- expect(ids, equals([1, 3]));- });- });-group('PhotoSelector.bestSelection (single year)', () {- test('returns input when count <= targetSize', () async {- final memories = List.generate(5, (i) {- return _mem(- _file(uploadedFileID: i, creationTime: _baseTime + i * _hour),- );- });- final embeddings = memories- .map((m) => _emb(m.file.uploadedFileID!))- .toList();- final result = await PhotoSelector.bestSelection(- memories,- isLocalGalleryMode: false,- mlEnabled: true,- fileIdToFaces: {},- faceIDsToPersonID: {},- fileIDToImageEmbedding: _embMap(embeddings),- clipPositiveTextVector: _positiveTextVector,- );- expect(result.length, equals(5));- });-- test('limits output to targetSize', () async {- final memories = List.generate(20, (i) {- return _mem(- _file(uploadedFileID: i, creationTime: _baseTime + i * _hour),- );- });- final embeddings = memories- .map((m) => _emb(m.file.uploadedFileID!))- .toList();- final result = await PhotoSelector.bestSelection(- memories,- isLocalGalleryMode: false,- mlEnabled: true,- fileIdToFaces: {},- faceIDsToPersonID: {},- fileIDToImageEmbedding: _embMap(embeddings),- clipPositiveTextVector: _positiveTextVector,- );- expect(result.length, lessThanOrEqualTo(10));- });-- test('output is sorted chronologically (oldest first)', () async {- final memories = List.generate(20, (i) {- return _mem(- _file(uploadedFileID: i, creationTime: _baseTime + i * _hour),- );- });- final embeddings = memories- .map((m) => _emb(m.file.uploadedFileID!))- .toList();- final result = await PhotoSelector.bestSelection(- memories,- isLocalGalleryMode: false,- mlEnabled: true,- fileIdToFaces: {},- faceIDsToPersonID: {},- fileIDToImageEmbedding: _embMap(embeddings),- clipPositiveTextVector: _positiveTextVector,- );- for (int i = 1; i < result.length; i++) {- expect(- result[i].file.creationTime!,- greaterThanOrEqualTo(result[i - 1].file.creationTime!),- );- }- });-- test('no two selected photos are within minimumMemoryTimeGap', () async {- final memories = List.generate(30, (i) {- final offset = (i.isEven ? i * _hour : (i - 1) * _hour + 60000000);- return _mem(_file(uploadedFileID: i, creationTime: _baseTime + offset));- });- final embeddings = memories- .map((m) => _emb(m.file.uploadedFileID!))- .toList();- final result = await PhotoSelector.bestSelection(- memories,- isLocalGalleryMode: false,- mlEnabled: true,- fileIdToFaces: {},- faceIDsToPersonID: {},- fileIDToImageEmbedding: _embMap(embeddings),- clipPositiveTextVector: _positiveTextVector,- );- final minGapMicro = PhotoSelector.minimumMemoryTimeGap.inMicroseconds;- for (int i = 0; i < result.length; i++) {- for (int j = i + 1; j < result.length; j++) {- final gap =- (result[i].file.creationTime! - result[j].file.creationTime!)- .abs();- expect(- gap,- greaterThanOrEqualTo(minGapMicro),- reason:- 'Files ${result[i].file.uploadedFileID} and ${result[j].file.uploadedFileID} are too close in time ($gap us)',- );- }- }- });-test('skips no-ML time buckets that cannot satisfy the min-gap filter',() async {@@ -490,41 +294,6 @@ void main() {},);- test('output is sorted chronologically (oldest first)', () async {- final memories = <Memory>[];- final embeddings = <EmbeddingVector>[];- int id = 0;- for (final year in [2020, 2021, 2022]) {- for (int i = 0; i < 10; i++) {- final fileID = id++;- memories.add(- _mem(- _file(- uploadedFileID: fileID,- creationTime: _timeInYear(year, hours: i),- ),- ),- );- embeddings.add(_emb(fileID));- }- }- final result = await PhotoSelector.bestSelection(- memories,- isLocalGalleryMode: false,- mlEnabled: true,- fileIdToFaces: {},- faceIDsToPersonID: {},- fileIDToImageEmbedding: _embMap(embeddings),- clipPositiveTextVector: _positiveTextVector,- );- for (int i = 1; i < result.length; i++) {- expect(- result[i].file.creationTime!,- greaterThanOrEqualTo(result[i - 1].file.creationTime!),- );- }- });-test('round 0 does not filter duplicates (ensures year coverage)',() async {@@ -562,71 +331,9 @@ void main() {expect(yearsRepresented, contains(2022));},);-- test('no two selected photos are within minimumMemoryTimeGap', () async {- final memories = <Memory>[];- final embeddings = <EmbeddingVector>[];- int id = 0;- for (final year in [2020, 2021, 2022]) {- for (int i = 0; i < 10; i++) {- final fileID = id++;- final offset = i.isEven ? i * _hour : (i - 1) * _hour + 60000000;- memories.add(- _mem(- _file(- uploadedFileID: fileID,- creationTime: _timeInYear(year) + offset,- ),- ),- );- embeddings.add(_emb(fileID));- }- }- final result = await PhotoSelector.bestSelection(- memories,- isLocalGalleryMode: false,- mlEnabled: true,- fileIdToFaces: {},- faceIDsToPersonID: {},- fileIDToImageEmbedding: _embMap(embeddings),- clipPositiveTextVector: _positiveTextVector,- );- final minGapMicro = PhotoSelector.minimumMemoryTimeGap.inMicroseconds;- for (int i = 0; i < result.length; i++) {- for (int j = i + 1; j < result.length; j++) {- final gap =- (result[i].file.creationTime! - result[j].file.creationTime!)- .abs();- expect(- gap,- greaterThanOrEqualTo(minGapMicro),- reason:- 'Files ${result[i].file.uploadedFileID} and ${result[j].file.uploadedFileID} are too close in time',- );- }- }- });});group('PhotoSelector.bestSelectionPeople', () {- test('returns input when count <= targetSize', () async {- final memories = List.generate(5, (i) {- return _mem(- _file(uploadedFileID: i, creationTime: _baseTime + i * _hour),- );- });- final embeddings = memories- .map((m) => _emb(m.file.uploadedFileID!))- .toList();- final result = await PhotoSelector.bestSelectionPeople(- memories,- isLocalGalleryMode: false,- fileIDToImageEmbedding: _embMap(embeddings),- clipPositiveTextVector: _positiveTextVector,- );- expect(result.length, equals(5));- });-test('ignores unrelated embeddings when precomputing people scores',() async {@@ -651,91 +358,6 @@ void main() {},);- test('limits output to targetSize', () async {- final memories = List.generate(30, (i) {- return _mem(- _file(uploadedFileID: i, creationTime: _baseTime + i * _hour),- );- });- final embeddings = memories- .map((m) => _emb(m.file.uploadedFileID!))- .toList();- final result = await PhotoSelector.bestSelectionPeople(- memories,- isLocalGalleryMode: false,- fileIDToImageEmbedding: _embMap(embeddings),- clipPositiveTextVector: _positiveTextVector,- );- expect(result.length, lessThanOrEqualTo(10));- });-- test('respects custom preferredSize', () async {- final memories = List.generate(30, (i) {- return _mem(- _file(uploadedFileID: i, creationTime: _baseTime + i * _hour),- );- });- final embeddings = memories- .map((m) => _emb(m.file.uploadedFileID!))- .toList();- final result = await PhotoSelector.bestSelectionPeople(- memories,- prefferedSize: 5,- isLocalGalleryMode: false,- fileIDToImageEmbedding: _embMap(embeddings),- clipPositiveTextVector: _positiveTextVector,- );- expect(result.length, lessThanOrEqualTo(5));- });-- test('output is sorted reverse chronologically (newest first)', () async {- final memories = List.generate(30, (i) {- return _mem(- _file(uploadedFileID: i, creationTime: _baseTime + i * _hour),- );- });- final embeddings = memories- .map((m) => _emb(m.file.uploadedFileID!))- .toList();- final result = await PhotoSelector.bestSelectionPeople(- memories,- isLocalGalleryMode: false,- fileIDToImageEmbedding: _embMap(embeddings),- clipPositiveTextVector: _positiveTextVector,- );- for (int i = 1; i < result.length; i++) {- expect(- result[i].file.creationTime!,- lessThanOrEqualTo(result[i - 1].file.creationTime!),- );- }- });-- test('distributes selection across the time range', () async {- final memories = List.generate(30, (i) {- return _mem(- _file(uploadedFileID: i, creationTime: _baseTime + i * _hour),- );- });- final embeddings = memories- .map((m) => _emb(m.file.uploadedFileID!))- .toList();- final result = await PhotoSelector.bestSelectionPeople(- memories,- isLocalGalleryMode: false,- fileIDToImageEmbedding: _embMap(embeddings),- clipPositiveTextVector: _positiveTextVector,- );- final times = result.map((m) => m.file.creationTime!).toList()..sort();- final selectedRange = times.last - times.first;- const totalRange = 29 * _hour;- expect(- selectedRange,- greaterThan(totalRange * 0.6),- reason: 'Selected photos should be distributed across the time range',- );- });-test('prefers geographically diverse photos', () async {const nyLoc = Location(latitude: 40.7128, longitude: -74.0060);const tokyoLoc = Location(latitude: 35.6762, longitude: 139.6503);@@ -784,24 +406,6 @@ void main() {);});- test('handles photos without embeddings (littleEmbeddings path)', () async {- final memories = List.generate(20, (i) {- return _mem(- _file(uploadedFileID: i, creationTime: _baseTime + i * _hour),- );- });- // Three embeddings keep this below the 50% threshold.- final embeddings = [_emb(0), _emb(5), _emb(15)];- final result = await PhotoSelector.bestSelectionPeople(- memories,- isLocalGalleryMode: false,- fileIDToImageEmbedding: _embMap(embeddings),- clipPositiveTextVector: _positiveTextVector,- );- expect(result.length, greaterThan(0));- expect(result.length, lessThanOrEqualTo(10));- });-test('filters memories without creationTime', () async {final memories = <Memory>[_mem(_file(uploadedFileID: 0, creationTime: _baseTime)),@@ -833,157 +437,7 @@ void main() {});});- group('Deterministic equivalence (bestSelection)', () {- test('single-year: produces same output on repeated calls', () async {- final memories = List.generate(20, (i) {- return _mem(- _file(uploadedFileID: i, creationTime: _baseTime + i * _hour),- );- });- final embeddings = memories- .map((m) => _emb(m.file.uploadedFileID!))- .toList();- final embMap = _embMap(embeddings);-- // Run twice with fresh copies of memories list (since sort is in-place)- Future<List<int>> run() async {- final copy = memories- .map(- (m) => _mem(- _file(- uploadedFileID: m.file.uploadedFileID!,- creationTime: m.file.creationTime!,- ),- ),- )- .toList();- final result = await PhotoSelector.bestSelection(- copy,- isLocalGalleryMode: false,- mlEnabled: true,- fileIdToFaces: {},- faceIDsToPersonID: {},- fileIDToImageEmbedding: embMap,- clipPositiveTextVector: _positiveTextVector,- );- return result.map((m) => m.file.uploadedFileID!).toList();- }-- final run1 = await run();- final run2 = await run();- expect(run1, equals(run2));- });-- test('multi-year: produces same output on repeated calls', () async {- final memories = <Memory>[];- final embeddings = <EmbeddingVector>[];- int id = 0;- for (final year in [2020, 2021, 2022]) {- for (int i = 0; i < 10; i++) {- final fileID = id++;- memories.add(- _mem(- _file(- uploadedFileID: fileID,- creationTime: _timeInYear(year, hours: i),- ),- ),- );- embeddings.add(_emb(fileID));- }- }- final embMap = _embMap(embeddings);-- Future<List<int>> run() async {- final copy = memories- .map(- (m) => _mem(- _file(- uploadedFileID: m.file.uploadedFileID!,- creationTime: m.file.creationTime!,- ),- ),- )- .toList();- final result = await PhotoSelector.bestSelection(- copy,- isLocalGalleryMode: false,- mlEnabled: true,- fileIdToFaces: {},- faceIDsToPersonID: {},- fileIDToImageEmbedding: embMap,- clipPositiveTextVector: _positiveTextVector,- );- return result.map((m) => m.file.uploadedFileID!).toList();- }-- final run1 = await run();- final run2 = await run();- expect(run1, equals(run2));- });-- test(- 'bestSelectionPeople: produces same output on repeated calls',- () async {- final memories = List.generate(30, (i) {- return _mem(- _file(uploadedFileID: i, creationTime: _baseTime + i * _hour),- );- });- final embeddings = memories- .map((m) => _emb(m.file.uploadedFileID!))- .toList();- final embMap = _embMap(embeddings);-- Future<List<int>> run() async {- final copy = memories- .map(- (m) => _mem(- _file(- uploadedFileID: m.file.uploadedFileID!,- creationTime: m.file.creationTime!,- ),- ),- )- .toList();- final result = await PhotoSelector.bestSelectionPeople(- copy,- isLocalGalleryMode: false,- fileIDToImageEmbedding: embMap,- clipPositiveTextVector: _positiveTextVector,- );- return result.map((m) => m.file.uploadedFileID!).toList();- }-- final run1 = await run();- final run2 = await run();- expect(run1, equals(run2));- },- );- });-group('PhotoSelector.select (unified API)', () {- test('returns input when count <= targetSize', () async {- final memories = List.generate(5, (i) {- return _mem(- _file(uploadedFileID: i, creationTime: _baseTime + i * _hour),- );- });- final result = await PhotoSelector.select(- memories,- const SelectionConfig(- targetSize: 10,- isLocalGalleryMode: false,- fileIDToImageEmbedding: {},- scores: {},- distribution: SelectionDistribution.none,- pick: SelectionPick.ranked,- sort: SelectionSort.chronological,- ),- );- expect(result.length, equals(5));- });-test('flat distribution selects by score and respects targetSize',() async {@@ -1104,76 +558,5 @@ void main() {expect(yearsRepresented, contains(2021));expect(yearsRepresented, contains(2022));});-- test('chronological vs reverseChronological sort', () async {- final memories = List.generate(20, (i) {- return _mem(- _file(uploadedFileID: i, creationTime: _baseTime + i * _hour),- );- });- final embeddings = memories- .map((m) => _emb(m.file.uploadedFileID!))- .toList();- final embMap = _embMap(embeddings);- final scores = {- for (final e in embeddings) e.fileID: e.vector.dot(_positiveTextVector),- };-- final chronResult = await PhotoSelector.select(- List.of(- memories.map(- (m) => _mem(- _file(- uploadedFileID: m.file.uploadedFileID!,- creationTime: m.file.creationTime!,- ),- ),- ),- ),- SelectionConfig(- targetSize: 10,- isLocalGalleryMode: false,- fileIDToImageEmbedding: embMap,- scores: scores,- distribution: SelectionDistribution.none,- pick: SelectionPick.ranked,- sort: SelectionSort.chronological,- ),- );- for (int i = 1; i < chronResult.length; i++) {- expect(- chronResult[i].file.creationTime!,- greaterThanOrEqualTo(chronResult[i - 1].file.creationTime!),- );- }-- final revResult = await PhotoSelector.select(- List.of(- memories.map(- (m) => _mem(- _file(- uploadedFileID: m.file.uploadedFileID!,- creationTime: m.file.creationTime!,- ),- ),- ),- ),- SelectionConfig(- targetSize: 10,- isLocalGalleryMode: false,- fileIDToImageEmbedding: embMap,- scores: scores,- distribution: SelectionDistribution.none,- pick: SelectionPick.ranked,- sort: SelectionSort.reverseChronological,- ),- );- for (int i = 1; i < revResult.length; i++) {- expect(- revResult[i].file.creationTime!,- lessThanOrEqualTo(revResult[i - 1].file.creationTime!),- );- }- });});}diff --git a/mobile/apps/photos/test/services/memory_lane/memory_lane_selector_test.dart b/mobile/apps/photos/test/services/memory_lane/memory_lane_selector_test.dartindex 7c20bc0a5e..80791dde48 100644--- a/mobile/apps/photos/test/services/memory_lane/memory_lane_selector_test.dart+++ b/mobile/apps/photos/test/services/memory_lane/memory_lane_selector_test.dart@@ -290,39 +290,4 @@ void main() {expect(result["entries"], isNull);});});-- group("minimum eligible creation time", () {- test("returns null when birthdate missing", () {- expect(MemoryLaneService.minimumEligibleCreationTimeMicros(null), isNull);- expect(MemoryLaneService.minimumEligibleCreationTimeMicros(""), isNull);- });-- test("returns null for invalid birthdate string", () {- expect(- MemoryLaneService.minimumEligibleCreationTimeMicros("invalid"),- isNull,- );- });-- test("computes third birthday cutoff", () {- final birthDate = DateTime(2010, 6, 15);- final cutoff = MemoryLaneService.minimumEligibleCreationTimeMicros(- "2010-06-15",- );- final expected = DateTime(- birthDate.year + 3,- birthDate.month,- birthDate.day,- ).microsecondsSinceEpoch;- expect(cutoff, equals(expected));- });-- test("clamps day for leap birthdays", () {- final cutoff = MemoryLaneService.minimumEligibleCreationTimeMicros(- "2012-02-29",- );- final expected = DateTime(2015, 2, 28).microsecondsSinceEpoch;- expect(cutoff, equals(expected));- });- });}diff --git a/mobile/apps/photos/test/services/video_preview_service_test.dart b/mobile/apps/photos/test/services/video_preview_service_test.dartindex 1c3305fa59..46b5eccd15 100644--- a/mobile/apps/photos/test/services/video_preview_service_test.dart+++ b/mobile/apps/photos/test/services/video_preview_service_test.dart@@ -28,122 +28,8 @@ void main() {);});- group('calcStatus Logic Tests', () {- test('should handle mixed processed and unprocessed files', () async {- final files = [- EnteFile()- ..uploadedFileID = 1- ..fileType = FileType.video- ..pubMagicMetadata = PubMagicMetadata(),- EnteFile()- ..uploadedFileID = 2- ..fileType = FileType.video- ..pubMagicMetadata = PubMagicMetadata(),- EnteFile()- ..uploadedFileID = 3- ..fileType = FileType.video- ..pubMagicMetadata = PubMagicMetadata(),- ];-- final previewIds = <int, PreviewInfo>{- 2: PreviewInfo(objectId: 'obj2', objectSize: 1000),- };-- final status = await videoPreviewService.calcStatus(files, previewIds);-- expect(status, closeTo(0.33, 0.01));- });-- test('should handle all files processed', () async {- final files = [- EnteFile()- ..uploadedFileID = 1- ..fileType = FileType.video- ..pubMagicMetadata = PubMagicMetadata(),- EnteFile()- ..uploadedFileID = 2- ..fileType = FileType.video- ..pubMagicMetadata = PubMagicMetadata(),- ];-- final previewIds = <int, PreviewInfo>{- 1: PreviewInfo(objectId: 'obj1', objectSize: 1000),- 2: PreviewInfo(objectId: 'obj2', objectSize: 1000),- };-- final status = await videoPreviewService.calcStatus(files, previewIds);-- expect(status, equals(1.0));- });-- test('should handle no files processed', () async {- final files = [- EnteFile()- ..uploadedFileID = 1- ..fileType = FileType.video- ..pubMagicMetadata = PubMagicMetadata(),- EnteFile()- ..uploadedFileID = 2- ..fileType = FileType.video- ..pubMagicMetadata = PubMagicMetadata(),- ];-- final previewIds = <int, PreviewInfo>{};-- final status = await videoPreviewService.calcStatus(files, previewIds);-- expect(status, equals(0.0));- });-- test('should skip files with sv=1 from total count', () async {- final files = [- EnteFile()- ..uploadedFileID = 1- ..fileType = FileType.video- ..pubMagicMetadata = PubMagicMetadata(),- EnteFile()- ..uploadedFileID = 2- ..fileType = FileType.video- ..pubMagicMetadata = PubMagicMetadata(sv: 1),- EnteFile()- ..uploadedFileID = 3- ..fileType = FileType.video- ..pubMagicMetadata = PubMagicMetadata(),- ];-- final previewIds = <int, PreviewInfo>{};-- final status = await videoPreviewService.calcStatus(files, previewIds);-- expect(status, equals(0.0));- });-- test('should handle processed files with sv=1', () async {- final files = [- EnteFile()- ..uploadedFileID = 1- ..fileType = FileType.video- ..pubMagicMetadata = PubMagicMetadata(),- EnteFile()- ..uploadedFileID = 2- ..fileType = FileType.video- ..pubMagicMetadata = PubMagicMetadata(sv: 1),- EnteFile()- ..uploadedFileID = 3- ..fileType = FileType.video- ..pubMagicMetadata = PubMagicMetadata(),- ];-- final previewIds = <int, PreviewInfo>{- 2: PreviewInfo(objectId: 'obj2', objectSize: 1000),- };-- final status = await videoPreviewService.calcStatus(files, previewIds);-- expect(status, closeTo(0.33, 0.01));- });-- test('should handle empty file list', () async {+ group('calcStatus', () {+ test('reports completion when there are no files', () async {final files = <EnteFile>[];final previewIds = <int, PreviewInfo>{};@@ -152,7 +38,7 @@ void main() {expect(status, equals(1.0));});- test('should handle complex scenario', () async {+ test('excludes legacy files unless they already have previews', () async {final files = [EnteFile()..uploadedFileID = 1@@ -186,87 +72,6 @@ void main() {expect(status, equals(0.75));});-- test('should handle null pubMagicMetadata', () async {- final files = [- EnteFile()- ..uploadedFileID = 1- ..fileType = FileType.video- ..pubMagicMetadata = null,- EnteFile()- ..uploadedFileID = 2- ..fileType = FileType.video- ..pubMagicMetadata = PubMagicMetadata(),- ];-- final previewIds = <int, PreviewInfo>{- 1: PreviewInfo(objectId: 'obj1', objectSize: 1000),- };-- final status = await videoPreviewService.calcStatus(files, previewIds);-- expect(status, equals(0.5));- });-- test('should handle large numbers correctly', () async {- final files = List.generate(- 1000,- (index) => EnteFile()- ..uploadedFileID = index + 1- ..fileType = FileType.video- ..pubMagicMetadata = PubMagicMetadata(),- );-- final previewIds = <int, PreviewInfo>{};- for (int i = 1; i <= 750; i++) {- previewIds[i] = PreviewInfo(objectId: 'obj$i', objectSize: 1000);- }-- final status = await videoPreviewService.calcStatus(files, previewIds);-- expect(status, equals(0.75));- });-- test('should handle edge case - all files have sv=1', () async {- final files = [- EnteFile()- ..uploadedFileID = 1- ..fileType = FileType.video- ..pubMagicMetadata = PubMagicMetadata(sv: 1),- EnteFile()- ..uploadedFileID = 2- ..fileType = FileType.video- ..pubMagicMetadata = PubMagicMetadata(sv: 1),- ];-- final previewIds = <int, PreviewInfo>{- 1: PreviewInfo(objectId: 'obj1', objectSize: 1000),- 2: PreviewInfo(objectId: 'obj2', objectSize: 1000),- };-- final status = await videoPreviewService.calcStatus(files, previewIds);-- expect(status, equals(1.0));- });-- test('should handle percentage calculation precision', () async {- final files = List.generate(- 7,- (index) => EnteFile()- ..uploadedFileID = index + 1- ..fileType = FileType.video- ..pubMagicMetadata = PubMagicMetadata(),- );-- final previewIds = <int, PreviewInfo>{- 1: PreviewInfo(objectId: 'obj1', objectSize: 1000),- 2: PreviewInfo(objectId: 'obj2', objectSize: 1000),- };-- final status = await videoPreviewService.calcStatus(files, previewIds);-- expect(status, closeTo(0.2857, 0.0001));- });});}diff --git a/mobile/apps/photos/test/ui/actions/collection/collection_sharing_actions_test.dart b/mobile/apps/photos/test/ui/actions/collection/collection_sharing_actions_test.dartdeleted file mode 100644index 50fa5b1bef..0000000000--- a/mobile/apps/photos/test/ui/actions/collection/collection_sharing_actions_test.dart+++ /dev/null@@ -1,69 +0,0 @@-import "package:ente_components/ente_components.dart";-import "package:flutter/material.dart";-import "package:flutter_test/flutter_test.dart";-import "package:photos/ente_theme_data.dart";-import "package:ente_strings/ente_strings.dart";-import "package:photos/models/api/collection/user.dart";-import "package:photos/models/collection/collection.dart";-import "package:photos/services/collections_service.dart";-import "package:photos/ui/actions/collection/collection_sharing_actions.dart";-import "package:styled_text/styled_text.dart";--void main() {- group("CollectionActions", () {- testWidgets("album delete body uses light theme text colors", (- tester,- ) async {- await tester.pumpWidget(- MaterialApp(- theme: lightThemeData,- localizationsDelegates: StringsLocalizations.localizationsDelegates,- supportedLocales: StringsLocalizations.supportedLocales,- home: Scaffold(- body: Builder(- builder: (context) {- return TextButton(- onPressed: () async {- await CollectionActions(- CollectionsService.instance,- ).deleteMultipleCollectionSheet(context, [_collection()]);- },- child: const Text("Delete albums"),- );- },- ),- ),- ),- );-- await tester.tap(find.text("Delete albums"));- await tester.pumpAndSettle();-- final colors = ComponentTheme.colorsForApp(- ComponentApp.photos,- brightness: Brightness.light,- );- final body = tester.widget<StyledText>(find.byType(StyledText));- final boldTag = body.tags["bold"]! as StyledTextTag;- expect(body.style, TextStyles.body.copyWith(color: colors.textLight));- expect(boldTag.style, TextStyles.body.copyWith(color: colors.textBase));- });- });-}--Collection _collection() {- return Collection(- 1,- User(id: 1, email: "[email protected]"),- "",- null,- "Album",- null,- null,- CollectionType.album,- CollectionAttributes(),- const [],- const [],- 0,- );-}diff --git a/mobile/apps/photos/test/ui/components/action_sheet_widget_test.dart b/mobile/apps/photos/test/ui/components/action_sheet_widget_test.dartindex 42876e4143..78cc74467c 100644--- a/mobile/apps/photos/test/ui/components/action_sheet_widget_test.dart+++ b/mobile/apps/photos/test/ui/components/action_sheet_widget_test.dart@@ -10,51 +10,6 @@ import "package:photos/ui/components/models/button_type.dart";void main() {group("showActionSheet", () {- testWidgets("renders the compatibility sheet with ente components", (- tester,- ) async {- await _pumpLauncher(- tester,- (context) => showActionSheet(- context: context,- title: "Delete files?",- body: "Files will be moved to trash.",- bodyHighlight: "This applies to all albums.",- buttons: const [- ButtonWidget(- buttonType: ButtonType.neutral,- labelText: "Delete",- isInAlert: true,- buttonAction: ButtonAction.first,- ),- ButtonWidget(- buttonType: ButtonType.secondary,- labelText: "Cancel",- isInAlert: true,- buttonAction: ButtonAction.cancel,- ),- ],- ),- );-- await _openLauncher(tester);-- expect(find.byType(BottomSheetComponent), findsOneWidget);- _expectComponentScrim(tester);- expect(find.byType(ButtonComponent), findsOneWidget);- expect(find.byType(ButtonWidget), findsNothing);- final buttonComponents = tester- .widgetList<ButtonComponent>(find.byType(ButtonComponent))- .toList();- expect(buttonComponents[0].variant, ButtonComponentVariant.neutral);- expect(buttonComponents[0].size, ButtonComponentSize.large);- expect(find.text("Delete files?"), findsOneWidget);- expect(find.text("Files will be moved to trash."), findsOneWidget);- expect(find.text("This applies to all albums."), findsOneWidget);- expect(find.byTooltip("Close"), findsOneWidget);- expect(find.text("Cancel"), findsNothing);- });-testWidgets("returns the tapped button action", (tester) async {ButtonResult? result;@@ -219,67 +174,6 @@ void main() {expect(result?.exception, isA<Exception>());expect(find.byType(BottomSheetComponent), findsNothing);});-- testWidgets("renders custom body widgets and icon-only sheets", (- tester,- ) async {- await _pumpLauncher(- tester,- (context) => showActionSheet(- context: context,- title: "Done",- bodyWidget: const Text("Custom body"),- actionSheetType: ActionSheetType.iconOnly,- isCheckIconGreen: true,- buttons: const [- ButtonWidget(- buttonType: ButtonType.secondary,- labelText: "Close",- isInAlert: true,- buttonAction: ButtonAction.cancel,- ),- ],- ),- );-- await _openLauncher(tester);-- expect(find.byType(BottomSheetComponent), findsOneWidget);- expect(find.byIcon(Icons.check_outlined), findsOneWidget);- expect(find.text("Done"), findsOneWidget);- expect(find.text("Custom body"), findsNothing);- expect(find.text("Close"), findsOneWidget);- expect(find.byTooltip("Close"), findsNothing);- });-- testWidgets("centers body text for illustrated sheets", (tester) async {- await _pumpLauncher(- tester,- (context) => showActionSheet(- context: context,- title: "Warning",- body: "Are you sure?",- illustration: const SizedBox(width: 80, height: 80),- buttons: const [- ButtonWidget(- buttonType: ButtonType.critical,- labelText: "Yes",- isInAlert: true,- buttonAction: ButtonAction.first,- ),- ],- ),- );-- await _openLauncher(tester);-- final body = tester.widget<Text>(find.text("Are you sure?"));- final bodyBottom = tester.getBottomLeft(find.text("Are you sure?")).dy;- final buttonTop = tester.getTopLeft(find.byType(ButtonComponent)).dy;-- expect(body.textAlign, TextAlign.center);- expect(buttonTop - bodyBottom, 24);- });});}@@ -310,10 +204,3 @@ Future<void> _openLauncher(WidgetTester tester) async {await tester.tap(find.text("Open sheet"));await tester.pumpAndSettle();}--void _expectComponentScrim(WidgetTester tester) {- final barrierColors = tester- .widgetList<ModalBarrier>(find.byType(ModalBarrier))- .map((barrier) => barrier.color);- expect(barrierColors, contains(const Color.fromRGBO(0, 0, 0, 0.55)));-}diff --git a/mobile/apps/photos/test/ui/components/dialog_widget_test.dart b/mobile/apps/photos/test/ui/components/dialog_widget_test.dartindex 1d44dafd37..72fd8db134 100644--- a/mobile/apps/photos/test/ui/components/dialog_widget_test.dart+++ b/mobile/apps/photos/test/ui/components/dialog_widget_test.dart@@ -1,6 +1,5 @@import "package:ente_components/ente_components.dart";import "package:flutter/material.dart";-import "package:flutter/services.dart";import "package:flutter_test/flutter_test.dart";import "package:photos/ente_theme_data.dart";import "package:ente_strings/ente_strings.dart";@@ -8,59 +7,9 @@ import "package:photos/models/button_result.dart";import "package:photos/ui/components/buttons/button_widget.dart";import "package:photos/ui/components/dialog_widget.dart";import "package:photos/ui/components/models/button_type.dart";-import "package:photos/ui/components/text_input_widget.dart";-import "package:photos/utils/dialog_util.dart";void main() {group("showDialogWidget", () {- testWidgets("renders the compatibility sheet with ente components", (- tester,- ) async {- await _pumpLauncher(- tester,- (context) => showDialogWidget(- context: context,- title: "Invite",- body: "Share this invite with a friend.",- icon: Icons.info_outline,- buttons: const [- ButtonWidget(- buttonType: ButtonType.neutral,- labelText: "Send invite",- icon: Icons.share_outlined,- isInAlert: true,- buttonAction: ButtonAction.first,- ),- ButtonWidget(- buttonType: ButtonType.secondary,- labelText: "Cancel",- isInAlert: true,- buttonAction: ButtonAction.cancel,- ),- ],- ),- );-- await _openLauncher(tester);-- expect(find.byType(BottomSheetComponent), findsOneWidget);- _expectComponentScrim(tester);- expect(find.byType(ButtonComponent), findsOneWidget);- expect(find.byType(ButtonWidget), findsNothing);- expect(find.byType(Dialog), findsNothing);- expect(find.text("Invite"), findsOneWidget);- expect(find.text("Share this invite with a friend."), findsOneWidget);- expect(find.byIcon(Icons.info_outline), findsOneWidget);- expect(find.byIcon(Icons.share_outlined), findsOneWidget);- expect(find.byTooltip("Close"), findsOneWidget);- expect(find.text("Cancel"), findsNothing);- final button = tester.widget<ButtonComponent>(- find.widgetWithText(ButtonComponent, "Send invite"),- );- expect(button.variant, ButtonComponentVariant.neutral);- expect(button.leading, isNotNull);- });-testWidgets("returns the tapped button action", (tester) async {ButtonResult? result;@@ -181,38 +130,6 @@ void main() {expect(find.byType(BottomSheetComponent), findsNothing);});- testWidgets("returns an error result when the close callback throws", (- tester,- ) async {- ButtonResult? result;-- await _pumpLauncher(tester, (context) async {- result = await showDialogWidget(- context: context,- title: "Failure",- buttons: [- ButtonWidget(- buttonType: ButtonType.secondary,- labelText: "Cancel",- isInAlert: true,- buttonAction: ButtonAction.cancel,- onTap: () async {- throw StateError("boom");- },- ),- ],- );- });-- await _openLauncher(tester);- await tester.tap(find.byTooltip("Close"));- await tester.pumpAndSettle();-- expect(result?.action, ButtonAction.error);- expect(result?.exception, isA<Exception>());- expect(find.byType(BottomSheetComponent), findsNothing);- });-testWidgets("returns an error result when a button callback throws", (tester,) async {@@ -246,79 +163,7 @@ void main() {});});- testWidgets("showChoiceDialog uses the migrated dialog sheet", (- tester,- ) async {- ButtonResult? result;-- await _pumpLauncher(tester, (context) async {- result = await showChoiceDialog(- context,- title: "Remove item?",- body: "This can be restored later.",- firstButtonLabel: "Remove",- secondButtonLabel: "Keep",- isCritical: true,- );- });-- await _openLauncher(tester);-- expect(find.byType(BottomSheetComponent), findsOneWidget);- expect(find.byTooltip("Close"), findsNothing);- final removeButton = tester.widget<ButtonComponent>(- find.widgetWithText(ButtonComponent, "Remove"),- );- expect(removeButton.variant, ButtonComponentVariant.critical);-- await tester.tap(find.text("Keep"));- await tester.pumpAndSettle();-- expect(result?.action, ButtonAction.cancel);- expect(find.byType(BottomSheetComponent), findsNothing);- });-group("showTextInputDialog", () {- testWidgets("renders the migrated text input sheet", (tester) async {- await _pumpLauncher(- tester,- (context) => showTextInputDialog(- context,- title: "Rename file",- body: "Choose a short name.",- submitButtonLabel: "Rename",- icon: Icons.edit_outlined,- label: "Name",- hintText: "Enter file name",- prefixIcon: Icons.drive_file_rename_outline,- initialValue: "IMG_001",- message: ".JPG",- alignMessage: Alignment.centerRight,- onSubmit: (_) async {},- ),- );-- await _openLauncher(tester);-- expect(find.byType(BottomSheetComponent), findsOneWidget);- _expectComponentScrim(tester);- expect(find.byType(TextInputComponent), findsOneWidget);- expect(find.byType(ButtonComponent), findsOneWidget);- expect(find.byType(TextInputWidget), findsNothing);- expect(find.byType(Dialog), findsNothing);- expect(find.text("Rename file"), findsOneWidget);- expect(find.text("Choose a short name."), findsOneWidget);- expect(find.text("Name"), findsOneWidget);- expect(find.text(".JPG"), findsOneWidget);- expect(find.byIcon(Icons.edit_outlined), findsOneWidget);- expect(find.byIcon(Icons.drive_file_rename_outline), findsOneWidget);- expect(find.byTooltip("Close"), findsOneWidget);- expect(find.text("Cancel"), findsNothing);-- final input = tester.widget<TextField>(find.byType(TextField));- expect(input.controller?.text, "IMG_001");- });-testWidgets("submits entered text and closes with a null result", (tester,) async {@@ -360,31 +205,6 @@ void main() {expect(find.byType(BottomSheetComponent), findsNothing);});- testWidgets("submits from the keyboard action", (tester) async {- dynamic result;- var submitted = "";-- await _pumpLauncher(tester, (context) async {- result = await showTextInputDialog(- context,- title: "New album",- submitButtonLabel: "Create",- onSubmit: (value) async {- submitted = value;- },- );- });-- await _openLauncher(tester);- await tester.enterText(find.byType(TextField), "Keyboard album");- await tester.testTextInput.receiveAction(TextInputAction.done);- await tester.pumpAndSettle();-- expect(submitted, "Keyboard album");- expect(result, isNull);- expect(find.byType(BottomSheetComponent), findsNothing);- });-testWidgets("returns a ButtonResult when cancelled", (tester) async {dynamic result;@@ -483,54 +303,6 @@ void main() {expect(find.byType(BottomSheetComponent), findsNothing);},);-- testWidgets("preserves password mode and input formatters", (tester) async {- await _pumpLauncher(- tester,- (context) => showTextInputDialog(- context,- title: "Pair with TV",- submitButtonLabel: "Pair",- initialValue: "a1b2",- isPasswordInput: true,- textInputFormatter: [FilteringTextInputFormatter.digitsOnly],- onSubmit: (_) async {},- ),- );-- await _openLauncher(tester);-- final input = tester.widget<TextField>(find.byType(TextField));- expect(input.obscureText, isTrue);- expect(input.controller?.text, "12");- expect(- find.byKey(const ValueKey("text-field-password-toggle")),- findsOneWidget,- );- });-- testWidgets("showOnlyLoadingState suppresses button success state", (- tester,- ) async {- await _pumpLauncher(- tester,- (context) => showTextInputDialog(- context,- title: "New album",- submitButtonLabel: "Create",- initialValue: "Album",- showOnlyLoadingState: true,- onSubmit: (_) async {},- ),- );-- await _openLauncher(tester);-- final button = tester.widget<ButtonComponent>(- find.widgetWithText(ButtonComponent, "Create"),- );- expect(button.shouldShowSuccessState, isFalse);- });});}@@ -561,10 +333,3 @@ Future<void> _openLauncher(WidgetTester tester) async {await tester.tap(find.text("Open dialog"));await tester.pumpAndSettle();}--void _expectComponentScrim(WidgetTester tester) {- final barrierColors = tester- .widgetList<ModalBarrier>(find.byType(ModalBarrier))- .map((barrier) => barrier.color);- expect(barrierColors, contains(const Color.fromRGBO(0, 0, 0, 0.55)));-}diff --git a/mobile/apps/photos/test/ui/family/family_dashboard_test.dart b/mobile/apps/photos/test/ui/family/family_dashboard_test.dartindex 99736fc105..6becf3e3b0 100644--- a/mobile/apps/photos/test/ui/family/family_dashboard_test.dart+++ b/mobile/apps/photos/test/ui/family/family_dashboard_test.dart@@ -128,32 +128,6 @@ void main() {);});- group('familyMemberAvatarComponentColor', () {- test('hashes every member including the current user', () {- final currentUser = _member(email: '[email protected]', userID: 1);- final otherMember = _member(email: '[email protected]', userID: 42);-- expect(- familyMemberAvatarComponentColor(currentUser),- avatarComponentColorForIdentity(- avatarIdentityKey(- email: currentUser.email,- userID: currentUser.userID,- ),- ),- );- expect(- familyMemberAvatarComponentColor(otherMember),- avatarComponentColorForIdentity(- avatarIdentityKey(- email: otherMember.email,- userID: otherMember.userID,- ),- ),- );- });- });-testWidgets('renders saved contacts and their shared-album counts at 375 pixels',(tester) async {diff --git a/mobile/apps/photos/test/ui/home/memories/memory_progress_indicator_test.dart b/mobile/apps/photos/test/ui/home/memories/memory_progress_indicator_test.dartindex d82499aaf2..be83ab4c89 100644--- a/mobile/apps/photos/test/ui/home/memories/memory_progress_indicator_test.dart+++ b/mobile/apps/photos/test/ui/home/memories/memory_progress_indicator_test.dart@@ -3,42 +3,6 @@ import "package:flutter_test/flutter_test.dart";import "package:photos/ui/home/memories/memory_progress_indicator.dart";void main() {- testWidgets("fills the available width with equal chunks", (tester) async {- const totalSteps = 6;- const availableWidth = 343.0;- const currentIndex = 3;-- await tester.pumpWidget(- const MaterialApp(- home: Center(- child: SizedBox(- width: availableWidth,- child: MemoryProgressIndicator(- totalSteps: totalSteps,- currentIndex: currentIndex,- ),- ),- ),- ),- );-- final widths = [- for (var index = 0; index < totalSteps; index++)- tester- .getSize(find.byKey(ValueKey("memory-progress-segment-$index")))- .width,- ];-- for (final width in widths.skip(1)) {- expect(width, widths.first);- }- expect(- widths.reduce((left, right) => left + right) +- ((totalSteps - 1) * kMemoryProgressGap),- availableWidth,- );- });-testWidgets("uses the full track when segmented chunks become too narrow", (tester,) async {diff --git a/mobile/apps/photos/test/ui/payment/subscription_toggle_test.dart b/mobile/apps/photos/test/ui/payment/subscription_toggle_test.dartindex aaaf16c052..3bdf9bb946 100644--- a/mobile/apps/photos/test/ui/payment/subscription_toggle_test.dart+++ b/mobile/apps/photos/test/ui/payment/subscription_toggle_test.dart@@ -6,19 +6,6 @@ import "package:photos/ui/payment/subscription_common_widgets.dart";void main() {group("SubscriptionToggle", () {- testWidgets("uses the provided initial billing period", (tester) async {- await tester.pumpWidget(- _buildTestApp(- const SubscriptionToggle(isYearly: false, onToggle: _noopToggle),- ),- );-- final togglePosition = tester.widget<AnimatedPositioned>(- find.byType(AnimatedPositioned),- );- expect(togglePosition.left, greaterThan(0));- });-testWidgets("updates when the selected billing period changes", (tester,) async {diff --git a/mobile/apps/photos/test/ui/sharing/library_sharing_page_test.dart b/mobile/apps/photos/test/ui/sharing/library_sharing_page_test.dartindex 6a337686b2..5440e09a0a 100644--- a/mobile/apps/photos/test/ui/sharing/library_sharing_page_test.dart+++ b/mobile/apps/photos/test/ui/sharing/library_sharing_page_test.dart@@ -16,65 +16,6 @@ import 'package:photos/ui/sharing/library_sharing/library_sharing_sheets.dart';import 'library_sharing_test_helpers.dart';void main() {- testWidgets('empty first-time flow shows the library sharing banner', (- tester,- ) async {- await tester.binding.setSurfaceSize(const Size(375, 812));- addTearDown(() => tester.binding.setSurfaceSize(null));- final controller = LibrarySharingController(- recipient: librarySharingTestRecipient,- repository: FakeLibrarySharingRepository(const []),- );-- await tester.pumpWidget(- _app(- LibrarySharingPage(- recipient: librarySharingTestRecipient,- controller: controller,- ),- ),- );- await tester.pumpAndSettle();-- expect(find.byType(LibrarySharingSelectionSheet), findsNothing);- expect(find.text('No albums to share yet'), findsOneWidget);- expect(find.text('Library sharing'), findsOneWidget);- expect(find.byType(ToggleSwitchComponent), findsOneWidget);- });-- testWidgets('existing recipient add mode renders the Share with state', (- tester,- ) async {- final controller = LibrarySharingController(- recipient: librarySharingTestRecipient,- repository: FakeLibrarySharingRepository([- librarySharingTestAlbum(- 1,- recipientRole: CollectionParticipantRole.viewer,- ),- ]),- );- await controller.load();- controller.enterAddMode();-- await tester.pumpWidget(- _app(- LibrarySharingPage(- recipient: librarySharingTestRecipient,- controller: controller,- ),- ),- );- await tester.pumpAndSettle();-- expect(find.text('Share with'), findsOneWidget);- expect(find.text('Sharing with'), findsNothing);- expect(find.text('All your current albums are shared'), findsOneWidget);- expect(find.text('Library sharing'), findsNothing);- expect(find.byType(LibrarySharingSelectionSheet), findsNothing);- expect(find.byType(ToggleSwitchComponent), findsNothing);- });-testWidgets('offers to review albums that were previously unshared', (tester,) async {@@ -114,37 +55,6 @@ void main() {expect(find.text('Share with'), findsOneWidget);});- testWidgets('keeps the library sharing banner while albums are selected', (- tester,- ) async {- final controller = _LayoutTestLibrarySharingController();-- await tester.pumpWidget(- _app(- LibrarySharingPage(- recipient: librarySharingTestRecipient,- controller: controller,- ),- ),- );- await tester.pumpAndSettle();-- expect(find.text('Library sharing'), findsOneWidget);- expect(find.byType(LibrarySharingSelectionSheet), findsNothing);-- controller.enterManageMode();- controller.selectAll();- await tester.pumpAndSettle();- expect(find.text('Library sharing'), findsOneWidget);- expect(find.byType(LibrarySharingSelectionSheet), findsOneWidget);-- controller.clearSelection();- await tester.pumpAndSettle();- expect(find.text('Library sharing'), findsOneWidget);- expect(find.byType(LibrarySharingSelectionSheet), findsNothing);- expect(find.byTooltip('Share albums'), findsOneWidget);- });-testWidgets('mixed selection routes role editing and offers stop sharing', (tester,) async {@@ -194,33 +104,6 @@ void main() {expect(mixedRolesOpened, isTrue);});- testWidgets('shows loading before the empty add state', (tester) async {- final loadGate = Completer<List<Collection>>();- final controller = LibrarySharingController(- recipient: librarySharingTestRecipient,- repository: FakeLibrarySharingRepository(const [], loadGate: loadGate),- );-- await tester.pumpWidget(- _app(- LibrarySharingPage(- recipient: librarySharingTestRecipient,- controller: controller,- ),- ),- );- await tester.pump();-- expect(find.byType(CircularProgressIndicator), findsOneWidget);- expect(find.byType(LibrarySharingSelectionSheet), findsNothing);-- loadGate.complete(const []);- await tester.pumpAndSettle();- expect(find.byType(CircularProgressIndicator), findsNothing);- expect(find.text('No albums to share yet'), findsOneWidget);- expect(find.byType(LibrarySharingSelectionSheet), findsNothing);- });-testWidgets('roles sheet cannot be dismissed while an update is running', (tester,) async {diff --git a/mobile/apps/photos/test/ui/social/comments_collection_selection_test.dart b/mobile/apps/photos/test/ui/social/comments_collection_selection_test.dartdeleted file mode 100644index c0b4770148..0000000000--- a/mobile/apps/photos/test/ui/social/comments_collection_selection_test.dart+++ /dev/null@@ -1,42 +0,0 @@-import "package:flutter_test/flutter_test.dart";-import "package:photos/ui/social/comment_collection_selection.dart";--void main() {- group("initial comments collection", () {- test("prefers a collection containing an unsent draft", () {- expect(- resolveInitialCommentsCollectionID(- requestedCollectionID: 10,- draftCollectionID: 20,- preferDraftCollection: true,- hasHighlightedComment: false,- ),- 20,- );- });-- test("keeps the requested collection for an explicit comment tap", () {- expect(- resolveInitialCommentsCollectionID(- requestedCollectionID: 10,- draftCollectionID: 20,- preferDraftCollection: false,- hasHighlightedComment: false,- ),- 10,- );- });-- test("keeps the requested collection for a highlighted comment", () {- expect(- resolveInitialCommentsCollectionID(- requestedCollectionID: 10,- draftCollectionID: 20,- preferDraftCollection: true,- hasHighlightedComment: true,- ),- 10,- );- });- });-}diff --git a/mobile/apps/photos/test/ui/tools/editor/video_editor_controller_test.dart b/mobile/apps/photos/test/ui/tools/editor/video_editor_controller_test.dartindex 89389448e3..14af0d7ca8 100644--- a/mobile/apps/photos/test/ui/tools/editor/video_editor_controller_test.dart+++ b/mobile/apps/photos/test/ui/tools/editor/video_editor_controller_test.dart@@ -22,14 +22,6 @@ void main() {);});- test('visual crop conversion is reversible for every quarter turn', () {- for (final rotation in [0, 90, 180, 270]) {- final visual = rotateNormalizedRect(sourceCrop, rotation);- final restored = rotateNormalizedRect(visual, 360 - rotation);- _expectRectClose(restored, sourceCrop, reason: 'rotation=$rotation');- }- });-test('fixed-ratio crop remains in bounds without changing ratio', () {final crop = constrainNormalizedCropRect(rect: const Rect.fromLTRB(-0.1, 0.1, 0.8, 0.9),@@ -48,10 +40,10 @@ void main() {});}-void _expectRectClose(Rect actual, Rect expected, {String? reason}) {+void _expectRectClose(Rect actual, Rect expected) {const tolerance = 1e-12;- expect(actual.left, closeTo(expected.left, tolerance), reason: reason);- expect(actual.top, closeTo(expected.top, tolerance), reason: reason);- expect(actual.right, closeTo(expected.right, tolerance), reason: reason);- expect(actual.bottom, closeTo(expected.bottom, tolerance), reason: reason);+ expect(actual.left, closeTo(expected.left, tolerance));+ expect(actual.top, closeTo(expected.top, tolerance));+ expect(actual.right, closeTo(expected.right, tolerance));+ expect(actual.bottom, closeTo(expected.bottom, tolerance));}diff --git a/mobile/apps/photos/test/ui/viewer/hierarchicial_search/app_bar_filter_chips_test.dart b/mobile/apps/photos/test/ui/viewer/hierarchicial_search/app_bar_filter_chips_test.dartindex fecf5c086b..88e2778a76 100644--- a/mobile/apps/photos/test/ui/viewer/hierarchicial_search/app_bar_filter_chips_test.dart+++ b/mobile/apps/photos/test/ui/viewer/hierarchicial_search/app_bar_filter_chips_test.dart@@ -3,19 +3,6 @@ import "package:flutter_test/flutter_test.dart";import "package:photos/ui/viewer/hierarchicial_search/app_bar_filter_chips.dart";void main() {- testWidgets("AppBarFilterChips keeps default heights without text scaling", (- tester,- ) async {- await tester.pumpWidget(- _wrap((context) {- expect(AppBarFilterChips.chipHeight(context), 40);- expect(AppBarFilterChips.preferredHeight(context), 48);- expect(AppBarFilterChips.appBarHeight(context), kToolbarHeight + 48);- return const SizedBox.shrink();- }),- );- });-testWidgets("AppBarFilterChips expands heights with scaled text", (tester,) async {diff --git a/mobile/apps/photos/test/ui/viewer/people/memory_lane_banner_section_test.dart b/mobile/apps/photos/test/ui/viewer/people/memory_lane_banner_section_test.dartdeleted file mode 100644index 6e5c78b743..0000000000--- a/mobile/apps/photos/test/ui/viewer/people/memory_lane_banner_section_test.dart+++ /dev/null@@ -1,71 +0,0 @@-import "package:flutter/material.dart";-import "package:flutter_test/flutter_test.dart";-import "package:ente_strings/ente_strings.dart";-import "package:photos/models/ml/face/person.dart";-import "package:photos/ui/viewer/people/memory_lane_banner.dart";--void main() {- group("MemoryLaneBannerSection", () {- late PersonEntity person;-- setUp(() {- person = PersonEntity("person-1", PersonData(name: "Alex"));- });-- testWidgets("renders banner when timeline is ready", (tester) async {- await tester.pumpWidget(- MaterialApp(- localizationsDelegates: StringsLocalizations.localizationsDelegates,- supportedLocales: StringsLocalizations.supportedLocales,- home: MemoryLaneBannerSection(- showBanner: true,- person: person,- onTap: () {},- loadTimeline: (_) async => null,- ),- ),- );-- await tester.pump();-- expect(find.byType(MemoryLaneBanner), findsOneWidget);- final context = tester.element(find.byType(MemoryLaneBanner));- final l10n = context.strings;- expect(find.text(l10n.facesTimelineBannerTitle), findsOneWidget);- });-- testWidgets("hides banner when timeline is unavailable", (tester) async {- await tester.pumpWidget(- MaterialApp(- localizationsDelegates: StringsLocalizations.localizationsDelegates,- supportedLocales: StringsLocalizations.supportedLocales,- home: MemoryLaneBannerSection(- showBanner: false,- person: person,- onTap: () {},- loadTimeline: (_) async => null,- ),- ),- );-- expect(find.byType(MemoryLaneBanner), findsNothing);- });-- testWidgets("hides banner when tap callback is missing", (tester) async {- await tester.pumpWidget(- MaterialApp(- localizationsDelegates: StringsLocalizations.localizationsDelegates,- supportedLocales: StringsLocalizations.supportedLocales,- home: MemoryLaneBannerSection(- showBanner: true,- person: person,- onTap: null,- loadTimeline: (_) async => null,- ),- ),- );-- expect(find.byType(MemoryLaneBanner), findsNothing);- });- });-}diff --git a/mobile/apps/photos/test/utils/date_query_parsing_test.dart b/mobile/apps/photos/test/utils/date_query_parsing_test.dartindex 5f0fd144e1..26495a0b3a 100644--- a/mobile/apps/photos/test/utils/date_query_parsing_test.dart+++ b/mobile/apps/photos/test/utils/date_query_parsing_test.dart@@ -162,13 +162,6 @@ void main() {expect(parsedDate.year, isNull);});- test('should parse "February 2025" (month-year query)', () {- final PartialDate parsedDate = dateParseService.parse('February 2025');- expect(parsedDate.day, isNull);- expect(parsedDate.month, 2);- expect(parsedDate.year, 2025);- });-test('should parse "25th of February 2025"', () {final PartialDate parsedDate = dateParseService.parse('25th of February 2025',@@ -285,27 +278,6 @@ void main() {expect(parsedDate.month, isNull);expect(parsedDate.year, 2025);});-- test('should parse month-year query "February 2025"', () {- final PartialDate parsedDate = dateParseService.parse('February 2025');- expect(parsedDate.day, isNull);- expect(parsedDate.month, 2);- expect(parsedDate.year, 2025);- });-- test('should parse generic date query "25th Feb" (year is null)', () {- final PartialDate parsedDate = dateParseService.parse('25th Feb');- expect(parsedDate.day, 25);- expect(parsedDate.month, 2);- expect(parsedDate.year, isNull);- });-- test('should parse specific date query "25/02/2025"', () {- final PartialDate parsedDate = dateParseService.parse('25/02/2025');- expect(parsedDate.day, 25);- expect(parsedDate.month, 2);- expect(parsedDate.year, 2025);- });});group('Invalid Date Queries', () {@@ -339,12 +311,5 @@ void main() {expect(parsedDate3.month, 2);expect(parsedDate3.year, 2024);});-- test('should handle invalid day/month in tokenized parsing gracefully', () {- final PartialDate parsedDate = dateParseService.parse('32 Jan 2024');- expect(parsedDate.day, isNull, reason: 'Day should be null for 32');- expect(parsedDate.month, 1);- expect(parsedDate.year, 2024);- });});}diff --git a/mobile/apps/photos/test/utils/delete_file_util_test.dart b/mobile/apps/photos/test/utils/delete_file_util_test.dartindex 2bffc71b59..8cd3989f7d 100644--- a/mobile/apps/photos/test/utils/delete_file_util_test.dart+++ b/mobile/apps/photos/test/utils/delete_file_util_test.dart@@ -82,60 +82,6 @@ void main() {});group('showDeleteSheet', () {- testWidgets(- 'mixed local and remote delete sheet shows mixed component actions',- (tester) async {- final file = _file(generatedID: 1, uploadedID: 11, localID: 'local-1');- final selectedFiles = SelectedFiles()..selectAll({file});-- await _pumpDeleteSheet(- tester,- selectedFiles: selectedFiles,- split: FilesSplit(- pendingUploads: const [],- ownedByCurrentUser: [file],- ownedByOtherUsers: const [],- ),- );-- expect(find.byType(BottomSheetComponent), findsOneWidget);- _expectDeleteWarningIllustration('assets/warning-red.png');- expect(- find.text('This item is available on your device and Ente.'),- findsOneWidget,- );- expect(find.text('Delete item?'), findsOneWidget);- expect(find.byType(RadioComponent), findsNothing);- expect(find.byType(MenuGroupComponent), findsNothing);- expect(find.byType(MenuComponent), findsNothing);-- expect(find.byType(ButtonComponent), findsNWidgets(3));- final buttons = tester.widgetList<ButtonComponent>(- find.byType(ButtonComponent),- );- expect(buttons.map((button) => button.variant), [- ButtonComponentVariant.secondary,- ButtonComponentVariant.secondary,- ButtonComponentVariant.critical,- ]);- expect(find.text('Set as my default choice'), findsOneWidget);- expect(- find.ancestor(- of: find.byType(LabeledControlComponent),- matching: find.byType(Center),- ),- findsOneWidget,- );- expect(find.byTooltip('Close'), findsOneWidget);- expect(find.text('Cancel'), findsNothing);- _expectVisibleButtonsInOrder(tester, [- 'Delete from device',- 'Delete from Ente',- 'Delete from both',- ]);- },- );-testWidgets('mixed delete sheet with saved default starts collapsed', (tester,) async {@@ -159,222 +105,6 @@ void main() {expect(find.text('Set as my default choice'), findsNothing);});- testWidgets('plural delete sheet copy matches deletion context', (- tester,- ) async {- final mixedFiles = [- _file(generatedID: 17, uploadedID: 27, localID: 'local-17'),- _file(generatedID: 18, uploadedID: 28, localID: 'local-18'),- ];- final mixedSelection = SelectedFiles()..selectAll(mixedFiles.toSet());- await _pumpDeleteSheet(- tester,- selectedFiles: mixedSelection,- split: FilesSplit(- pendingUploads: const [],- ownedByCurrentUser: mixedFiles,- ownedByOtherUsers: const [],- ),- );- expect(find.text('Delete 2 items?'), findsOneWidget);- expect(- find.text('These items are available on device and Ente.'),- findsOneWidget,- );- await tester.tap(find.byTooltip('Close'));- await tester.pumpAndSettle();- final remoteFiles = [- _file(generatedID: 19, uploadedID: 29),- _file(generatedID: 20, uploadedID: 30),- ];- final remoteSelection = SelectedFiles()..selectAll(remoteFiles.toSet());- await _pumpDeleteSheet(- tester,- selectedFiles: remoteSelection,- split: FilesSplit(- pendingUploads: const [],- ownedByCurrentUser: remoteFiles,- ownedByOtherUsers: const [],- ),- );- expect(find.text('Delete 2 items?'), findsOneWidget);- expect(- find.text(- 'These items will be deleted from all albums. '- 'You can recover them from Trash.',- ),- findsOneWidget,- );- });-- testWidgets(- 'mixed delete from Ente choice uses the remote delete path and clears selection',- (tester) async {- final file = _file(- generatedID: 14,- uploadedID: 24,- localID: 'local-14',- );- final selectedFiles = SelectedFiles()..selectAll({file});- var remoteDeleteCalls = 0;- List<EnteFile>? remoteDeleteFiles;-- await _pumpDeleteSheet(- tester,- selectedFiles: selectedFiles,- split: FilesSplit(- pendingUploads: const [],- ownedByCurrentUser: [file],- ownedByOtherUsers: const [],- ),- deleteFromRemoteOnlyOverride: (context, files) async {- remoteDeleteCalls++;- remoteDeleteFiles = List.of(files);- },- );-- await tester.tap(find.text('Delete from Ente'));- await tester.pumpAndSettle();-- expect(remoteDeleteCalls, 1);- expect(remoteDeleteFiles, [file]);- expect(find.byType(BottomSheetComponent), findsNothing);- expect(selectedFiles.files, isEmpty);-- await _settleToast(tester);- },- );-- testWidgets('mixed delete sheet close keeps selection', (tester) async {- final file = _file(generatedID: 16, uploadedID: 26, localID: 'local-16');- final selectedFiles = SelectedFiles()..selectAll({file});-- await _pumpDeleteSheet(- tester,- selectedFiles: selectedFiles,- split: FilesSplit(- pendingUploads: const [],- ownedByCurrentUser: [file],- ownedByOtherUsers: const [],- ),- );-- await tester.tap(find.byTooltip('Close'));- await tester.pumpAndSettle();-- expect(find.byType(BottomSheetComponent), findsNothing);- expect(selectedFiles.files, contains(file));- });-- testWidgets(- 'mixed delete from device choice uses the device delete path and clears selection',- (tester) async {- final file = _file(- generatedID: 15,- uploadedID: 25,- localID: 'local-15',- );- final selectedFiles = SelectedFiles()..selectAll({file});- var deviceDeleteCalls = 0;- List<EnteFile>? deviceDeleteFiles;-- await _pumpDeleteSheet(- tester,- selectedFiles: selectedFiles,- split: FilesSplit(- pendingUploads: const [],- ownedByCurrentUser: [file],- ownedByOtherUsers: const [],- ),- deleteOnDeviceOnlyOverride: (context, files) async {- deviceDeleteCalls++;- deviceDeleteFiles = List.of(files);- },- );-- await tester.tap(find.text('Delete from device'));- await tester.pumpAndSettle();-- expect(deviceDeleteCalls, 1);- expect(deviceDeleteFiles, [file]);- expect(find.byType(BottomSheetComponent), findsNothing);- expect(selectedFiles.files, isEmpty);- },- );-- testWidgets('remote-only delete sheet uses title and critical action', (- tester,- ) async {- final file = _file(generatedID: 2, uploadedID: 12);- final selectedFiles = SelectedFiles()..selectAll({file});-- await _pumpDeleteSheet(- tester,- selectedFiles: selectedFiles,- split: FilesSplit(- pendingUploads: const [],- ownedByCurrentUser: [file],- ownedByOtherUsers: const [],- ),- );-- expect(- find.text(- 'This item will be deleted from all albums. '- 'You can recover it from Trash.',- ),- findsOneWidget,- );- _expectDeleteWarningIllustration('assets/warning-red.png');- expect(find.text('Delete item?'), findsOneWidget);- expect(find.text('They will be deleted from all albums.'), findsNothing);- expect(find.byType(ButtonComponent), findsOneWidget);- final deleteButton = tester.widget<ButtonComponent>(- find.byType(ButtonComponent),- );- expect(deleteButton.variant, ButtonComponentVariant.critical);- expect(find.text('Delete from device'), findsNothing);- expect(find.text('Delete from both'), findsNothing);- expect(find.byTooltip('Close'), findsOneWidget);- expect(find.text('Cancel'), findsNothing);- _expectVisibleButtonsInOrder(tester, ['Delete from Ente']);- });-- testWidgets('local-only delete sheet uses title and critical action', (- tester,- ) async {- final file = _file(generatedID: 3, localID: 'local-3');- final selectedFiles = SelectedFiles()..selectAll({file});-- await _pumpDeleteSheet(- tester,- selectedFiles: selectedFiles,- split: FilesSplit(- pendingUploads: [file],- ownedByCurrentUser: const [],- ownedByOtherUsers: const [],- ),- );-- expect(- find.text('Item not backed up. Permanently delete from device?'),- findsOneWidget,- );- _expectDeleteWarningIllustration('assets/warning-red.png');- expect(find.text('Delete item?'), findsOneWidget);- expect(find.text('They will be deleted from all albums.'), findsNothing);- expect(find.byType(ButtonComponent), findsOneWidget);- final deleteButton = tester.widget<ButtonComponent>(- find.byType(ButtonComponent),- );- expect(deleteButton.variant, ButtonComponentVariant.critical);- expect(find.text('Delete from Ente'), findsNothing);- expect(find.text('Delete from both'), findsNothing);- expect(find.byTooltip('Close'), findsOneWidget);- expect(find.text('Cancel'), findsNothing);- _expectVisibleButtonsInOrder(tester, ['Delete from device']);- });-testWidgets('cancel keeps the selection', (tester) async {final file = _file(generatedID: 4, uploadedID: 14);final selectedFiles = SelectedFiles()..selectAll({file});@@ -494,27 +224,6 @@ void main() {},);- testWidgets('barrier dismissal keeps the selection', (tester) async {- final file = _file(generatedID: 5, uploadedID: 15);- final selectedFiles = SelectedFiles()..selectAll({file});-- await _pumpDeleteSheet(- tester,- selectedFiles: selectedFiles,- split: FilesSplit(- pendingUploads: const [],- ownedByCurrentUser: [file],- ownedByOtherUsers: const [],- ),- );-- await tester.tapAt(const Offset(10, 10));- await tester.pumpAndSettle();-- expect(find.byType(BottomSheetComponent), findsNothing);- expect(selectedFiles.files, contains(file));- });-testWidgets('only other-user files keep the legacy no-sheet behavior', (tester,) async {@@ -595,42 +304,6 @@ void main() {await _settleToast(tester);},);-- testWidgets('mismatched selection and split counts still assert', (- tester,- ) async {- final selectedFile = _file(generatedID: 12, uploadedID: 22);- final splitFile = _file(generatedID: 13, uploadedID: 23);- final selectedFiles = SelectedFiles()..selectAll({selectedFile});- late BuildContext context;-- await tester.pumpWidget(- MaterialApp(- theme: darkThemeData,- localizationsDelegates: StringsLocalizations.localizationsDelegates,- supportedLocales: StringsLocalizations.supportedLocales,- home: Builder(- builder: (builderContext) {- context = builderContext;- return const SizedBox.shrink();- },- ),- ),- );-- await expectLater(- showDeleteSheet(- context,- selectedFiles,- FilesSplit(- pendingUploads: const [],- ownedByCurrentUser: [selectedFile, splitFile],- ownedByOtherUsers: const [],- ),- ),- throwsA(isA<AssertionError>()),- );- });});}diff --git a/mobile/apps/photos/test/utils/hierarchical_search_util_test.dart b/mobile/apps/photos/test/utils/hierarchical_search_util_test.dartdeleted file mode 100644index 2540286723..0000000000--- a/mobile/apps/photos/test/utils/hierarchical_search_util_test.dart+++ /dev/null@@ -1,54 +0,0 @@-import "package:flutter/widgets.dart";-import "package:flutter_test/flutter_test.dart";-import "package:photos/models/file/file.dart";-import "package:photos/models/search/hierarchical/hierarchical_search_filter.dart";-import "package:photos/ui/viewer/gallery/state/search_filter_data_provider.dart";-import "package:photos/utils/hierarchical_search_util.dart";--void main() {- testWidgets("curateFilters skips when localizations are unavailable", (- tester,- ) async {- late final BuildContext context;- await tester.pumpWidget(- Builder(- builder: (builderContext) {- context = builderContext;- return const SizedBox.shrink();- },- ),- );-- final searchFilterDataProvider = SearchFilterDataProvider(- initialGalleryFilter: _TestFilter(),- );-- await curateFilters(searchFilterDataProvider, const [], context);-- expect(searchFilterDataProvider.recommendations, isEmpty);- searchFilterDataProvider.dispose();- });-}--class _TestFilter extends HierarchicalSearchFilter {- _TestFilter()- : super(- filterTypeName: "topLevelGenericFilter",- matchedUploadedIDs: <int>{},- );-- @override- SearchFilterIcon? icon() => null;-- @override- bool isMatch(EnteFile file) => false;-- @override- bool isSameFilter(HierarchicalSearchFilter other) => other.name() == name();-- @override- String name() => "test";-- @override- int relevance() => kLeastRelevantFilter;-}diff --git a/mobile/packages/ente_components/test/components/app_surface_widgets_test.dart b/mobile/packages/ente_components/test/components/app_surface_widgets_test.dartindex a27d58391b..7b1ff8f74f 100644--- a/mobile/packages/ente_components/test/components/app_surface_widgets_test.dart+++ b/mobile/packages/ente_components/test/components/app_surface_widgets_test.dart@@ -117,52 +117,6 @@ void main() {},);- testWidgets('MenuComponent can show only loading without success', (- tester,- ) async {- final completer = Completer<void>();-- await pumpComponent(- tester,- MenuComponent(- title: 'Refresh',- showOnlyLoadingState: true,- onTap: () => completer.future,- ),- );-- await tester.tap(find.text('Refresh'));- await tester.pump(const Duration(milliseconds: 300));- expect(find.byKey(const ValueKey('menu-item-loading')), findsOneWidget);-- completer.complete();- await tester.pump();- expect(find.byKey(const ValueKey('menu-item-success')), findsNothing);- expect(find.byKey(const ValueKey('menu-item-loading')), findsNothing);- });-- testWidgets('MenuComponent can force success for fast actions', (- tester,- ) async {- await pumpComponent(- tester,- MenuComponent(- title: 'Copy',- shouldSurfaceExecutionStates: true,- shouldShowSuccessConfirmation: true,- onTap: () async {},- ),- );-- await tester.tap(find.text('Copy'));- await tester.pump();- expect(find.byKey(const ValueKey('menu-item-success')), findsOneWidget);-- await tester.pump(const Duration(seconds: 1));- await tester.pump(const Duration(milliseconds: 200));- expect(find.byKey(const ValueKey('menu-item-success')), findsNothing);- });-testWidgets('MenuComponent resets to idle after async errors', (tester,) async {diff --git a/mobile/packages/ente_components/test/components/avatar_test.dart b/mobile/packages/ente_components/test/components/avatar_test.dartindex d5f9e93b0b..b9e9cb1eca 100644--- a/mobile/packages/ente_components/test/components/avatar_test.dart+++ b/mobile/packages/ente_components/test/components/avatar_test.dart@@ -25,14 +25,4 @@ void main() {AvatarComponentColor.cyan,]);});-- test(- 'avatar initials use the first and last words with a two-letter cap',- () {- expect(avatarInitials('Sachin Jain'), 'SJ');- expect(avatarInitials('Sachin Kumar Jain'), 'SJ');- expect(avatarInitials('Sachin'), 'S');- expect(avatarInitials(' '), '?');- },- );}diff --git a/mobile/packages/ente_components/test/components/bottom_sheet_component_test.dart b/mobile/packages/ente_components/test/components/bottom_sheet_component_test.dartindex ebf89a1026..3b362ea267 100644--- a/mobile/packages/ente_components/test/components/bottom_sheet_component_test.dart+++ b/mobile/packages/ente_components/test/components/bottom_sheet_component_test.dart@@ -5,30 +5,6 @@ import 'package:flutter/material.dart';import 'package:flutter_test/flutter_test.dart';void main() {- testWidgets('BottomSheetComponent dismisses from close button by default', (- tester,- ) async {- await _pumpLauncher(- tester,- (context) => showBottomSheetComponent<void>(- context: context,- builder: (_) => const BottomSheetComponent(- title: 'Default close',- content: Text('Sheet body'),- ),- ),- );-- await _openLauncher(tester);-- expect(find.text('Default close'), findsOneWidget);-- await tester.tap(find.byTooltip('Close'));- await tester.pumpAndSettle();-- expect(find.text('Default close'), findsNothing);- });-testWidgets('BottomSheetComponent returns closeResult from close button', (tester,) async {diff --git a/mobile/packages/ente_components/test/components/button_test.dart b/mobile/packages/ente_components/test/components/button_test.dartindex c9028b7822..84de1c640a 100644--- a/mobile/packages/ente_components/test/components/button_test.dart+++ b/mobile/packages/ente_components/test/components/button_test.dart@@ -109,66 +109,6 @@ void main() {},);- testWidgets(- "ButtonComponent shows success confirmation for fast actions when enabled",- (tester) async {- var tapCount = 0;-- await tester.pumpWidget(- _wrap(- ButtonComponent(- label: "Saved",- shouldShowSuccessConfirmation: true,- onTap: () => tapCount += 1,- ),- ),- );-- await tester.tap(find.text("Saved"));- await tester.pump();-- expect(tapCount, 1);- expect(find.byType(HugeIcon), findsOneWidget);- await tester.pump(const Duration(milliseconds: 200));- expect(find.text("Saved"), findsOneWidget);- expect(tester.getSize(find.byType(AnimatedContainer)).height, 52);-- await tester.pump(const Duration(seconds: 1));- await tester.pump();- await tester.pump(const Duration(milliseconds: 200));-- expect(find.text("Saved"), findsOneWidget);- },- );-- testWidgets("ButtonComponent can surface loading without success", (- tester,- ) async {- final completer = Completer<void>();-- await tester.pumpWidget(- _wrap(- ButtonComponent(- label: "Saving",- shouldShowSuccessState: false,- onTap: () => completer.future,- ),- ),- );-- await tester.tap(find.text("Saving"));- await tester.pump(const Duration(milliseconds: 300));-- expect(find.byKey(const ValueKey('loading')), findsOneWidget);-- completer.complete();- await tester.pump();- await tester.pump(const Duration(milliseconds: 200));-- expect(find.byKey(const ValueKey('success')), findsNothing);- expect(find.text("Saving"), findsOneWidget);- });-testWidgets("ButtonComponent can hide execution visuals while still blocking taps",(tester) async {@@ -409,30 +349,6 @@ void main() {expect(find.byKey(const ValueKey('success')), findsOneWidget);});-- testWidgets("IconButtonComponent can show success for fast actions", (- tester,- ) async {- var tapCount = 0;-- await tester.pumpWidget(- _wrap(- IconButtonComponent(- icon: const Icon(Icons.add),- shouldShowSuccessConfirmation: true,- onTap: () => tapCount += 1,- ),- ),- );-- await tester.tap(find.byType(GestureDetector));- await tester.pump();-- expect(tapCount, 1);- expect(find.byKey(const ValueKey('success')), findsOneWidget);- await tester.pump(const Duration(milliseconds: 200));- expect(find.byIcon(Icons.add), findsNothing);- });}Widget _wrap(diff --git a/mobile/packages/ente_qr/test/ente_qr_test.dart b/mobile/packages/ente_qr/test/ente_qr_test.dartdeleted file mode 100644index 5168aaf401..0000000000--- a/mobile/packages/ente_qr/test/ente_qr_test.dart+++ /dev/null@@ -1,38 +0,0 @@-import 'package:ente_qr/ente_qr.dart';-import 'package:ente_qr/ente_qr_method_channel.dart';-import 'package:ente_qr/ente_qr_platform_interface.dart';-import 'package:flutter_test/flutter_test.dart';-import 'package:plugin_platform_interface/plugin_platform_interface.dart';--class MockEnteQrPlatform- with MockPlatformInterfaceMixin- implements EnteQrPlatform {- @override- Future<String?> getPlatformVersion() => Future.value('42');-- @override- Future<QrScanResult> scanQrFromImage(- String imagePath, {- bool tryOriginalResolution = false,- }) => Future.value(QrScanResult.error('Mock implementation'));-- @override- Future<QrScanResults> scanAllQrFromImage(String imagePath) =>- Future.value(QrScanResults.error('Mock implementation'));-}--void main() {- final EnteQrPlatform initialPlatform = EnteQrPlatform.instance;-- test('$MethodChannelEnteQr is the default instance', () {- expect(initialPlatform, isInstanceOf<MethodChannelEnteQr>());- });-- test('getPlatformVersion', () async {- final EnteQr enteQrPlugin = EnteQr();- final MockEnteQrPlatform fakePlatform = MockEnteQrPlatform();- EnteQrPlatform.instance = fakePlatform;-- expect(await enteQrPlugin.getPlatformVersion(), '42');- });-}diff --git a/mobile/packages/lock_screen/test/app_lock_test.dart b/mobile/packages/lock_screen/test/app_lock_test.dartindex 68e1d09571..b0fa659d70 100644--- a/mobile/packages/lock_screen/test/app_lock_test.dart+++ b/mobile/packages/lock_screen/test/app_lock_test.dart@@ -41,15 +41,6 @@ void main() {expect(find.text('light'), findsOneWidget);});- testWidgets('can hide the debug banner', (tester) async {- await tester.pumpWidget(- _buildAppLock(ThemeMode.system, debugShowCheckedModeBanner: false),- );-- final materialApp = tester.widget<MaterialApp>(find.byType(MaterialApp));- expect(materialApp.debugShowCheckedModeBanner, isFalse);- });-testWidgets('covers unlocked content until unlock', (tester) async {await tester.pumpWidget(_buildAppLock(diff --git a/server/cmd/museum/main_route_policy_test.go b/server/cmd/museum/main_route_policy_test.godeleted file mode 100644index 31d811f31f..0000000000--- a/server/cmd/museum/main_route_policy_test.go+++ /dev/null@@ -1,126 +0,0 @@-package main--import (- "go/ast"- "go/parser"- "go/token"- "strconv"- "strings"- "testing"-)--type routeRegistration struct {- group string- method string- path string-}--func TestStorageContentRoutesUseStorageAPI(t *testing.T) {- routes := collectRouteRegistrations(t)-- for _, route := range routes {- if route.group == "privateAPI" && requiresStorageAuthBlock(route.path) {- t.Errorf("%s %s is registered on privateAPI; use storageAPI", route.method, route.path)- }- }-- for _, prefix := range []string{"/user-entity/", "/contacts", "/attachments/"} {- if !hasStorageRoute(routes, prefix) {- t.Errorf("expected %s routes to be registered on storageAPI", prefix)- }- }-}--func collectRouteRegistrations(t *testing.T) []routeRegistration {- t.Helper()-- fileSet := token.NewFileSet()- file, err := parser.ParseFile(fileSet, "main.go", nil, 0)- if err != nil {- t.Fatalf("failed to parse main.go: %v", err)- }-- httpMethods := map[string]bool{- "GET": true, "POST": true, "PUT": true, "PATCH": true, "DELETE": true,- }- var routes []routeRegistration- ast.Inspect(file, func(node ast.Node) bool {- call, ok := node.(*ast.CallExpr)- if !ok {- return true- }- selector, ok := call.Fun.(*ast.SelectorExpr)- if !ok || !httpMethods[selector.Sel.Name] {- return true- }- group, ok := selector.X.(*ast.Ident)- if !ok || (group.Name != "privateAPI" && group.Name != "storageAPI") {- return true- }- if len(call.Args) == 0 {- return true- }- literal, ok := call.Args[0].(*ast.BasicLit)- if !ok || literal.Kind != token.STRING {- return true- }- path, err := strconv.Unquote(literal.Value)- if err != nil {- t.Fatalf("failed to parse route path %s: %v", literal.Value, err)- }- routes = append(routes, routeRegistration{- group: group.Name,- method: selector.Sel.Name,- path: path,- })- return true- })- return routes-}--func requiresStorageAuthBlock(path string) bool {- switch {- case path == "/files" || strings.HasPrefix(path, "/files/"):- return true- case strings.HasPrefix(path, "/trash/"):- return true- case path == "/comments" || strings.HasPrefix(path, "/comments/"):- return true- case path == "/reactions" || strings.HasPrefix(path, "/reactions/"):- return true- case strings.HasPrefix(path, "/social/"):- return true- case strings.HasPrefix(path, "/comments-reactions/"):- return true- case path == "/collections" || strings.HasPrefix(path, "/collections/"):- return true- case strings.HasPrefix(path, "/collection-actions/"):- return true- case path == "/memory-share" || strings.HasPrefix(path, "/memory-share/"):- return true- case strings.HasPrefix(path, "/cast/"):- return true- case path == "/users/locker-usage":- return true- case strings.HasPrefix(path, "/user-entity/"):- return true- case path == "/contacts" || strings.HasPrefix(path, "/contacts/"):- return true- case strings.HasPrefix(path, "/attachments/"):- return true- default:- return false- }-}--func hasStorageRoute(routes []routeRegistration, prefix string) bool {- for _, route := range routes {- if route.group != "storageAPI" {- continue- }- if route.path == strings.TrimSuffix(prefix, "/") || strings.HasPrefix(route.path, prefix) {- return true- }- }- return false-}diff --git a/server/pkg/utils/email/space_drip_template_test.go b/server/pkg/utils/email/space_drip_template_test.goindex 12f5a2c0a3..4936224e54 100644--- a/server/pkg/utils/email/space_drip_template_test.go+++ b/server/pkg/utils/email/space_drip_template_test.go@@ -19,16 +19,9 @@ func TestSpaceDripTemplateRendersCTAAndBody(t *testing.T) {"CTALabel": "Finish setup",})require.NoError(t, err)- require.Contains(t, body, `role="presentation" width="100%" cellspacing="0" cellpadding="0" border="0" bgcolor="#f0f1f3"`)- require.Contains(t, body, `max-width: 420px; width: 100%;`)- require.Contains(t, body, `align="left" style="color: #5f5f5f;`)require.Contains(t, body, "Your Ente Space profile is still unfinished.")- require.Contains(t, body, `style="border-collapse: separate; border-spacing: 0; width: 100%;"`)require.Contains(t, body, `href="https://ente.space/app"`)require.Contains(t, body, "Finish setup")- require.Contains(t, body, `https://email-assets.ente.com/ente-2026-green.png`)- require.Contains(t, body, `class="footer-icons" style="width: 24px; padding: 4px"`)- require.Contains(t, body, "Ente Technologies, Inc.")}func TestSpaceDripTemplateOmitsCTAWithoutLabel(t *testing.T) {@@ -43,8 +36,6 @@ func TestSpaceDripTemplateOmitsCTAWithoutLabel(t *testing.T) {})require.NoError(t, err)require.Contains(t, body, "Reply to this email or drop a message on our Discord!")- require.Contains(t, body, `padding: 0 0 0; text-align: left;`)require.NotContains(t, body, `href="https://ente.space/app"`)require.NotContains(t, body, `Open Ente Space`)- require.Contains(t, body, `https://email-assets.ente.com/ente-2026-green.png`)}diff --git a/server/pkg/utils/handler/handler_test.go b/server/pkg/utils/handler/handler_test.goindex 3834e520ef..0627c740d9 100644--- a/server/pkg/utils/handler/handler_test.go+++ b/server/pkg/utils/handler/handler_test.go@@ -118,42 +118,6 @@ func TestErrorLogsWarnForInvalidJSON(t *testing.T) {require.Equal(t, "Request failed", entry.Message)}-func TestErrorLogsWarnForDirectBindJSONError(t *testing.T) {- gin.SetMode(gin.TestMode)-- recorder, ctx := invalidJSONContext()-- var payload map[string]string- err := BindJSON(ctx, &payload)- require.Error(t, err)-- hook := testLogHook(t)-- Error(ctx, err)-- require.Equal(t, http.StatusBadRequest, recorder.Code)- entry := hook.LastEntry()- require.NotNil(t, entry)- require.Equal(t, log.WarnLevel, entry.Level)- require.Equal(t, "Request failed", entry.Message)-}--func TestBindJSONPreservesErrorMessage(t *testing.T) {- gin.SetMode(gin.TestMode)-- _, rawCtx := invalidJSONContext()- var rawPayload map[string]string- rawErr := rawCtx.ShouldBindJSON(&rawPayload)- require.Error(t, rawErr)-- _, wrappedCtx := invalidJSONContext()- var wrappedPayload map[string]string- wrappedErr := BindJSON(wrappedCtx, &wrappedPayload)- require.Error(t, wrappedErr)-- require.Equal(t, rawErr.Error(), wrappedErr.Error())-}-func TestErrorLogsUnexpectedErrors(t *testing.T) {gin.SetMode(gin.TestMode)diff --git a/server/space/repo/slug_validation_test.go b/server/space/repo/slug_validation_test.goindex 9a4660dc90..f80c9aafdf 100644--- a/server/space/repo/slug_validation_test.go+++ b/server/space/repo/slug_validation_test.go@@ -87,94 +87,6 @@ func TestReservedSpaceSlugListBuildsLookup(t *testing.T) {require.Len(t, reservedSpaceSlugs, len(reservedSpaceSlugList))}-func TestValidateSpaceSlugRejectsReservedSlugs(t *testing.T) {- for _, slug := range []string{- "404",- "about",- "administration",- "apple-photos-alternative",- "archives",- "architecture",- "articles",- "auth",- "auth-ph",- "blackfriday",- "blog",- "blue",- "careers",- "cli",- "compare",- "contact",- "customers",- "desktop",- "discord",- "documentation",- "download",- "encryption",- "ensu",- "families",- "features",- "fosdem",- "get",- "github",- "google-photos-alternative",- "green",- "help",- "hunt",- "install",- "installation",- "instance",- "intern",- "jobs",- "locker",- "machine-learning",- "manifest",- "manifest.webmanifest",- "media-kit",- "mobile",- "moderators",- "mods",- "news",- "newsletter",- "paste",- "photos",- "photo-backup-for-families",- "press",- "pricing",- "privacy",- "profile",- "profile-link",- "rate",- "reliability",- "replication",- "rss",- "rss.xml",- "server",- "shop",- "space",- "support",- "sw.js",- "take-control",- "talks",- "terms",- "toys",- "translate",- "try",- "ente",- "ente-user",- } {- t.Run(slug, func(t *testing.T) {- _, err := ValidateSpaceSlug(slug)- require.Error(t, err)- if len(slug) < minSpaceSlugLength {- require.Contains(t, err.Error(), "spaceSlug must be 4-30 characters")- } else {- require.Contains(t, err.Error(), "spaceSlug is reserved")- }- })- }-}-func TestValidateSpaceSlugRejectsReservedFileSuffixes(t *testing.T) {for _, slug := range []string{"theme.css",@@ -195,131 +107,3 @@ func TestValidateSpaceSlugRejectsReservedFileSuffixes(t *testing.T) {})}}--func TestValidateSpaceSlugRejectsPhishingSlugs(t *testing.T) {- for _, slug := range []string{- "2fa",- "account-recovery",- "account-security",- "account-verification",- "account-verify",- "app-download",- "authenticate",- "authenticated",- "authenticator",- "authorization",- "authorize",- "backup",- "backups",- "bill",- "billing",- "callback",- "checkout",- "contact-support",- "customer-support",- "download-app",- "download-ente",- "downloads",- "email-verification",- "export",- "forgot",- "forgot-password",- "forgot_password",- "get-app",- "get-ente",- "get-started",- "getting-started",- "help-desk",- "helpdesk",- "import",- "install-app",- "install-ente",- "installer",- "installers",- "log-in",- "log.in",- "log_in",- "log-off",- "log.off",- "log_off",- "log-on",- "log.on",- "log_on",- "log-out",- "log.out",- "log_out",- "logoff",- "logon",- "magic-link",- "magic_link",- "mfa",- "migration",- "oauth",- "oauth2",- "onboarding",- "otp",- "passkey",- "password",- "password-reset",- "passwords",- "pay",- "payment",- "payments",- "plan",- "plans",- "recovery",- "reset",- "reset-password",- "restore",- "secure",- "secure-login",- "secure-sign-in",- "session",- "sessions",- "setup",- "setup-account",- "sign-in",- "sign.in",- "sign_in",- "sign-on",- "sign.on",- "sign_on",- "sign-out",- "sign.out",- "sign_out",- "sign-up",- "sign.up",- "sign_up",- "start",- "started",- "subscribe",- "subscription",- "subscriptions",- "support-team",- "support_team",- "token",- "tokens",- "totp",- "upgrade",- "verification",- "verify-account",- "verify-email",- "welcome",- "ente.space",- "space.ente",- "space-ente",- "space_ente",- "login.ente",- "support.ente",- } {- t.Run(slug, func(t *testing.T) {- _, err := ValidateSpaceSlug(slug)- require.Error(t, err)- if len(slug) < minSpaceSlugLength {- require.Contains(t, err.Error(), "spaceSlug must be 4-30 characters")- } else {- require.Contains(t, err.Error(), "spaceSlug is reserved")- }- })- }-}diff --git a/web/apps/photos/tests/collection.test.ts b/web/apps/photos/tests/collection.test.tsdeleted file mode 100644index c47854ccd6..0000000000--- a/web/apps/photos/tests/collection.test.ts+++ /dev/null@@ -1,24 +0,0 @@-import { findUserUncategorizedCollection } from "ente-media/collection";-import { describe, expect, test } from "vitest";--describe("findUserUncategorizedCollection", () => {- test("selects the collection owned by the user", () => {- const sharedCollection = { type: "uncategorized", owner: { id: 20 } };- const ownCollection = { type: "uncategorized", owner: { id: 10 } };-- expect(- findUserUncategorizedCollection(- [sharedCollection, ownCollection],- 10,- ),- ).toBe(ownCollection);- });-- test("does not return another user's collection", () => {- const sharedCollection = { type: "uncategorized", owner: { id: 20 } };-- expect(- findUserUncategorizedCollection([sharedCollection], 10),- ).toBeUndefined();- });-});