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

Add nearsphere convenience methods #582

Merged

Conversation

mtrezza
Copy link
Member

@mtrezza mtrezza commented Jun 12, 2018

Adding convenience methods for queries with geoWithin.nearSphere.

Depending on parse-community/parse-server#4825

Copy link
Contributor

@flovilmart flovilmart left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Besides the ‘fit’ issue do you think it would be nice / possible to have ‘sorted’ as an additional param instead of new functions altogether?

@@ -616,6 +616,63 @@ describe('ParseQuery', () => {
});
});

fit('can generate near-geopoint queries without sorting', () => {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oops, needs to replace by ‘it’

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

@codecov
Copy link

codecov bot commented Jun 12, 2018

Codecov Report

Merging #582 into master will increase coverage by <.01%.
The diff coverage is 100%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #582      +/-   ##
==========================================
+ Coverage    84.7%   84.71%   +<.01%     
==========================================
  Files          48       48              
  Lines        4015     4017       +2     
  Branches      905      906       +1     
==========================================
+ Hits         3401     3403       +2     
  Misses        614      614
Impacted Files Coverage Δ
src/ParseQuery.js 94.23% <100%> (+0.02%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 0fbc604...c594faa. Read the comment docs.

@mtrezza
Copy link
Member Author

mtrezza commented Jun 12, 2018

@flovilmart good idea, introduced sorted parameter. I will make the sorted parameter default to true if not set so that existing code does not break.

@flovilmart
Copy link
Contributor

flovilmart commented Jun 12, 2018

Ok, tests are failing for now as the feature require an unpublished version of parse-server

@flovilmart
Copy link
Contributor

I’ll do a release of the server later so we can get going with this one.

@flovilmart
Copy link
Contributor

@mtrezza I’m wondering, can we make those tests succeed without the new parse-server? This way, we’ll be able to ship in a single server release with the JS SDK?

@mtrezza
Copy link
Member Author

mtrezza commented Jun 12, 2018

@flovilmart Yes, we could remove the tests against the query results (for now) in integration/test/ParseGeoPointTest.js and only keep the tests against the generated query syntax in src/__tests__/ParseQuery-test.js.

The query results are already tested in parse-community/parse-server#4825 so if the query syntax is correct and passes the tests, it should yield the same query results. The integration tests behave a bit like chicken-and-egg it seems.

However, I think there should also be a test against query results of the convenience methods, so I'd add them ASAP later on. What do you suggest?

@flovilmart
Copy link
Contributor

We can do the integrations tests in parse server instead, for this one or mark them xit or pending / optional

@mtrezza
Copy link
Member Author

mtrezza commented Jun 12, 2018

Yes, I already added the tests in parse server with parse-community/parse-server#4827. I was taking guidance from the existing tests, but now that you say it, some tests seem to be redundant because the integration tests are in the SDK and in parse server. Or is it best practice to test integration from both sides?

@mtrezza
Copy link
Member Author

mtrezza commented Jun 12, 2018

@flovilmart done

@dplewis
Copy link
Member

dplewis commented Jun 14, 2018

I’m wondering, can we make those tests succeed without the new parse-server? This way, we’ll be able to ship in a single server release with the JS SDK?

@flovilmart Can we do something similar to what we did with the PHP SDK and have it always go against the bleeding edge?

@dplewis
Copy link
Member

dplewis commented Jun 23, 2018

@flovilmart Have you seen my last comment #582 (comment)

What do you think about using the latest parse server for testing?

@flovilmart
Copy link
Contributor

We can definitely do that :) easier to catch regessions!

@mtrezza
Copy link
Member Author

mtrezza commented Jun 23, 2018 via email

@dplewis
Copy link
Member

dplewis commented Jun 23, 2018

@mtrezza Change the version of parse server used for test to the latest.

https://github.com/parse-community/Parse-SDK-JS/blob/master/integration/package.json#L6

to github:parse-community/parse-server#latest

Then remove your xit from test

Also I'm confused by change to the existing test cases if sorted is optional why are you setting true if true is the default?

@mtrezza
Copy link
Member Author

mtrezza commented Jun 23, 2018 via email

@dplewis
Copy link
Member

dplewis commented Jun 23, 2018

So I’ll revert the existing test cases and add one for sorted=true.

That’s what I was going for. It looked like it was required

@mtrezza
Copy link
Member Author

mtrezza commented Jun 23, 2018

@dplewis Can you please have a look at the failing integration test, I think it is because parse-server#latest failed to build?

Non-registry package missing package.json: parse-server@github:parse-community/parse-server#latest.
npm ERR! package.json npm can't find a package.json file in your current directory.

@dplewis
Copy link
Member

dplewis commented Jun 24, 2018

@flovilmart According to the docs
https://github.com/parse-community/parse-server#want-to-ride-the-bleeding-edge

I have to do npm install parseplatform/parse-server.git#latest

It currently fails for me

npm ERR! prepareGitDep > babel src/ -d lib/ --copy-files
npm ERR! prepareGitDep 
npm ERR! prepareGitDep 
npm ERR! prepareGitDep 2> npm WARN install Usage of the `--dev` option is deprecated. Use `--only=dev` instead.
npm ERR! prepareGitDep src/ doesn't exist

using npm install parseplatform/parse-server.git#master works

@dplewis
Copy link
Member

dplewis commented Jun 24, 2018

@flovilmart How does this look?

On a side note should we pin the node packages? Don't want a repeat of parse-community/parse-server#2040

@flovilmart
Copy link
Contributor

@dplewis see my comment. I’ll have a look tomorrow too

@flovilmart
Copy link
Contributor

@dplewis that sounds good! Thanks to this new NPM feature, one can use any branch and test against it. npm will fetch the dev deps and do it's thing! Wow :)

@dplewis
Copy link
Member

dplewis commented Jun 25, 2018

@flovilmart thats pretty awesome now that I think about it.

Copy link
Contributor

@flovilmart flovilmart left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Excellent everything passes so let's merge it in!

@flovilmart flovilmart merged commit 4a6e619 into parse-community:master Jun 25, 2018
@flovilmart
Copy link
Contributor

@mtrezza Thanks again for the PR!

@mtrezza
Copy link
Member Author

mtrezza commented Jun 25, 2018

@flovilmart Sure thing, thanks to you and dplewis for the support.

@flovilmart
Copy link
Contributor

Any time!

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

Successfully merging this pull request may close these issues.

3 participants