FormidableLabs / yesno

Simple HTTP testing for NodeJS
MIT License
88 stars 6 forks source link

Support non-deterministic order of HTTP requests. #10

Open ianwsperber opened 6 years ago

ianwsperber commented 6 years ago

Currently the order of the mocks must match the order of the HTTP requests. However some applications will have a non-deterministic order of HTTP requests. We could support these apps by:

  1. Support providing a callback to match an HTTP request to a mock
  2. Support matching HTTP to a mock by URL, ignoring order (could be configurable).

Would be great to get feedback on usage before making a decision.

kevinmstephens commented 4 years ago

@ianwsperber The request to match by URL is pretty straightforward to implement. And I think the use-case that supports is:

However using the matching...respond feature one could inline the mocks for B and C. They wouldn't get the benefit of easily saving and loading B and C calls but that would work too.

Any thoughts on if matching...respond will meet the need or is the use case more along the lines of save...load mocks?