pioneer icon indicating copy to clipboard operation
pioneer copied to clipboard

Pioneer should expose a mock command to stub URL requests

Open samccone opened this issue 11 years ago • 2 comments

Driver.stub("http://wow.com/api/tom/22", {data: struc}).then ->

It is naive to think that everyone who is interested in writing javascript integration tests has the time / ability / permissions to change the server on which the front end app interfaces. Providing a stub interface allows users to fake API requests with fixtures to easily add integration esk tests for SPAs.

samccone avatar Jun 06 '14 03:06 samccone

On further thought I think that the correct solution is going to be to use run a proxy server on the clients computer that you can define mocks for given requests.

For instance:

'google.com/foo' : {wow: "google"}

For reference http://www.catonmat.net/http-proxy-in-nodejs/ I also think that we can lift the mock definition format and code from here https://github.com/pgte/nock

samccone avatar Jun 20 '14 17:06 samccone

ping @DavidDufresne @fcanas

samccone avatar Jun 20 '14 17:06 samccone