v0.4.2
google_sign_in_mocks
Google 登录的模拟。结合 `firebase_auth_mocks` 使用此包,编写涉及 Firebase 认证的单元测试。
35喜欢 1.7万近 30 天下载150Pub 分数
AndroidiOSWebmacOS
atn832/google_sign_in_mocks open-source repository details.
以下为英文项目原文快照,最新内容请访问 GitHub。
Mocks for google_sign_in. Use this
package with firebase_auth_mocks to write unit tests involving Firebase
Authentication.
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);
});
}
Please file feature requests and bugs at the issue tracker.
依赖清单 6 项
{"sdk":"flutter"}^7.2.0^0.8.2{"sdk":"flutter"}^1.11.0^1.0.0先按使用场景筛选,再比较项目活跃情况,最后到原始仓库核对使用要求。
“A repository is the most basic element of GitHub.”
GitHub Docs — About repositories ↗