rename 'collectionId' to 'albumId' in tests

This commit is contained in:
Wenqi Li 2020-08-18 16:41:24 +08:00
parent e79e0771cb
commit 95bd030e91
3 changed files with 11 additions and 12 deletions

View File

@ -68,10 +68,9 @@ void main() {
}); });
test('get collection thumbnail', () async { test('get collection thumbnail', () async {
String collectionId = "__ALL__"; String albumId = "__ALL__";
List result = await PhotoGallery.getAlbumThumbnail(albumId: collectionId); List result = await PhotoGallery.getAlbumThumbnail(albumId: albumId);
List expected = List expected = Generator.generateMockCollectionThumbnail(albumId: albumId);
Generator.generateMockCollectionThumbnail(collectionId: collectionId);
expect(result, expected); expect(result, expected);
}); });

View File

@ -13,7 +13,7 @@ class Generator {
"count": 5, "count": 5,
}, },
{ {
"id": "CollectionId", "id": "AlbumId",
"mediumType": mediumTypeToJson(mediumType), "mediumType": mediumTypeToJson(mediumType),
"name": "CollectionName", "name": "CollectionName",
"count": 5, "count": 5,
@ -28,7 +28,7 @@ class Generator {
} }
static dynamic generateMediaPageJson({ static dynamic generateMediaPageJson({
String collectionId, String albumId,
MediumType mediumType, MediumType mediumType,
int total, int total,
int skip, int skip,
@ -72,7 +72,7 @@ class Generator {
int take, int take,
}) { }) {
dynamic json = generateMediaPageJson( dynamic json = generateMediaPageJson(
collectionId: collection.id, albumId: collection.id,
mediumType: mediumType, mediumType: mediumType,
total: collection.count, total: collection.count,
skip: skip, skip: skip,
@ -98,7 +98,7 @@ class Generator {
} }
static List<int> generateMockCollectionThumbnail({ static List<int> generateMockCollectionThumbnail({
String collectionId, String albumId,
}) { }) {
return [1, 2, 3, 4, 5, 6, 7, 8, 9]; return [1, 2, 3, 4, 5, 6, 7, 8, 9];
} }

View File

@ -11,13 +11,13 @@ Future<dynamic> mockMethodCallHandler(MethodCall call) async {
Generator.generateCollectionsJson(mediumType: mediumType); Generator.generateCollectionsJson(mediumType: mediumType);
return collections; return collections;
} else if (call.method == "listMedia") { } else if (call.method == "listMedia") {
String collectionId = call.arguments['collectionId']; String albumId = call.arguments['albumId'];
MediumType mediumType = jsonToMediumType(call.arguments['mediumType']); MediumType mediumType = jsonToMediumType(call.arguments['mediumType']);
int total = call.arguments['total']; int total = call.arguments['total'];
int skip = call.arguments['skip']; int skip = call.arguments['skip'];
int take = call.arguments['take']; int take = call.arguments['take'];
dynamic mediaPage = Generator.generateMediaPageJson( dynamic mediaPage = Generator.generateMediaPageJson(
collectionId: collectionId, albumId: albumId,
mediumType: mediumType, mediumType: mediumType,
total: total, total: total,
skip: skip, skip: skip,
@ -37,9 +37,9 @@ Future<dynamic> mockMethodCallHandler(MethodCall call) async {
mediumId: mediumId, mediumType: mediumType); mediumId: mediumId, mediumType: mediumType);
return thumbnail; return thumbnail;
} else if (call.method == "getAlbumThumbnail") { } else if (call.method == "getAlbumThumbnail") {
String collectionId = call.arguments['collectionId']; String albumId = call.arguments['albumId'];
dynamic thumbnail = dynamic thumbnail =
Generator.generateMockCollectionThumbnail(collectionId: collectionId); Generator.generateMockCollectionThumbnail(albumId: albumId);
return thumbnail; return thumbnail;
} else if (call.method == "getFile") { } else if (call.method == "getFile") {
String mediumId = call.arguments['mediumId']; String mediumId = call.arguments['mediumId'];