I'm trying to unit test a my AuthenticationService class, which acts as an abstraction of Flutter's plugin firebase_auth. Specifically, I want to test following method:
Future<void> startAuthFlow(String phoneNumber) async {
await _firebaseAuth.verifyPhoneNumber(
phoneNumber: phoneNumber,
verificationCompleted: _onVerificationCompleted,
verificationFailed: _onVerificationFailed,
codeSent: _onCodeSent,
codeAutoRetrievalTimeout: _onCodeAutoRetrievalTimeout,
);
}
I'm not sure about how to approach the unit testing, as I would like to assure that after SMS is sent, verification is completed, etc, the logic in the private callbacks is executed. However, I don't know how to mock such a function.
I've also thought about the possibility of just unit-testing the callbacks independently, and considering their calling by _firebaseAuth.verifyPhoneNumber as subject of an integration test. However, as those callbacks are private, there is no a good way to test them.