Closed gusbmurphy closed 2 years ago
jest-mock-axios would need a way to instantiate mock AxiosInstance
instances, which I don't think is yet implemented. see my comment on another issue
Hi,
sorry for the late response and thanks for raising the issue. As @ryanrhee already mentioned, this is already being "discussed" (well, it is a bit stale right now) in #59. Thus, I will close this issue and try to revive the other thanks.
Hi everyone,
I've been looking online for some guidance on how to test code that is calling an instance of Axios rather than just something like
axios.post(...)
, and am really at a loss. I've been using this library, which is fantastic, but am really stuck here and feel like I might be missing something. An example of the code I'm trying to test could look like this:My impulse to test code like this would be to mock the return value of
axios.create
, is that necessary? Is there something in this library that I'm missing that would be useful there? Thanks very much for your time, and my apologies if this isn't the best place to ask for advice on this. I should also note that I'm working with TypeScript if that's helpful.