فهرست منبع

ci: serial flutter unit test (#1814)

Nathan.fooo 2 سال پیش
والد
کامیت
5f760ad578

+ 13 - 5
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));
   }

+ 7 - 4
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));
   }

+ 7 - 4
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));
   }

+ 5 - 2
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) {

+ 2 - 2
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);

+ 2 - 2
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]