Skip to content

Commit

Permalink
remove dependency to mockito
Browse files Browse the repository at this point in the history
  • Loading branch information
atn832 committed Mar 14, 2023
1 parent e83a0a3 commit 8b7309e
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 12 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
@@ -1,3 +1,7 @@
## 0.2.2

- Removed dependency to Mockito.

## 0.2.1

- Added setIsCanceled to simulate canceled. Thank you [YusufAbdelaziz](https://github.com/YusufAbdelaziz)!
Expand Down
21 changes: 11 additions & 10 deletions lib/src/google_sign_in_mocks_base.dart
@@ -1,7 +1,6 @@
import 'package:google_sign_in/google_sign_in.dart';
import 'package:mockito/mockito.dart';

class MockGoogleSignIn extends Mock implements GoogleSignIn {
class MockGoogleSignIn implements GoogleSignIn {
MockGoogleSignInAccount? _currentUser;

bool _isCancelled = false;
Expand All @@ -17,27 +16,29 @@ class MockGoogleSignIn extends Mock implements GoogleSignIn {
@override
Future<GoogleSignInAccount?> signIn() {
_currentUser = MockGoogleSignInAccount();
return Future.value(_isCancelled ? null : _currentUser);
return Future.value(_isCancelled ? null : _currentUser);
}

@override
dynamic noSuchMethod(Invocation invocation) => super.noSuchMethod(invocation);
}

class MockGoogleSignInAccount extends Mock implements GoogleSignInAccount {
class MockGoogleSignInAccount implements GoogleSignInAccount {
@override
Future<GoogleSignInAuthentication> get authentication =>
Future.value(MockGoogleSignInAuthentication());

@override
bool operator ==(other) {
return (other is Mock)
? hashCode == other.hashCode
: identical(this, other);
}
dynamic noSuchMethod(Invocation invocation) => super.noSuchMethod(invocation);
}

class MockGoogleSignInAuthentication extends Mock implements GoogleSignInAuthentication {
class MockGoogleSignInAuthentication implements GoogleSignInAuthentication {
@override
String get idToken => 'idToken';

@override
String get accessToken => 'accessToken';

@override
dynamic noSuchMethod(Invocation invocation) => super.noSuchMethod(invocation);
}
3 changes: 1 addition & 2 deletions pubspec.yaml
@@ -1,6 +1,6 @@
name: google_sign_in_mocks
description: Mocks for Google Sign In. Use this package with `firebase_auth_mocks` to write unit tests involving Firebase Authentication.
version: 0.2.1
version: 0.2.2
homepage: http://blog.wafrat.com
repository: https://github.com/atn832/google_sign_in_mocks

Expand All @@ -11,7 +11,6 @@ dependencies:
flutter:
sdk: flutter
google_sign_in: ^5.0.2
mockito: ^5.0.7

dev_dependencies:
flutter_test:
Expand Down

0 comments on commit 8b7309e

Please sign in to comment.