-
Notifications
You must be signed in to change notification settings - Fork 17
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
Unit tests and mocking #10
Comments
The initializer accepts a AbstractFactory, you can use this to mock the SDK APIs on the functional level. Please checkout from the master. |
@rathishubham7 it would be much easier for people not familiar with the code to just be able to pass in a Passing in a URLSession means that I can simply make a dictionary of:
And have a mock instance simply check for the URL and load the corresponding file if it matches. e.g.
This allows me to mock 100% of requests being used by my library, no matter where they come from, with a single file, without having to create tonnes of mock instance classes |
@rathishubham7 also I needed to make all these properties public so that I could access them later inside the app, can you make that change to the main repo too: https://github.com/simonmcl/torus-direct-swift-sdk/blob/a6c7f8e4628b43f1c363c797b9ed5c07a575234c/Sources/TorusSwiftDirectSDK/Models/SubVerifierDetails.swift#L19 |
Theres no way to pass in a
URLSession
into any of the Torus functions. This is how most libraries expose the ability to mock URL requests so that code can be unit tested.Is there any other method available to mock requests that i've missed?
If not, please update the library to allow me to pass in my own
URLSession
so I can create my own mocksThe text was updated successfully, but these errors were encountered: