Skip to content

Commit 5f760ad

Browse files
authored
ci: serial flutter unit test (#1814)
1 parent e2f6f68 commit 5f760ad

File tree

6 files changed

+36
-19
lines changed

6 files changed

+36
-19
lines changed

frontend/app_flowy/lib/core/folder_notification.dart

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,9 @@ import 'notification_helper.dart';
1010

1111
// Folder
1212
typedef FolderNotificationCallback = void Function(
13-
FolderNotification, Either<Uint8List, FlowyError>);
13+
FolderNotification,
14+
Either<Uint8List, FlowyError>,
15+
);
1416

1517
class FolderNotificationParser
1618
extends NotificationParser<FolderNotification, FlowyError> {
@@ -25,15 +27,21 @@ class FolderNotificationParser
2527
}
2628

2729
typedef FolderNotificationHandler = Function(
28-
FolderNotification ty, Either<Uint8List, FlowyError> result);
30+
FolderNotification ty,
31+
Either<Uint8List, FlowyError> result,
32+
);
2933

3034
class FolderNotificationListener {
3135
StreamSubscription<SubscribeObject>? _subscription;
3236
FolderNotificationParser? _parser;
3337

34-
FolderNotificationListener(
35-
{required String objectId, required FolderNotificationHandler handler})
36-
: _parser = FolderNotificationParser(id: objectId, callback: handler) {
38+
FolderNotificationListener({
39+
required String objectId,
40+
required FolderNotificationHandler handler,
41+
}) : _parser = FolderNotificationParser(
42+
id: objectId,
43+
callback: handler,
44+
) {
3745
_subscription =
3846
RustStreamReceiver.listen((observable) => _parser?.parse(observable));
3947
}

frontend/app_flowy/lib/core/grid_notification.dart

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,9 @@ import 'notification_helper.dart';
1010

1111
// DatabasePB
1212
typedef DatabaseNotificationCallback = void Function(
13-
DatabaseNotification, Either<Uint8List, FlowyError>);
13+
DatabaseNotification,
14+
Either<Uint8List, FlowyError>,
15+
);
1416

1517
class DatabaseNotificationParser
1618
extends NotificationParser<DatabaseNotification, FlowyError> {
@@ -31,9 +33,10 @@ class DatabaseNotificationListener {
3133
StreamSubscription<SubscribeObject>? _subscription;
3234
DatabaseNotificationParser? _parser;
3335

34-
DatabaseNotificationListener(
35-
{required String objectId, required DatabaseNotificationHandler handler})
36-
: _parser = DatabaseNotificationParser(id: objectId, callback: handler) {
36+
DatabaseNotificationListener({
37+
required String objectId,
38+
required DatabaseNotificationHandler handler,
39+
}) : _parser = DatabaseNotificationParser(id: objectId, callback: handler) {
3740
_subscription =
3841
RustStreamReceiver.listen((observable) => _parser?.parse(observable));
3942
}

frontend/app_flowy/lib/core/user_notification.dart

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,9 @@ import 'notification_helper.dart';
1010

1111
// User
1212
typedef UserNotificationCallback = void Function(
13-
UserNotification, Either<Uint8List, FlowyError>);
13+
UserNotification,
14+
Either<Uint8List, FlowyError>,
15+
);
1416

1517
class UserNotificationParser
1618
extends NotificationParser<UserNotification, FlowyError> {
@@ -31,9 +33,10 @@ class UserNotificationListener {
3133
StreamSubscription<SubscribeObject>? _subscription;
3234
UserNotificationParser? _parser;
3335

34-
UserNotificationListener(
35-
{required String objectId, required UserNotificationHandler handler})
36-
: _parser = UserNotificationParser(id: objectId, callback: handler) {
36+
UserNotificationListener({
37+
required String objectId,
38+
required UserNotificationHandler handler,
39+
}) : _parser = UserNotificationParser(id: objectId, callback: handler) {
3740
_subscription =
3841
RustStreamReceiver.listen((observable) => _parser?.parse(observable));
3942
}

frontend/app_flowy/lib/plugins/trash/application/trash_listener.dart

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,8 @@ import 'package:appflowy_backend/protobuf/flowy-folder/trash.pb.dart';
99
import 'package:appflowy_backend/rust_stream.dart';
1010

1111
typedef TrashUpdatedCallback = void Function(
12-
Either<List<TrashPB>, FlowyError> trashOrFailed);
12+
Either<List<TrashPB>, FlowyError> trashOrFailed,
13+
);
1314

1415
class TrashListener {
1516
StreamSubscription<SubscribeObject>? _subscription;
@@ -24,7 +25,9 @@ class TrashListener {
2425
}
2526

2627
void _observableCallback(
27-
FolderNotification ty, Either<Uint8List, FlowyError> result) {
28+
FolderNotification ty,
29+
Either<Uint8List, FlowyError> result,
30+
) {
2831
switch (ty) {
2932
case FolderNotification.TrashUpdated:
3033
if (_trashUpdated != null) {

frontend/app_flowy/packages/appflowy_backend/lib/rust_stream.dart

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ class RustStreamReceiver {
2323
_observableController = StreamController.broadcast();
2424

2525
_ffiPort.handler = _streamController.add;
26-
_ffiSubscription = _streamController.stream.listen(streamCallback);
26+
_ffiSubscription = _streamController.stream.listen(_streamCallback);
2727
}
2828

2929
factory RustStreamReceiver() {
@@ -35,7 +35,7 @@ class RustStreamReceiver {
3535
return RustStreamReceiver.shared.observable.stream.listen(callback);
3636
}
3737

38-
void streamCallback(Uint8List bytes) {
38+
void _streamCallback(Uint8List bytes) {
3939
try {
4040
final observable = SubscribeObject.fromBuffer(bytes);
4141
_observableController.add(observable);

frontend/scripts/makefile/tests.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,12 +18,12 @@ cargo make --profile test-linux dart_unit_test_inner
1818
script_runner = "@shell"
1919

2020
[tasks.dart_unit_test_inner]
21-
env = { RUST_LOG = "info" }
21+
env = { RUST_LOG = "info", TEST_RUST_LOG = "info" }
2222
dependencies = ["build-test-lib"]
2323
description = "Run flutter unit tests"
2424
script = '''
2525
cd app_flowy
26-
flutter test --dart-define=RUST_LOG=${TEST_RUST_LOG} --concurrency=1
26+
flutter test --dart-define=RUST_LOG=${TEST_RUST_LOG} -j, --concurrency=1
2727
'''
2828

2929
[tasks.rust_unit_test]

0 commit comments

Comments
 (0)