Skip to content

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.

ci: serial flutter unit test (#1814)

Nathan.fooo5f760ad578ff
diff --git a/frontend/app_flowy/lib/core/folder_notification.dart b/frontend/app_flowy/lib/core/folder_notification.dart
index 4b5d306eac..4d147da88e 100644
--- a/frontend/app_flowy/lib/core/folder_notification.dart
+++ b/frontend/app_flowy/lib/core/folder_notification.dart
@@ -10,7 +10,9 @@ import 'notification_helper.dart';
// Folder
typedef FolderNotificationCallback = void Function(
- FolderNotification, Either<Uint8List, FlowyError>);
+ FolderNotification,
+ Either<Uint8List, FlowyError>,
+);
class FolderNotificationParser
extends NotificationParser<FolderNotification, FlowyError> {
@@ -25,15 +27,21 @@ class FolderNotificationParser
}
typedef FolderNotificationHandler = Function(
- FolderNotification ty, Either<Uint8List, FlowyError> result);
+ FolderNotification ty,
+ Either<Uint8List, FlowyError> result,
+);
class FolderNotificationListener {
StreamSubscription<SubscribeObject>? _subscription;
FolderNotificationParser? _parser;
- FolderNotificationListener(
- {required String objectId, required FolderNotificationHandler handler})
- : _parser = FolderNotificationParser(id: objectId, callback: handler) {
+ FolderNotificationListener({
+ required String objectId,
+ required FolderNotificationHandler handler,
+ }) : _parser = FolderNotificationParser(
+ id: objectId,
+ callback: handler,
+ ) {
_subscription =
RustStreamReceiver.listen((observable) => _parser?.parse(observable));
}
diff --git a/frontend/app_flowy/lib/core/grid_notification.dart b/frontend/app_flowy/lib/core/grid_notification.dart
index 1efcbd7172..16fa0a207c 100644
--- a/frontend/app_flowy/lib/core/grid_notification.dart
+++ b/frontend/app_flowy/lib/core/grid_notification.dart
@@ -10,7 +10,9 @@ import 'notification_helper.dart';
// DatabasePB
typedef DatabaseNotificationCallback = void Function(
- DatabaseNotification, Either<Uint8List, FlowyError>);
+ DatabaseNotification,
+ Either<Uint8List, FlowyError>,
+);
class DatabaseNotificationParser
extends NotificationParser<DatabaseNotification, FlowyError> {
@@ -31,9 +33,10 @@ class DatabaseNotificationListener {
StreamSubscription<SubscribeObject>? _subscription;
DatabaseNotificationParser? _parser;
- DatabaseNotificationListener(
- {required String objectId, required DatabaseNotificationHandler handler})
- : _parser = DatabaseNotificationParser(id: objectId, callback: handler) {
+ DatabaseNotificationListener({
+ required String objectId,
+ required DatabaseNotificationHandler handler,
+ }) : _parser = DatabaseNotificationParser(id: objectId, callback: handler) {
_subscription =
RustStreamReceiver.listen((observable) => _parser?.parse(observable));
}
diff --git a/frontend/app_flowy/lib/core/user_notification.dart b/frontend/app_flowy/lib/core/user_notification.dart
index 36524e7e35..8fa2399459 100644
--- a/frontend/app_flowy/lib/core/user_notification.dart
+++ b/frontend/app_flowy/lib/core/user_notification.dart
@@ -10,7 +10,9 @@ import 'notification_helper.dart';
// User
typedef UserNotificationCallback = void Function(
- UserNotification, Either<Uint8List, FlowyError>);
+ UserNotification,
+ Either<Uint8List, FlowyError>,
+);
class UserNotificationParser
extends NotificationParser<UserNotification, FlowyError> {
@@ -31,9 +33,10 @@ class UserNotificationListener {
StreamSubscription<SubscribeObject>? _subscription;
UserNotificationParser? _parser;
- UserNotificationListener(
- {required String objectId, required UserNotificationHandler handler})
- : _parser = UserNotificationParser(id: objectId, callback: handler) {
+ UserNotificationListener({
+ required String objectId,
+ required UserNotificationHandler handler,
+ }) : _parser = UserNotificationParser(id: objectId, callback: handler) {
_subscription =
RustStreamReceiver.listen((observable) => _parser?.parse(observable));
}
diff --git a/frontend/app_flowy/lib/plugins/trash/application/trash_listener.dart b/frontend/app_flowy/lib/plugins/trash/application/trash_listener.dart
index 142eb8f26e..95d2fcf126 100644
--- a/frontend/app_flowy/lib/plugins/trash/application/trash_listener.dart
+++ b/frontend/app_flowy/lib/plugins/trash/application/trash_listener.dart
@@ -9,7 +9,8 @@ import 'package:appflowy_backend/protobuf/flowy-folder/trash.pb.dart';
import 'package:appflowy_backend/rust_stream.dart';
typedef TrashUpdatedCallback = void Function(
- Either<List<TrashPB>, FlowyError> trashOrFailed);
+ Either<List<TrashPB>, FlowyError> trashOrFailed,
+);
class TrashListener {
StreamSubscription<SubscribeObject>? _subscription;
@@ -24,7 +25,9 @@ class TrashListener {
}
void _observableCallback(
- FolderNotification ty, Either<Uint8List, FlowyError> result) {
+ FolderNotification ty,
+ Either<Uint8List, FlowyError> result,
+ ) {
switch (ty) {
case FolderNotification.TrashUpdated:
if (_trashUpdated != null) {
diff --git a/frontend/app_flowy/packages/appflowy_backend/lib/rust_stream.dart b/frontend/app_flowy/packages/appflowy_backend/lib/rust_stream.dart
index 0fa8c3ffed..02aa671ffa 100644
--- a/frontend/app_flowy/packages/appflowy_backend/lib/rust_stream.dart
+++ b/frontend/app_flowy/packages/appflowy_backend/lib/rust_stream.dart
@@ -23,7 +23,7 @@ class RustStreamReceiver {
_observableController = StreamController.broadcast();
_ffiPort.handler = _streamController.add;
- _ffiSubscription = _streamController.stream.listen(streamCallback);
+ _ffiSubscription = _streamController.stream.listen(_streamCallback);
}
factory RustStreamReceiver() {
@@ -35,7 +35,7 @@ class RustStreamReceiver {
return RustStreamReceiver.shared.observable.stream.listen(callback);
}
- void streamCallback(Uint8List bytes) {
+ void _streamCallback(Uint8List bytes) {
try {
final observable = SubscribeObject.fromBuffer(bytes);
_observableController.add(observable);
diff --git a/frontend/scripts/makefile/tests.toml b/frontend/scripts/makefile/tests.toml
index 3d2d3c9708..a248478849 100644
--- a/frontend/scripts/makefile/tests.toml
+++ b/frontend/scripts/makefile/tests.toml
@@ -18,12 +18,12 @@ cargo make --profile test-linux dart_unit_test_inner
script_runner = "@shell"
[tasks.dart_unit_test_inner]
-env = { RUST_LOG = "info" }
+env = { RUST_LOG = "info", TEST_RUST_LOG = "info" }
dependencies = ["build-test-lib"]
description = "Run flutter unit tests"
script = '''
cd app_flowy
-flutter test --dart-define=RUST_LOG=${TEST_RUST_LOG} --concurrency=1
+flutter test --dart-define=RUST_LOG=${TEST_RUST_LOG} -j, --concurrency=1
'''
[tasks.rust_unit_test]