Bring projects, wikis, and teams together with AI. AppFlowy is the AI collaborative workspace where you achieve more without losing control of your data. The leading open source Notion alternative.
Dart blogconfluence-alternativecontent-managementcontent-servicesdocumentationflutternote-takingnotion-alternativeproject-managementtask-managementteam-collaborationwiki
chore: potential fail on trash bloc test (#1686)
Nathan.fooo91efcafd776b
diff --git a/frontend/app_flowy/lib/plugins/board/application/board_data_controller.dart b/frontend/app_flowy/lib/plugins/board/application/board_data_controller.dartindex 376b59147a..477909076e 100644--- a/frontend/app_flowy/lib/plugins/board/application/board_data_controller.dart+++ b/frontend/app_flowy/lib/plugins/board/application/board_data_controller.dart@@ -108,19 +108,19 @@ class BoardDataController {Future<Either<Unit, FlowyError>> openGrid() async {final result = await _gridFFIService.openGrid();-return result.fold((grid) async {_onGridChanged?.call(grid);- final result = await fieldController.loadFields(fieldIds: grid.fields);- return result.fold(- (l) {- _loadGroups();- _viewCache.rowCache.initializeRows(grid.rows);- return left(l);- },- (err) => right(err),- );+ return fieldController.loadFields(fieldIds: grid.fields).then((result) {+ return result.fold(+ (l) => Future(() async {+ await _loadGroups();+ _viewCache.rowCache.initializeRows(grid.rows);+ return left(l);+ }),+ (err) => right(err),+ );+ });},(err) => right(err),);diff --git a/frontend/app_flowy/test/bloc_test/board_test/create_card_test.dart b/frontend/app_flowy/test/bloc_test/board_test/create_card_test.dartindex 429d2aaffb..33168e6a0a 100644--- a/frontend/app_flowy/test/bloc_test/board_test/create_card_test.dart+++ b/frontend/app_flowy/test/bloc_test/board_test/create_card_test.dart@@ -10,22 +10,23 @@ void main() {boardTest = await AppFlowyBoardTest.ensureInitialized();});- group('$BoardBloc', () {- test('create kanban baord card', () async {- final context = await boardTest.createTestBoard();- final boardBloc = BoardBloc(view: context.gridView)- ..add(const BoardEvent.initial());- await boardResponseFuture();- final groupId = boardBloc.state.groupIds.first;-- // the group at index 0 is the 'No status' group;- assert(boardBloc.groupControllers[groupId]!.group.rows.isEmpty);- assert(boardBloc.state.groupIds.length == 4);-- boardBloc.add(BoardEvent.createBottomRow(boardBloc.state.groupIds[0]));- await boardResponseFuture();-- assert(boardBloc.groupControllers[groupId]!.group.rows.length == 1);- });+ test('create kanban baord card', () async {+ final context = await boardTest.createTestBoard();+ final boardBloc = BoardBloc(view: context.gridView)+ ..add(const BoardEvent.initial());+ await boardResponseFuture();++ final groupId = boardBloc.state.groupIds.first;++ // the group at index 0 is the 'No status' group;+ assert(boardBloc.groupControllers[groupId]!.group.rows.isEmpty);+ assert(boardBloc.state.groupIds.length == 4,+ 'but receive ${boardBloc.state.groupIds.length}');++ boardBloc.add(BoardEvent.createBottomRow(boardBloc.state.groupIds[0]));+ await boardResponseFuture();++ assert(boardBloc.groupControllers[groupId]!.group.rows.length == 1,+ 'but receive ${boardBloc.groupControllers[groupId]!.group.rows.length}');});}diff --git a/frontend/app_flowy/test/bloc_test/home_test/trash_bloc_test.dart b/frontend/app_flowy/test/bloc_test/home_test/trash_bloc_test.dartindex 82f3db8874..cbabecacd5 100644--- a/frontend/app_flowy/test/bloc_test/home_test/trash_bloc_test.dart+++ b/frontend/app_flowy/test/bloc_test/home_test/trash_bloc_test.dart@@ -18,6 +18,7 @@ class TrashTestContext {Future<void> initialize() async {app = await unitTest.createTestApp();appBloc = AppBloc(app: app)..add(const AppEvent.initial());+ await blocResponseFuture();appBloc.add(AppEvent.createView("Document 1",@@ -40,7 +41,7 @@ class TrashTestContext {await blocResponseFuture();allViews = [...appBloc.state.app.belongings.items];- assert(allViews.length == 3);+ assert(allViews.length == 3, 'but receive ${allViews.length}');}}@@ -89,12 +90,14 @@ void main() {// delete a view permanentlytrashBloc.add(TrashEvent.delete(trashBloc.state.objects[0]));await blocResponseFuture();- assert(trashBloc.state.objects.length == 2);+ assert(trashBloc.state.objects.length == 2,+ "but receive ${trashBloc.state.objects.length}");// delete all view permanentlytrashBloc.add(const TrashEvent.deleteAll());await blocResponseFuture();- assert(trashBloc.state.objects.isEmpty);+ assert(trashBloc.state.objects.isEmpty,+ "but receive ${trashBloc.state.objects.length}");});});}