Context:
In SwiftUI project, I'm using on login view the native SignInWithAppleButton, which is init with those parameters:
init(_ label: SignInWithAppleButton.Label = .signIn, onRequest: @escaping (ASAuthorizationAppleIDRequest) -> Void, onCompletion: @escaping ((Result<ASAuthorization, Error>) -> Void))
It's well implemented and working well.
Issue:
I just started writting unit tests and facing the following issue:
in order to test my UserRepository, i'm trying to achieve:
repository.signUpWithAppleSignIn(credential: mockCredential)
the problem here is that I don't succeed to create my mockCredential property.
It is currently define as follow :
let mockCredential = ASAuthorizationAppleIDCredential(coder: NSCoder())
But this doesn't work. It makes mockCredential property an optionnal, so I have to give it a default value... and so I'm back to the initial problem.
I thought about removing this parameter but I need it since the credential value needed in real use is available in the success from resultfrom the onCompletion parameter when using the SignInWithApple button.
If anyone has already met this issue, I try to provide all needed informations here but I can still clarify myself if needed
Thanks !