[enhancement] Mocking during testing
georgeboot opened this issue · 13 comments
I would love to test our code that implements this package. However, I can't seem to find an easy way to mock this package cq the underlying HTTP client.
What approach are others using?
This issue has been automatically closed because it has not had any recent activity. 😨
I got an eye on @Sammyjo20's Saloon package and might use it. 😁
@rennokki if you want an example or two of how I set up mocking for my SDKs just let me know!
This issue has been automatically closed because it has not had any recent activity. 😨
Hey @rennokki just got notified about this issue, it’s been a while since we last spoke about it and Saloon has matured a lot in the time!
I built an SDK template repo which you can use and it has support for mocking out of the box. You can do
$sdk = new SDK()
$sdk->withMockClient($mockClient)
$sdk->request(new MyRequest)
// Or configure request collections
$sdk->users()->all()
The SDK repo is here but it’s all covered in the docs too 😀
This issue has been automatically closed because it has not had any recent activity. 😨
Hey @rennokki I saw that you reopened the issue, Saloon v2 is on the horizon (before the end of the year) so that might be an exciting moment to consider using it again, but if you are interested in Mocking I've recently built a really cool Fixture recording feature that might help!
https://docs.saloon.dev/next-steps/testing-faking-responses/recording-requests
@Sammyjo20 Yeah, I actually reconsidered it since I've recently came back to become more involved into the project, so first steps are to have a proper cleanup of the issues and prioritize fixes, and take care of features and enhancements afterwards. :D
If you got the beta version, I might as well use it (with the risk of breaks) and merge it once the first few releases of v2 are published.
That’s awesome!! I haven’t written the updated docs yet but as soon as I do that, I’ll tag a beta. You can start using the v2 branch now if you like but it may be a bit tricky without docs. You can always message me on Twitter :)
This issue has been automatically closed because it has not had any recent activity. 😨
@rennokki do you still have plans to start using Saloon for this package?
Just to let you know I intent to release the beta for Saloon v2 this week, the docs are still work-in-progress but all the basics are covered
The v2 beta is now ready and most of the docs are up ⬆️ https://docs.saloon.dev/v/2