Skip to content
This repository has been archived by the owner on Feb 20, 2024. It is now read-only.

Should mocks defined using matching().respond() clobber mocks from yesno.mock #82

Open
kevinmstephens opened this issue Jul 16, 2020 · 0 comments

Comments

@kevinmstephens
Copy link

See

it('should support mock override with respond', async () => {

If we defined mocks for calls to /A, /B, /C, yesno will try to match those 3 mocks in order of API calls made. If the 2nd API call, for example, isn't to /B it will error.

A user then adds matching('/X').respond() in addition to the mocks for A, B, C above. If the user then has API calls in this order:
A, B, X, C

They will encounter an error on the call to C b/c in fact X has replaced C so C mock will no longer exist.

In fact to get this to work I would have to:

  • create mocks ``/A, /B`, `/DUMMY_TO_GET_CLOBBERED`, /C`.
  • create matching('/X').respond()
  • ✅ call A, B, X, C

No proposed updated API here. For now I just wanted to note this behavior and consider if it's what we want.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant