You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm trying to test a flow where access tokens are refreshed(similar to #42 ), and I'm using a MockProvider instead of making actual network requests (imagine making a MockProvider where if a request is made with the old token, it'll return a "failed" json and if the request is made with a new token, you get the "success" json). However, since the request in the MockProvider closure doesn't contain any information about the middleware, authentication etc, I can't check what token the request is made with.
Any suggestions on how I can write a test for this? 🤔
The text was updated successfully, but these errors were encountered:
I have a few (late night thoughts) on how this could be fixed.
We could replace the MockProvider<> in the init with an enum:
enum ResponseOverride<T> {
case mockProvider(MockProvider<T>)
case urlSession(URLSession)
}
and pass an instance of ResponseOverride in the init.
Another approach we could take here is turn toURLRequest to a Promise<URLRequest> and actually ensure that the middleware, preProcessRequest etc are called in the right order.
These are my 2 ideas for now. Totally open to suggestions/better ways to solve this problem.
Hi!
I'm trying to test a flow where access tokens are refreshed(similar to #42 ), and I'm using a MockProvider instead of making actual network requests (imagine making a
MockProvider
where if a request is made with the old token, it'll return a "failed" json and if the request is made with a new token, you get the "success" json). However, since the request in theMockProvider
closure doesn't contain any information about the middleware, authentication etc, I can't check what token the request is made with.Any suggestions on how I can write a test for this? 🤔
The text was updated successfully, but these errors were encountered: