Using PretenderJS, how can I mock the requests OR specifically say in stub mode, how does an API call get redirected to get the stub response (i.e. mapping for data) ?
PretenderJS mocks a server endpoint, as oppose to FakeXMLHttpRequest that mocks the request. It works by replacing the global
XMLHttpRequest constructor with
Pretender’s API works more like an expressjs server. You instantiate an instance, setup a few routes on it, and make the route respond with data.