From 34cc3da89c36de212bd22e36ea126c27e9571a83 Mon Sep 17 00:00:00 2001 From: RuiAlonso Date: Tue, 5 Dec 2023 16:18:10 +0100 Subject: [PATCH] feat: pulse on thinking and tests --- .../lib/src/resources/questions_resource.dart | 2 +- test/home/widgets/thinking_view_test.dart | 31 ++++--------------- 2 files changed, 7 insertions(+), 26 deletions(-) diff --git a/packages/api_client/lib/src/resources/questions_resource.dart b/packages/api_client/lib/src/resources/questions_resource.dart index d003601..d117c77 100644 --- a/packages/api_client/lib/src/resources/questions_resource.dart +++ b/packages/api_client/lib/src/resources/questions_resource.dart @@ -40,7 +40,7 @@ class QuestionsResource { } body = response.body; } else { - await Future.delayed(const Duration(seconds: 8)); + await Future.delayed(const Duration(seconds: 4)); body = switch (query) { 'What is flutter?' => FakeResponses.whatIsFlutterResponse, diff --git a/test/home/widgets/thinking_view_test.dart b/test/home/widgets/thinking_view_test.dart index 45e498e..4fd91e0 100644 --- a/test/home/widgets/thinking_view_test.dart +++ b/test/home/widgets/thinking_view_test.dart @@ -6,7 +6,6 @@ import 'package:flutter/material.dart'; import 'package:flutter_bloc/flutter_bloc.dart'; import 'package:flutter_test/flutter_test.dart'; import 'package:mocktail/mocktail.dart'; -import 'package:phased/phased.dart'; import '../../helpers/helpers.dart'; @@ -30,7 +29,7 @@ void main() { testWidgets('renders correctly', (tester) async { await tester.pumpApp(bootstrap()); - expect(find.byType(CirclesAnimation), findsOneWidget); + expect(find.byType(PulseAnimationView), findsOneWidget); expect(find.byType(TextArea), findsOneWidget); }); @@ -38,7 +37,7 @@ void main() { tester.setViewSize(size: Size(600, 800)); await tester.pumpApp(bootstrap()); - expect(find.byType(CirclesAnimation), findsOneWidget); + expect(find.byType(PulseAnimationView), findsOneWidget); expect(find.byType(TextArea), findsOneWidget); }); @@ -68,24 +67,17 @@ void main() { expect(forwardExitStatuses, equals([Status.thinkingToResults])); }); - group('ThinkingAnimationView', () { - Widget bootstrap(PhasedState state) => - BlocProvider.value( + group('PulseAnimationView', () { + Widget bootstrap() => BlocProvider.value( value: homeBloc, child: Material( - child: ThinkingAnimationView( - animationState: state, - ), + child: PulseAnimationView(), ), ); testWidgets( 'animation changes correctly', (tester) async { - final animationState = PhasedState( - values: ThinkingAnimationPhase.values, - initialValue: ThinkingAnimationPhase.initial, - ); final streamController = StreamController(); whenListen( homeBloc, @@ -93,23 +85,12 @@ void main() { initialState: const HomeState(), ); - expect(animationState.value, equals(ThinkingAnimationPhase.initial)); - await tester.pumpApp(bootstrap(animationState)); - - expect( - animationState.value, - equals(ThinkingAnimationPhase.thinkingIn), - ); + await tester.pumpApp(bootstrap()); streamController.add( const HomeState(status: Status.thinkingToResults), ); await tester.pump(); - - expect( - animationState.value, - equals(ThinkingAnimationPhase.thinkingOut), - ); }, ); });