【发布时间】:2021-12-31 13:15:10
【问题描述】:
测试时如何创建 UserCredential 对象?
我正在尝试像这样测试我的 authRepository:
test('', () async {
when(
() => mockFirebaseAuth.createUserWithEmailAndPassword(
email: 'test@test.de', password: '123456'),
).thenAnswer((realInvocation) => ) // I need to return a Future<UserCredential> here);
final result = await authRepository.signUpWithEmailAndPassword(
email: 'test@test.de', password: '123456');
});
但是为了存根 createUserWithEmailAndPassword 我需要返回一个
Future<UserCredential>
如何创建这样的对象?
【问题讨论】:
标签: firebase flutter dart firebase-authentication flutter-test