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

handleFindQuery doesn't make use of query parameters #126

Closed
mdentremont opened this issue Aug 28, 2015 · 7 comments
Closed

handleFindQuery doesn't make use of query parameters #126

mdentremont opened this issue Aug 28, 2015 · 7 comments

Comments

@mdentremont
Copy link
Contributor

I was trying to setup the following mocks:

  • Return [a, b, c] if query parameter X is used
  • Return [d, e, f] if query parameter Y is used

Regardless of what I pass in for query parameters to handleFindQuery, what ends up getting returned is whatever I passed to the first call of handleFindQuery.

Looking at the unit tests for this project, it looks like this would be caused if we setup some "failure" tests. IE: call handleFindQuery with query parameter X, and then call findQuery with query parameter Y, and assert that our mock was not used.

@danielspaniel
Copy link
Collaborator

Good find @mdentremont ... I might have to change this method a teeny bit to make this work since ember-data v2.0.0 does not use findQuery anymore, but query and queryRecord.
Seems like overall I have to clean up a few other methods as well that have changed slightly for v2.0.0 .. I will do that and fix this at the same time .. and let you know when I am done.
Might take a few days. So stand by.

@danielspaniel
Copy link
Collaborator

@mdentremont ... Can you tell me any good reason not to change the api from this:

   testHelper.handleQuery('user', ['name', 'age'], users);
     ```
 To this: 
   ```js
   testHelper.handleQuery('user', {name:'Bob', age: 10}, users);

For a query like this:

 store.query('user', {name:'Bob', age: 10}});

I am wondering why I ever did the first way ( ['name', 'age'] .. array of query param names ) in the first place, rather than the object of query params that are normally passed in to the query method.

Anyway .. unless you can think of any good reason to keep the ['name', 'age'] style query args .. I am changing that to object args like ( {name:'Bob', age: 10}} )

and changing handleFindQuery to handleQuery

@mdentremont
Copy link
Contributor Author

@danielspaniel 100% agree, I like the new way better than the array.

@danielspaniel
Copy link
Collaborator

Yeah, me too .. what was I thinking?

@mdentremont
Copy link
Contributor Author

😝

@danielspaniel
Copy link
Collaborator

ok @mdentremont .. give v1.13.10 a spin, let me know if this fixes things.
Note that I changed the api, so you have to now pass in object params not array

@danielspaniel
Copy link
Collaborator

let me know or open this again if you still have issue

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

2 participants