atecarlos / protractor-http-mock

A library designed to work alongside Protractor for setting up mocks for your HTTP ajax requests.
MIT License
173 stars 70 forks source link

Improve documentation around requestsMade() promise #86

Closed eddie closed 8 years ago

eddie commented 8 years ago

I wanted to do a partial response assertion to a request, it took a little bit of digging but eventually realised that requestsMade() returns a promise.

Here's the initial behaviour I expected:

expect(require('protractor-http-mock').requestsMade()[0].data)
  .toEqual(jasmine.objectContaining({
      token: 'abc'
    });

And the actual behaviour

require('protractor-http-mock').requestsMade().then(function(requests){
  expect(requests[0].data)
    .toEqual(jasmine.objectContaining({
      token: 'abc'
    });
});

The second attempt is the correct way, as provided by protractor-http-mock.. But this isn't clear in the documentation. If this is correct, I'll try and open a PR for it today.

atecarlos commented 8 years ago

Done! @eddie .