Skip to content

Commit

Permalink
test: use mock data
Browse files Browse the repository at this point in the history
  • Loading branch information
jsgalarraga committed Aug 5, 2024
1 parent 34f0f06 commit 15f9514
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 3 deletions.
14 changes: 12 additions & 2 deletions test/demo/demo_page_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
11 changes: 10 additions & 1 deletion test/src/ui/widgets/goal_progress_indicator_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -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', () {
Expand Down

0 comments on commit 15f9514

Please sign in to comment.