The AWSCognitoIdentityUserPool throws an exception in it's initializer (- (instancetype)init), ln 123.
This makes it really hard to mock out the object in Swift. Using Objective-C I could swizzle the initializer and construct the object anyway, but that is not a recommended option in Swift. The compiler even pukes out a warning if you implement + initialize.
I have two suggestions in order to help out with mocking this object:
AWSCognitoIdentityUserPool object. Add a log in there if you wish in order to discourage usage of that initializer in other scenarios than tests.This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.
any updates on this?
If there is no desire to change this design what is the recommended way of mocking AWSCognitoIdentityUserPool?
@daviskoh We chose to extend AWSCognitoIdentityUserPool with a protocol. This protocol mapped all functions that we were using ourselves.
That solution had too much maintenance so in the end we chose to wrap all of our Cognito calls inside a service. In our tests we mocked the whole service.
Preferably AWS will wake up see the importance of this. 馃挙
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.
This issue has been automatically closed because of inactivity. Please open a new issue if are still encountering problems.