Google Sign In Mocks | Coderz Repository

google_sign_in_mocks

Last updated:

0 purchases

google_sign_in_mocks Image
google_sign_in_mocks Images

Free

Languages

Categories

Add to Cart

Description:

google sign in mocks

Mocks for google_sign_in. Use this
package with firebase_auth_mocks to write unit tests involving Firebase
Authentication.



Usage #
A simple usage example:
import 'package:google_sign_in_mocks/google_sign_in_mocks.dart';
import 'package:test/test.dart';

void main() {
late MockGoogleSignIn googleSignIn;
setUp(() {
googleSignIn = MockGoogleSignIn();
});

test('should return idToken and accessToken when authenticating', () async {
final signInAccount = await googleSignIn.signIn();
final signInAuthentication = await signInAccount!.authentication;
expect(signInAuthentication, isNotNull);
expect(googleSignIn.currentUser, isNotNull);
expect(signInAuthentication.accessToken, isNotNull);
expect(signInAuthentication.idToken, isNotNull);
});

test('should return null when google login is cancelled by the user',
() async {
googleSignIn.setIsCancelled(true);
final signInAccount = await googleSignIn.signIn();
expect(signInAccount, isNull);
});
test('testing google login twice, once cancelled, once not cancelled at the same test.', () async {
googleSignIn.setIsCancelled(true);
final signInAccount = await googleSignIn.signIn();
expect(signInAccount, isNull);
googleSignIn.setIsCancelled(false);
final signInAccountSecondAttempt = await googleSignIn.signIn();
expect(signInAccountSecondAttempt, isNotNull);
});
}
copied to clipboard
Features and bugs #
Please file feature requests and bugs at the issue tracker.

License:

For personal and professional use. You cannot resell or redistribute these repositories in their original state.

Files In This Product: (if this is empty don't purchase this product)

Customer Reviews

There are no reviews.