Skip to content
This repository has been archived by the owner on Dec 12, 2024. It is now read-only.

test: add tests for TransactionDetailsPage #316

Merged
merged 6 commits into from
Oct 18, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 1 addition & 19 deletions test/features/transaction/transaction_details_page_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -128,22 +128,4 @@ void main() {
expect(find.text('Bad state: Error loading transaction'), findsOneWidget);
});
});
}

sealed class MockTransactionNotifierType {
const MockTransactionNotifierType();
}

class MockTransactionNotifierWithData extends MockTransactionNotifierType {
const MockTransactionNotifierWithData({required this.transactionType});

final TransactionType transactionType;
}

class MockTransactionNotifierWithNullData extends MockTransactionNotifierType {
const MockTransactionNotifierWithNullData();
}

class MockTransactionNotifierWithError extends MockTransactionNotifierType {
const MockTransactionNotifierWithError();
}
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: add missing newline here!

18 changes: 18 additions & 0 deletions test/helpers/mocks.dart
Original file line number Diff line number Diff line change
Expand Up @@ -79,3 +79,21 @@ class MockAccountBalanceNotifier
@override
FutureOr<AccountBalance?> build() async => accountBalance;
}

sealed class MockTransactionNotifierType {
const MockTransactionNotifierType();
}

class MockTransactionNotifierWithData extends MockTransactionNotifierType {
const MockTransactionNotifierWithData({required this.transactionType});

final TransactionType transactionType;
}

class MockTransactionNotifierWithNullData extends MockTransactionNotifierType {
const MockTransactionNotifierWithNullData();
}

class MockTransactionNotifierWithError extends MockTransactionNotifierType {
const MockTransactionNotifierWithError();
}
Comment on lines +83 to +99
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These lines are still duplicated in transaction_tile_test.dart.

sealed class MockTransactionNotifierType {
const MockTransactionNotifierType();
}
class MockTransactionNotifierWithData extends MockTransactionNotifierType {
const MockTransactionNotifierWithData({required this.transactionType});
final TransactionType transactionType;
}
class MockTransactionNotifierWithNullData extends MockTransactionNotifierType {
const MockTransactionNotifierWithNullData();
}
class MockTransactionNotifierWithError extends MockTransactionNotifierType {
const MockTransactionNotifierWithError();
}

They can be removed from the transaction_tile_test.dart so that it only uses the ones from mocks.dart.

Loading