You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Thanks to the great work of @vesameskanensome time ago, we have the ability to write tests that require the results of a query to be within a certain distance of a given point!
What do we want?
More tests that check the lat/lon of results! 🌐
When do we want it?
Whenever it makes sense. At this point, we don't have any hard and fast rules for when a test should look at the lat/lon of results. However there are definitely cases where they aren't helpful. Many of our tests are specifically for labels, for example, and adding lat/lon requirements might be overspecification.
We have tests for places like "Union Square", which are all over the place. We currently use the city name to differentiate, but coordinates could help as well.
Some of our tests deal with restaurant chains like McDonalds, of which there are many all over the place. A perfect case where lat/lon requirements might be helpful.
Test Syntax
As a reminder here's the syntax of a test with a lat/lon:
The coordinates section in the expected section is an array of coordinates (which themselves are arrays). The coordinates are in [longitude, latitude] format with each point represented as a number (no north/south/east/west or degrees/minutes/seconds needed). The distanceThresh value is the maximum distance allowed between the expected point and the result, in meters. distanceThresh can also go at the root level of the test case at the top of the file, and then it will apply to all tests that don't override it.
The text was updated successfully, but these errors were encountered:
Thanks to the great work of @vesameskanen some time ago, we have the ability to write tests that require the results of a query to be within a certain distance of a given point!
What do we want?
More tests that check the lat/lon of results! 🌐
When do we want it?
Whenever it makes sense. At this point, we don't have any hard and fast rules for when a test should look at the lat/lon of results. However there are definitely cases where they aren't helpful. Many of our tests are specifically for labels, for example, and adding lat/lon requirements might be overspecification.
A great case is whenever we have had a bug where a result who's name, label, etc look correct but the result is not in the right place. This test for San Francisco's centroid being on land, not in the ocean is a great example.
Some ideas
Test Syntax
As a reminder here's the syntax of a test with a lat/lon:
The
coordinates
section in theexpected
section is an array of coordinates (which themselves are arrays). The coordinates are in[longitude, latitude]
format with each point represented as a number (no north/south/east/west or degrees/minutes/seconds needed). ThedistanceThresh
value is the maximum distance allowed between the expected point and the result, in meters.distanceThresh
can also go at the root level of the test case at the top of the file, and then it will apply to all tests that don't override it.The text was updated successfully, but these errors were encountered: