-
-
Notifications
You must be signed in to change notification settings - Fork 46
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes for proposal "Mocking Centrifuge Client for Testing Without a Server" #113
base: master
Are you sure you want to change the base?
Changes for proposal "Mocking Centrifuge Client for Testing Without a Server" #113
Conversation
- CentrifugeClient implement Client protocol - CentrifugeSubscription implement ClientSubscription protocol - Client protocol adopted to use ClientSubscription instead of CentrifugeSubscription class
Hi, @FZambia What do you think about this pull request? )) |
Hmm.. the complexity added here is sufficient and I need more time to think and more opinions on that. Probably this may be addressed in alternative ways by mocking transport level and thus triggering required events, or by keeping protocols outside, by wrapping on app level or wrapper library level? Is your main motivation to test your app or add more tests to centrifuge-swift? If it's application tests – then I guess it's already possible to do without introducing protocols, just constructors for types maybe. If testing centrifuge-swift itself – then I like protocol mock idea more. |
Hi Thank you for your feedback and suggestions. I wanted to clarify a few points about the changes in my merge request and the reasoning behind them.
Let me know your thoughts on this. I’d be happy to adjust the implementation if there’s a better way to address these concerns. |
@FZambia is too much ??? |
Pull Request Description
This Pull Request introduces changes aimed at improving the testability and flexibility of the Centrifuge client for iOS, written in Swift. The main focus is on introducing protocols for key entities and optimizing their usage. Additional information is here Proposal: Mocking Centrifuge Client for Testing Without a Server
Key Changes:
Protocols for Core Classes:
Client
protocol for theCentrifugeClient
class.ClientSubscription
protocol for theCentrifugeSubscription
class.Integration Example Updates:
CentrifugeClient
andCentrifugeSubscription
classes in the integration example with their correspondingClient
andClientSubscription
protocols.Public Initializers for Models:
Property Optimization:
var
tolet
.Demonstration of Protocol Usage:
Suggestions for Future Improvements:
Notes:
All changes have been made with backward compatibility in mind. The existing logic of the client and subscriptions remains unchanged. This Pull Request simplifies Centrifuge integration into client projects and makes testing easier.
Demo project:
changes.demo.mp4