Skip to content

Commit 91efcaf

Browse files
authored
chore: potential fail on trash bloc test (#1686)
1 parent e8b2195 commit 91efcaf

File tree

3 files changed

+34
-30
lines changed

3 files changed

+34
-30
lines changed

frontend/app_flowy/lib/plugins/board/application/board_data_controller.dart

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -108,19 +108,19 @@ class BoardDataController {
108108

109109
Future<Either<Unit, FlowyError>> openGrid() async {
110110
final result = await _gridFFIService.openGrid();
111-
112111
return result.fold(
113112
(grid) async {
114113
_onGridChanged?.call(grid);
115-
final result = await fieldController.loadFields(fieldIds: grid.fields);
116-
return result.fold(
117-
(l) {
118-
_loadGroups();
119-
_viewCache.rowCache.initializeRows(grid.rows);
120-
return left(l);
121-
},
122-
(err) => right(err),
123-
);
114+
return fieldController.loadFields(fieldIds: grid.fields).then((result) {
115+
return result.fold(
116+
(l) => Future(() async {
117+
await _loadGroups();
118+
_viewCache.rowCache.initializeRows(grid.rows);
119+
return left(l);
120+
}),
121+
(err) => right(err),
122+
);
123+
});
124124
},
125125
(err) => right(err),
126126
);

frontend/app_flowy/test/bloc_test/board_test/create_card_test.dart

Lines changed: 18 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -10,22 +10,23 @@ void main() {
1010
boardTest = await AppFlowyBoardTest.ensureInitialized();
1111
});
1212

13-
group('$BoardBloc', () {
14-
test('create kanban baord card', () async {
15-
final context = await boardTest.createTestBoard();
16-
final boardBloc = BoardBloc(view: context.gridView)
17-
..add(const BoardEvent.initial());
18-
await boardResponseFuture();
19-
final groupId = boardBloc.state.groupIds.first;
20-
21-
// the group at index 0 is the 'No status' group;
22-
assert(boardBloc.groupControllers[groupId]!.group.rows.isEmpty);
23-
assert(boardBloc.state.groupIds.length == 4);
24-
25-
boardBloc.add(BoardEvent.createBottomRow(boardBloc.state.groupIds[0]));
26-
await boardResponseFuture();
27-
28-
assert(boardBloc.groupControllers[groupId]!.group.rows.length == 1);
29-
});
13+
test('create kanban baord card', () async {
14+
final context = await boardTest.createTestBoard();
15+
final boardBloc = BoardBloc(view: context.gridView)
16+
..add(const BoardEvent.initial());
17+
await boardResponseFuture();
18+
19+
final groupId = boardBloc.state.groupIds.first;
20+
21+
// the group at index 0 is the 'No status' group;
22+
assert(boardBloc.groupControllers[groupId]!.group.rows.isEmpty);
23+
assert(boardBloc.state.groupIds.length == 4,
24+
'but receive ${boardBloc.state.groupIds.length}');
25+
26+
boardBloc.add(BoardEvent.createBottomRow(boardBloc.state.groupIds[0]));
27+
await boardResponseFuture();
28+
29+
assert(boardBloc.groupControllers[groupId]!.group.rows.length == 1,
30+
'but receive ${boardBloc.groupControllers[groupId]!.group.rows.length}');
3031
});
3132
}

frontend/app_flowy/test/bloc_test/home_test/trash_bloc_test.dart

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ class TrashTestContext {
1818
Future<void> initialize() async {
1919
app = await unitTest.createTestApp();
2020
appBloc = AppBloc(app: app)..add(const AppEvent.initial());
21+
await blocResponseFuture();
2122

2223
appBloc.add(AppEvent.createView(
2324
"Document 1",
@@ -40,7 +41,7 @@ class TrashTestContext {
4041
await blocResponseFuture();
4142

4243
allViews = [...appBloc.state.app.belongings.items];
43-
assert(allViews.length == 3);
44+
assert(allViews.length == 3, 'but receive ${allViews.length}');
4445
}
4546
}
4647

@@ -89,12 +90,14 @@ void main() {
8990
// delete a view permanently
9091
trashBloc.add(TrashEvent.delete(trashBloc.state.objects[0]));
9192
await blocResponseFuture();
92-
assert(trashBloc.state.objects.length == 2);
93+
assert(trashBloc.state.objects.length == 2,
94+
"but receive ${trashBloc.state.objects.length}");
9395

9496
// delete all view permanently
9597
trashBloc.add(const TrashEvent.deleteAll());
9698
await blocResponseFuture();
97-
assert(trashBloc.state.objects.isEmpty);
99+
assert(trashBloc.state.objects.isEmpty,
100+
"but receive ${trashBloc.state.objects.length}");
98101
});
99102
});
100103
}

0 commit comments

Comments
 (0)