mirror of
https://github.com/AppFlowy-IO/AppFlowy.git
synced 2024-08-30 18:12:39 +00:00
chore: potential fail on trash bloc test (#1686)
This commit is contained in:
parent
e8b21955f8
commit
91efcafd77
@ -108,19 +108,19 @@ class BoardDataController {
|
|||||||
|
|
||||||
Future<Either<Unit, FlowyError>> openGrid() async {
|
Future<Either<Unit, FlowyError>> openGrid() async {
|
||||||
final result = await _gridFFIService.openGrid();
|
final result = await _gridFFIService.openGrid();
|
||||||
|
|
||||||
return result.fold(
|
return result.fold(
|
||||||
(grid) async {
|
(grid) async {
|
||||||
_onGridChanged?.call(grid);
|
_onGridChanged?.call(grid);
|
||||||
final result = await fieldController.loadFields(fieldIds: grid.fields);
|
return fieldController.loadFields(fieldIds: grid.fields).then((result) {
|
||||||
return result.fold(
|
return result.fold(
|
||||||
(l) {
|
(l) => Future(() async {
|
||||||
_loadGroups();
|
await _loadGroups();
|
||||||
_viewCache.rowCache.initializeRows(grid.rows);
|
_viewCache.rowCache.initializeRows(grid.rows);
|
||||||
return left(l);
|
return left(l);
|
||||||
},
|
}),
|
||||||
(err) => right(err),
|
(err) => right(err),
|
||||||
);
|
);
|
||||||
|
});
|
||||||
},
|
},
|
||||||
(err) => right(err),
|
(err) => right(err),
|
||||||
);
|
);
|
||||||
|
@ -10,22 +10,23 @@ void main() {
|
|||||||
boardTest = await AppFlowyBoardTest.ensureInitialized();
|
boardTest = await AppFlowyBoardTest.ensureInitialized();
|
||||||
});
|
});
|
||||||
|
|
||||||
group('$BoardBloc', () {
|
test('create kanban baord card', () async {
|
||||||
test('create kanban baord card', () async {
|
final context = await boardTest.createTestBoard();
|
||||||
final context = await boardTest.createTestBoard();
|
final boardBloc = BoardBloc(view: context.gridView)
|
||||||
final boardBloc = BoardBloc(view: context.gridView)
|
..add(const BoardEvent.initial());
|
||||||
..add(const BoardEvent.initial());
|
await boardResponseFuture();
|
||||||
await boardResponseFuture();
|
|
||||||
final groupId = boardBloc.state.groupIds.first;
|
|
||||||
|
|
||||||
// the group at index 0 is the 'No status' group;
|
final groupId = boardBloc.state.groupIds.first;
|
||||||
assert(boardBloc.groupControllers[groupId]!.group.rows.isEmpty);
|
|
||||||
assert(boardBloc.state.groupIds.length == 4);
|
|
||||||
|
|
||||||
boardBloc.add(BoardEvent.createBottomRow(boardBloc.state.groupIds[0]));
|
// the group at index 0 is the 'No status' group;
|
||||||
await boardResponseFuture();
|
assert(boardBloc.groupControllers[groupId]!.group.rows.isEmpty);
|
||||||
|
assert(boardBloc.state.groupIds.length == 4,
|
||||||
|
'but receive ${boardBloc.state.groupIds.length}');
|
||||||
|
|
||||||
assert(boardBloc.groupControllers[groupId]!.group.rows.length == 1);
|
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}');
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -18,6 +18,7 @@ class TrashTestContext {
|
|||||||
Future<void> initialize() async {
|
Future<void> initialize() async {
|
||||||
app = await unitTest.createTestApp();
|
app = await unitTest.createTestApp();
|
||||||
appBloc = AppBloc(app: app)..add(const AppEvent.initial());
|
appBloc = AppBloc(app: app)..add(const AppEvent.initial());
|
||||||
|
await blocResponseFuture();
|
||||||
|
|
||||||
appBloc.add(AppEvent.createView(
|
appBloc.add(AppEvent.createView(
|
||||||
"Document 1",
|
"Document 1",
|
||||||
@ -40,7 +41,7 @@ class TrashTestContext {
|
|||||||
await blocResponseFuture();
|
await blocResponseFuture();
|
||||||
|
|
||||||
allViews = [...appBloc.state.app.belongings.items];
|
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 permanently
|
// delete a view permanently
|
||||||
trashBloc.add(TrashEvent.delete(trashBloc.state.objects[0]));
|
trashBloc.add(TrashEvent.delete(trashBloc.state.objects[0]));
|
||||||
await blocResponseFuture();
|
await blocResponseFuture();
|
||||||
assert(trashBloc.state.objects.length == 2);
|
assert(trashBloc.state.objects.length == 2,
|
||||||
|
"but receive ${trashBloc.state.objects.length}");
|
||||||
|
|
||||||
// delete all view permanently
|
// delete all view permanently
|
||||||
trashBloc.add(const TrashEvent.deleteAll());
|
trashBloc.add(const TrashEvent.deleteAll());
|
||||||
await blocResponseFuture();
|
await blocResponseFuture();
|
||||||
assert(trashBloc.state.objects.isEmpty);
|
assert(trashBloc.state.objects.isEmpty,
|
||||||
|
"but receive ${trashBloc.state.objects.length}");
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user