From 15f951497a916f1f355234c3d1e1a039493578fa Mon Sep 17 00:00:00 2001 From: Jaime Date: Mon, 5 Aug 2024 14:31:34 +0200 Subject: [PATCH] test: use mock data --- test/demo/demo_page_test.dart | 14 ++++++++++++-- .../ui/widgets/goal_progress_indicator_test.dart | 11 ++++++++++- 2 files changed, 22 insertions(+), 3 deletions(-) diff --git a/test/demo/demo_page_test.dart b/test/demo/demo_page_test.dart index 8f51079..892566e 100644 --- a/test/demo/demo_page_test.dart +++ b/test/demo/demo_page_test.dart @@ -32,8 +32,18 @@ void main() { financialDataBloc = _MockFinancialDataBloc(); when(() => themeModeCubit.state).thenReturn(ThemeMode.light); - when(() => financialDataBloc.state) - .thenReturn(const FinancialDataState()); + when(() => financialDataBloc.state).thenReturn( + FinancialDataState( + currentSavings: 123456, + savingsDataPoints: createSampleData(), + monthlySpendingLimitGoal: 1000, + transactions: [ + const Transaction(title: 'Paycheck', amount: 3000), + const Transaction(title: 'Rent', amount: -1050.20), + const Transaction(title: 'Food', amount: -670.50), + ], + ), + ); }); testWidgets('renders AppOne when AppFlavor is one', (tester) async { diff --git a/test/src/ui/widgets/goal_progress_indicator_test.dart b/test/src/ui/widgets/goal_progress_indicator_test.dart index ec8af9d..a1608ae 100644 --- a/test/src/ui/widgets/goal_progress_indicator_test.dart +++ b/test/src/ui/widgets/goal_progress_indicator_test.dart @@ -25,7 +25,16 @@ void main() { setUp(() { financialDataBloc = _MockFinancialDataBloc(); - when(() => financialDataBloc.state).thenReturn(FinancialDataState()); + when(() => financialDataBloc.state).thenReturn( + FinancialDataState( + monthlySpendingLimitGoal: 1000, + transactions: [ + const Transaction(title: 'Paycheck', amount: 3000), + const Transaction(title: 'Rent', amount: -1050.20), + const Transaction(title: 'Food', amount: -670.50), + ], + ), + ); }); group('$GoalProgressIndicator', () {