Replies: 1 comment 1 reply
-
If you are able to configure the URL that your javascript code is hitting, you can configure it to (during the test env) get/post/patch to a test only endpoint in your webserver. This test only endpoint could be set up to return some static data, or perhaps configured to use something like Mox (so that you can dynamically change the data returned per test). The main point is, instead of mocking the JavaScript code, you can point it somewhere you do control, like you're webserver (Phoenix or Plug app). |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
I would like to mock a request. which is being executed in JS code, I am using an external library that wraps http methods, to use this API I execute a
phx-hook
event to run my JS code, for this reason I have not been able to find a way to mock this request with Mox or another library, how can I mock a request from JS?Beta Was this translation helpful? Give feedback.
All reactions