From a1182bfbae080c2456ca0c80b34fe4b65191c118 Mon Sep 17 00:00:00 2001 From: Ming Ming Date: Fri, 7 Jan 2022 11:21:00 +0800 Subject: [PATCH] Fix tests broken after downgrading flutter --- test/entity/file/data_source_test.dart | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/test/entity/file/data_source_test.dart b/test/entity/file/data_source_test.dart index d3fc8e54..5f455828 100644 --- a/test/entity/file/data_source_test.dart +++ b/test/entity/file/data_source_test.dart @@ -79,7 +79,7 @@ Future _removeFile() async { await src.remove(account, files[1]); expect( (await util.listAppDb( - appDb, AppDb.file2StoreName, AppDbFile2Entry.fromJson)) + appDb, AppDb.file2StoreName, (e) => AppDbFile2Entry.fromJson(e))) .map((e) => e.file) .toList(), [files[0]], @@ -106,7 +106,8 @@ Future _removeEmptyDir() async { // parent dir is not updated, parent dir is only updated when syncing with // remote expect( - await util.listAppDb(appDb, AppDb.dirStoreName, AppDbDirEntry.fromJson), + await util.listAppDb( + appDb, AppDb.dirStoreName, (e) => AppDbDirEntry.fromJson(e)), [ AppDbDirEntry.fromFiles(account, files[0], [files[1]]), ], @@ -132,7 +133,7 @@ Future _removeDir() async { await src.remove(account, files[1]); expect( (await util.listAppDb( - appDb, AppDb.file2StoreName, AppDbFile2Entry.fromJson)) + appDb, AppDb.file2StoreName, (e) => AppDbFile2Entry.fromJson(e))) .map((e) => e.file) .toList(), [files[0]], @@ -159,14 +160,15 @@ Future _removeDirWithSubDir() async { final src = FileAppDbDataSource(appDb); await src.remove(account, files[1]); expect( - await util.listAppDb(appDb, AppDb.dirStoreName, AppDbDirEntry.fromJson), + await util.listAppDb( + appDb, AppDb.dirStoreName, (e) => AppDbDirEntry.fromJson(e)), [ AppDbDirEntry.fromFiles(account, files[0], [files[1]]), ], ); expect( (await util.listAppDb( - appDb, AppDb.file2StoreName, AppDbFile2Entry.fromJson)) + appDb, AppDb.file2StoreName, (e) => AppDbFile2Entry.fromJson(e))) .map((e) => e.file) .toList(), [files[0]], @@ -207,14 +209,15 @@ Future _updateProperty() async { overrideDateTime: OrNull(DateTime.utc(2020, 1, 2, 3, 4, 5, 678)), ); expect( - await util.listAppDb(appDb, AppDb.dirStoreName, AppDbDirEntry.fromJson), + await util.listAppDb( + appDb, AppDb.dirStoreName, (e) => AppDbDirEntry.fromJson(e)), [ AppDbDirEntry.fromFiles(account, files[0], [expectFile]), ], ); expect( (await util.listAppDb( - appDb, AppDb.file2StoreName, AppDbFile2Entry.fromJson)) + appDb, AppDb.file2StoreName, (e) => AppDbFile2Entry.fromJson(e))) .map((e) => e.file) .toList(), [files[0], expectFile],