diff --git a/melos.yaml b/melos.yaml index 40a37274..10e7ca7b 100644 --- a/melos.yaml +++ b/melos.yaml @@ -8,6 +8,10 @@ packages: - packages/** scripts: + postclean: + run: melos run clean:flutter --no-select + description: Runs "flutter clean" in all Flutter packages + lint:all: run: melos run analyze && melos run format description: Run all static analysis checks @@ -75,6 +79,12 @@ scripts: flutter: true dir-exists: test + clean:flutter: + run: melos exec -c 4 --fail-fast -- "flutter clean" + description: Run Flutter clean for a specific package in this project. + select-package: + flutter: true + coverage:ignore-file: run: | melos exec -c 5 --fail-fast -- "\$MELOS_ROOT_PATH/.github/workflows/scripts/remove-from-coverage.sh" diff --git a/packages/stream_chat/test/src/core/models/channel_state_test.dart b/packages/stream_chat/test/src/core/models/channel_state_test.dart index d0d9a53c..c8b92a0b 100644 --- a/packages/stream_chat/test/src/core/models/channel_state_test.dart +++ b/packages/stream_chat/test/src/core/models/channel_state_test.dart @@ -48,9 +48,9 @@ void main() { final channelState = ChannelState( channel: ChannelModel.fromJson(j['channel']), members: [], - messages: (j['messages'] as List>) - .map(Message.fromJson) - .toList(), + messages: + // ignore: unnecessary_lambdas + (j['messages'] as List).map((m) => Message.fromJson(m)).toList(), read: [], watcherCount: 5, pinnedMessages: [], diff --git a/packages/stream_chat_flutter/test/scrollable_positioned_list/scrollable_positioned_list_test.dart b/packages/stream_chat_flutter/test/scrollable_positioned_list/scrollable_positioned_list_test.dart index aa1a78ca..ef715743 100644 --- a/packages/stream_chat_flutter/test/scrollable_positioned_list/scrollable_positioned_list_test.dart +++ b/packages/stream_chat_flutter/test/scrollable_positioned_list/scrollable_positioned_list_test.dart @@ -933,6 +933,11 @@ void main() { await tester.pumpAndSettle(); }); + final fadeTransitionFinder = find.descendant( + of: find.byType(ScrollablePositionedList), + matching: find.byType(FadeTransition), + ); + testWidgets('Scroll to 0 stop before half way', (WidgetTester tester) async { final itemScrollController = ItemScrollController(); await setUpWidgetTest(tester, itemScrollController: itemScrollController); @@ -951,7 +956,7 @@ void main() { await tester.pump(); expect(tester.getTopLeft(find.text('Item 91')).dy, 0); - expect(find.byType(FadeTransition), findsNWidgets(2)); + expect(fadeTransitionFinder, findsNWidgets(1)); await tester.pumpAndSettle(); }); @@ -976,7 +981,7 @@ void main() { expect(tester.getBottomLeft(find.text('Item 100')).dy, closeTo(screenHeight, tolerance)); expect(find.text('Item 9', skipOffstage: false), findsNothing); - expect(find.byType(FadeTransition), findsNWidgets(2)); + expect(fadeTransitionFinder, findsNWidgets(1)); await tester.pumpAndSettle(); }); @@ -999,11 +1004,7 @@ void main() { await tester.pump(); expect(tester.getTopLeft(find.text('Item 9')).dy, closeTo(0, tolerance)); - final fadeTransition = tester.widget(find - .descendant( - of: find.byType(ScrollablePositionedList), - matching: find.byType(FadeTransition)) - .last); + final fadeTransition = tester.widget(fadeTransitionFinder); expect(fadeTransition.opacity.value, 1.0); await tester.pumpAndSettle(); @@ -1021,13 +1022,14 @@ void main() { itemScrollController.scrollTo(index: 0, duration: scrollDuration)); await tester.pump(); await tester.pump(); - await tester.pump(scrollDuration ~/ 2); + await tester.pump(scrollDuration ~/ 2 + scrollDuration ~/ 20); await tester.tap(find.byType(ScrollablePositionedList)); await tester.pump(); - expect(tester.getTopLeft(find.text('Item 90')).dy, 0); - expect(find.byType(FadeTransition), findsNWidgets(2)); + expect(tester.getTopLeft(find.text('Item 9')).dy, closeTo(0, tolerance)); + final fadeTransition = tester.widget(fadeTransitionFinder); + expect(fadeTransition.opacity.value, 1.0); await tester.pumpAndSettle(); }); diff --git a/packages/stream_chat_flutter/test/src/message_list_view_test.dart b/packages/stream_chat_flutter/test/src/message_list_view_test.dart index 08e23820..240dda84 100644 --- a/packages/stream_chat_flutter/test/src/message_list_view_test.dart +++ b/packages/stream_chat_flutter/test/src/message_list_view_test.dart @@ -114,9 +114,9 @@ void main() { }); bool findBackground(Widget widget) => - widget is Container && + widget is DecoratedBox && widget.decoration is BoxDecoration && - (widget.decoration! as BoxDecoration).image != null; + (widget.decoration as BoxDecoration).image != null; expect(find.byType(StreamMessageListView), findsOneWidget); expect(find.byKey(nonEmptyWidgetKey), findsOneWidget);