ember-data-factory-guy
ember-data-factory-guy copied to clipboard
prioritize newer mock handlers
When there are multiple mocks for the same request, we should prioritize the newer one. For example, you might set up some mocks for all tests in beforeEach
, and then override it for a specific test. Currently the first mock would be used.
Besides that, we should put a higher priority to mocks with a filter, regardless of their declaration order. Here's what I came up with:
- prioritize mocks using
match()
to match the request body - prioritize mocks using
withParams()
to match exact query params - prioritize mocks using
withSomeParams()
to match partial query params - otherwise, prioritize by reverse declaration order
Hey @dwickern, this is an interesting idea. I'd be happy to chat more about it. This would be a breaking change so I wonder if we should try and get some feedback from other users of the framework.