Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

withSomeParams doesn't appear to work with mock #381

Closed
patocallaghan opened this issue Mar 8, 2019 · 0 comments
Closed

withSomeParams doesn't appear to work with mock #381

patocallaghan opened this issue Mar 8, 2019 · 0 comments

Comments

@patocallaghan
Copy link
Collaborator

patocallaghan commented Mar 8, 2019

Take the scenario where I have some raw ajax requests that do something like:

await $.ajax({ type, url, data: { foo: 'foo' } });
await $.ajax({ type, url, data: { bar: 'bar' } });

Trying to mock these calls with #withParams like below results in both mocks being called once.

let fooMock = mock({url: '/api/post/some-stuff', type}).withParams({ foo: 'foo' });
let barMock = mock({url: '/api/post/some-stuff', type}).withParams({ bar: 'bar' });

But if on the other hand I use withSomeParams only the first mock gets called and the params are ignored.

let fooMock = mock({url: '/api/post/some-stuff', type}).withSomeParams({ foo: 'foo' });
let barMock = mock({url: '/api/post/some-stuff', type}).withSomeParams({ bar: 'bar' });

I've created some failing tests in #382

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

No branches or pull requests

1 participant