Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove interface INetworkInfo and Change tests accordingly #20

Merged
merged 1 commit into from Oct 14, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
8 changes: 1 addition & 7 deletions lib/core/network/network_info.dart
@@ -1,17 +1,11 @@
import 'package:data_connection_checker/data_connection_checker.dart';
import 'package:injectable/injectable.dart';

abstract class INetworkInfo {
Future<bool> get isConnected;
}

@lazySingleton
@RegisterAs(INetworkInfo)
class NetworkInfo implements INetworkInfo {
class NetworkInfo {
const NetworkInfo(this.connectionChecker);

final DataConnectionChecker connectionChecker;

@override
Future<bool> get isConnected => connectionChecker.hasConnection;
}
2 changes: 1 addition & 1 deletion lib/features/home/data/repositories/home_repository.dart
Expand Up @@ -21,7 +21,7 @@ class HomeRepository implements IHomeRepository {
this._networkInfo, this._remoteDataSource, this._localDataSource);

final IHomeLocalDataSource _localDataSource;
final INetworkInfo _networkInfo;
final NetworkInfo _networkInfo;
final IHomeRemoteDataSource _remoteDataSource;

@override
Expand Down
Expand Up @@ -16,7 +16,7 @@ class MockHomeRemoteDataSource extends Mock implements IHomeRemoteDataSource {}

class MockHomeLocalDataSource extends Mock implements IHomeLocalDataSource {}

class MockNetworkInfo extends Mock implements INetworkInfo {}
class MockNetworkInfo extends Mock implements NetworkInfo {}

void main() {
MockHomeLocalDataSource mockLocalDataSource;
Expand Down