π End-to-end encrypted cloud for everything.
Dart 2faandroidauthye2eeencryptionend-to-end-encryptionfluttergolanggoogle-photosgoogle-photos-alternativeiosopensourcephotosprivacyprivacy-toolstypescriptzero-knowledge
Remove redundant Flutter collection parser tests
Neeraj Gupta4ee0af3efa74
diff --git a/mobile/apps/locker/test/services/collections/models/collection_change_test.dart b/mobile/apps/locker/test/services/collections/models/collection_change_test.dartdeleted file mode 100644index 0fed451da1..0000000000--- a/mobile/apps/locker/test/services/collections/models/collection_change_test.dart+++ /dev/null@@ -1,59 +0,0 @@-import 'package:flutter_test/flutter_test.dart';-import 'package:locker/services/collections/models/collection.dart';-import 'package:locker/services/collections/models/collection_change.dart';--void main() {- group('isSharedCollectionDeletion', () {- test('accepts sparse and legacy full foreign deletions', () {- final sparse = {- 'id': 7,- 'owner': {'id': 1},- 'updationTime': 9,- 'isDeleted': true,- };- final legacyFull = {- ...sparse,- 'encryptedKey': 'compatibility-key',- 'keyDecryptionNonce': 'nonce',- 'type': 'album',- 'attributes': <String, dynamic>{},- 'name': 'Deleted Collection',- };-- expect(isSharedCollectionDeletion(sparse, 2), isTrue);- expect(isSharedCollectionDeletion(legacyFull, 2), isTrue);- });-- test('keeps owned deletions and active collections as updates', () {- final ownedDeletion = {- 'id': 7,- 'owner': {'id': 2, 'email': '[email protected]'},- 'encryptedKey': 'owned-key',- 'keyDecryptionNonce': 'owned-nonce',- 'name': 'Deleted Collection',- 'encryptedName': 'encrypted-name',- 'nameDecryptionNonce': 'name-nonce',- 'type': 'folder',- 'attributes': <String, dynamic>{},- 'sharees': <Map<String, dynamic>>[],- 'publicURLs': <Map<String, dynamic>>[],- 'updationTime': 9,- 'isDeleted': true,- };- final active = {- ...ownedDeletion,- 'id': 8,- 'owner': {'id': 1},- 'isDeleted': false,- };-- expect(isSharedCollectionDeletion(ownedDeletion, 2), isFalse);- expect(isSharedCollectionDeletion(active, 2), isFalse);-- final collection = Collection.fromMap(ownedDeletion);- expect(collection.encryptedKey, 'owned-key');- expect(collection.keyDecryptionNonce, 'owned-nonce');- expect(collection.isDeleted, isTrue);- });- });-}diff --git a/mobile/apps/photos/test/gateways/collections/models/collection_change_test.dart b/mobile/apps/photos/test/gateways/collections/models/collection_change_test.dartdeleted file mode 100644index cd4e518d1f..0000000000--- a/mobile/apps/photos/test/gateways/collections/models/collection_change_test.dart+++ /dev/null@@ -1,84 +0,0 @@-import 'package:flutter_test/flutter_test.dart';-import 'package:photos/gateways/collections/models/collection_change.dart';--void main() {- const currentUserID = 2;-- test('classifies a full legacy foreign deletion as a tombstone', () {- final data = _fullCollection(ownerID: 1, isDeleted: true);-- final change = RemoteCollectionChange.fromMap(data, currentUserID);-- expect(change, isA<RemoteCollectionDeletion>());- _expectDeletion(change as RemoteCollectionDeletion);- });-- test('classifies the compatibility sparse deletion as a tombstone', () {- final change = RemoteCollectionChange.fromMap({- 'id': 7,- 'owner': {'id': 1, 'email': ''},- 'encryptedKey': 'compatibility-key',- 'type': 'album',- 'attributes': <String, dynamic>{},- 'updationTime': 9,- 'isDeleted': true,- }, currentUserID);-- expect(change, isA<RemoteCollectionDeletion>());- _expectDeletion(change as RemoteCollectionDeletion);- });-- test('classifies a future minimal foreign deletion as a tombstone', () {- final change = RemoteCollectionChange.fromMap({- 'id': 7,- 'owner': {'id': 1},- 'updationTime': 9,- 'isDeleted': true,- }, currentUserID);-- expect(change, isA<RemoteCollectionDeletion>());- _expectDeletion(change as RemoteCollectionDeletion);- });-- test('retains an active foreign collection as an update', () {- final data = _fullCollection(ownerID: 1, isDeleted: false);-- final change = RemoteCollectionChange.fromMap(data, currentUserID);-- expect(change, isA<RemoteCollectionUpdate>());- expect((change as RemoteCollectionUpdate).data, same(data));- });-- test('retains a full owned deletion as an update', () {- final data = _fullCollection(ownerID: currentUserID, isDeleted: true);-- final change = RemoteCollectionChange.fromMap(data, currentUserID);-- expect(change, isA<RemoteCollectionUpdate>());- expect((change as RemoteCollectionUpdate).data, same(data));- });-}--Map<String, dynamic> _fullCollection({- required int ownerID,- required bool isDeleted,-}) => <String, dynamic>{- 'id': 7,- 'owner': {'id': ownerID, 'email': '[email protected]'},- 'encryptedKey': 'encrypted-key',- 'name': '',- 'encryptedName': 'encrypted-name',- 'nameDecryptionNonce': 'name-nonce',- 'type': 'album',- 'attributes': <String, dynamic>{},- 'sharees': <dynamic>[],- 'publicURLs': <dynamic>[],- 'updationTime': 9,- 'isDeleted': isDeleted,-};--void _expectDeletion(RemoteCollectionDeletion deletion) {- expect(deletion.id, 7);- expect(deletion.ownerID, 1);- expect(deletion.updationTime, 9);-}