Skip to content

Commit

Permalink
Duplicate code moved to mocks.dart
Browse files Browse the repository at this point in the history
  • Loading branch information
mohitrajsinha committed Oct 17, 2024
1 parent f6d989b commit c55fb93
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 19 deletions.
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();
}
}
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();
}

0 comments on commit c55fb93

Please sign in to comment.