Skip to content
This repository was archived by the owner on Feb 22, 2023. It is now read-only.

[google_sign_in_platform_interface] Add availability to mock models #5669

Merged
merged 1 commit into from
May 17, 2022
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.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
## NEXT
## 2.1.3

* Enables mocking models by changing overridden operator == parameter type from `dynamic` to `Object`.
* Removes unnecessary imports.

## 2.1.2
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ class GoogleSignInUserData {
@override
// TODO(stuartmorgan): Make this class immutable in the next breaking change.
// ignore: avoid_equals_and_hash_code_on_mutable_classes
bool operator ==(dynamic other) {
bool operator ==(Object other) {
if (identical(this, other)) {
return true;
}
Expand Down Expand Up @@ -122,7 +122,7 @@ class GoogleSignInTokenData {
@override
// TODO(stuartmorgan): Make this class immutable in the next breaking change.
// ignore: avoid_equals_and_hash_code_on_mutable_classes
bool operator ==(dynamic other) {
bool operator ==(Object other) {
if (identical(this, other)) {
return true;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ repository: https://github.com/flutter/plugins/tree/main/packages/google_sign_in
issue_tracker: https://github.com/flutter/flutter/issues?q=is%3Aissue+is%3Aopen+label%3A%22p%3A+google_sign_in%22
# NOTE: We strongly prefer non-breaking changes, even at the expense of a
# less-clean API. See https://flutter.dev/go/platform-interface-breaking-changes
version: 2.1.2
version: 2.1.3

environment:
sdk: ">=2.12.0 <3.0.0"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,44 @@ void main() {
GoogleSignInPlatform.instance = ImplementsWithIsMock();
});
});

group('GoogleSignInTokenData', () {
test('can be compared by == operator', () {
final GoogleSignInTokenData firstInstance = GoogleSignInTokenData(
accessToken: 'accessToken',
idToken: 'idToken',
serverAuthCode: 'serverAuthCode',
);
final GoogleSignInTokenData secondInstance = GoogleSignInTokenData(
accessToken: 'accessToken',
idToken: 'idToken',
serverAuthCode: 'serverAuthCode',
);
expect(firstInstance == secondInstance, isTrue);
});
});

group('GoogleSignInUserData', () {
test('can be compared by == operator', () {
final GoogleSignInUserData firstInstance = GoogleSignInUserData(
email: 'email',
id: 'id',
displayName: 'displayName',
photoUrl: 'photoUrl',
idToken: 'idToken',
serverAuthCode: 'serverAuthCode',
);
final GoogleSignInUserData secondInstance = GoogleSignInUserData(
email: 'email',
id: 'id',
displayName: 'displayName',
photoUrl: 'photoUrl',
idToken: 'idToken',
serverAuthCode: 'serverAuthCode',
);
expect(firstInstance == secondInstance, isTrue);
});
});
}

class ImplementsWithIsMock extends Mock implements GoogleSignInPlatform {
Expand Down