- We still use it, but not all the dev time.
- Every time we want to code, test we need to open simulator, so it will be hard for us if we want to use any automation tests later on.
if (env === "DEV") {}
is everywhere, we need to do it just in one place.
- Dev cans change the response whenever they want, we can do even better than that for example we can set the the loading time or set the request to false.
-
We gonna implement something likes this
javascript
const mock = (req) => { req.prototype.send = (successBlock, failureBlock) => { successBlock(window.btoa(writeBinaryString(loginForm))); }return req; }
- We also need to predefine the responses if we gonna call with correct url/parameters (the idea like **[Nock](https://github.com/pgte/nock)**).
- Then wherever can wrap the global `Request` with `mock(Request)`.
@penmanglewood that's one of key things I wanna achieve here