FLUTTER ECOSYSTEM

atn832/google_sign_in_mocks

atn832/google_sign_in_mocks open-source repository details.

google_sign_in_mocks 프로젝트 이미지
Stars
9
Forks
17
최근 푸시(UTC)
2026. 9. 12.
프로젝트 상태
활성
atn GitHub avatar
GITHUB User

atn ↗

언어Dart

이 저장소가 배포한 패키지

사용 중인 의존성

의존성 목록 6 개
  • flutter{"sdk":"flutter"}
  • google_sign_in^7.2.0
  • mock_exceptions^0.8.2
  • flutter_test개발 의존성{"sdk":"flutter"}
  • pedantic개발 의존성^1.11.0
  • test개발 의존성^1.0.0

원본 README

아래는 영문 원문 스냅샷입니다. 최신 내용은 GitHub에서 확인하세요.

README 펼치기 / 접기

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

pub package unit-tests Buy Me A Coffee

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 when authenticating', () async {
    final signInAccount = await googleSignIn.signIn();
    final signInAuthentication = await signInAccount!.authentication;
    expect(signInAuthentication, isNotNull);
    expect(googleSignIn.currentUser, 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);
  });
}

Features and bugs

Please file feature requests and bugs at the issue tracker.