@@ -59,7 +59,31 @@ describe('Geo Point', () => {
59
59
} ) ;
60
60
} ) ;
61
61
62
- it ( 'can sequence a line of points by distance' , ( done ) => {
62
+ it ( 'can sequence a line of points by distance - without unsorted parameter' , ( done ) => {
63
+ let line = [ ] ;
64
+ for ( let i = 0 ; i < 10 ; i ++ ) {
65
+ let obj = new TestObject ( ) ;
66
+ let point = new Parse . GeoPoint ( i * 4 - 12 , i * 3.2 - 11 ) ;
67
+ obj . set ( 'location' , point ) ;
68
+ obj . set ( 'construct' , 'line' ) ;
69
+ obj . set ( 'seq' , i ) ;
70
+ line . push ( obj ) ;
71
+ }
72
+ Parse . Object . saveAll ( line ) . then ( ( ) => {
73
+ let query = new Parse . Query ( TestObject ) ;
74
+ let point = new Parse . GeoPoint ( 24 , 19 ) ;
75
+ query . equalTo ( 'construct' , 'line' ) ;
76
+ query . withinMiles ( 'location' , point , 10000 ) ;
77
+ return query . find ( ) ;
78
+ } ) . then ( ( results ) => {
79
+ assert . equal ( results . length , 10 ) ;
80
+ assert . equal ( results [ 0 ] . get ( 'seq' ) , 9 ) ;
81
+ assert . equal ( results [ 3 ] . get ( 'seq' ) , 6 ) ;
82
+ done ( ) ;
83
+ } ) ;
84
+ } ) ;
85
+
86
+ it ( 'can sequence a line of points by distance - with unsorted parameter' , ( done ) => {
63
87
let line = [ ] ;
64
88
for ( let i = 0 ; i < 10 ; i ++ ) {
65
89
let obj = new TestObject ( ) ;
@@ -97,7 +121,7 @@ describe('Geo Point', () => {
97
121
let query = new Parse . Query ( TestObject ) ;
98
122
let point = new Parse . GeoPoint ( 1 , - 1 ) ;
99
123
query . equalTo ( 'construct' , 'large_dist' ) ;
100
- query . withinRadians ( 'location' , point , 3.14 , true ) ;
124
+ query . withinRadians ( 'location' , point , 3.14 ) ;
101
125
return query . find ( ) ;
102
126
} ) . then ( ( results ) => {
103
127
assert . equal ( results . length , 3 ) ;
@@ -119,7 +143,7 @@ describe('Geo Point', () => {
119
143
let query = new Parse . Query ( TestObject ) ;
120
144
let point = new Parse . GeoPoint ( 1 , - 1 ) ;
121
145
query . equalTo ( 'construct' , 'medium_dist' ) ;
122
- query . withinRadians ( 'location' , point , 3.14 * 0.5 , true ) ;
146
+ query . withinRadians ( 'location' , point , 3.14 * 0.5 ) ;
123
147
return query . find ( ) ;
124
148
} ) . then ( ( results ) => {
125
149
assert . equal ( results . length , 2 ) ;
@@ -143,7 +167,7 @@ describe('Geo Point', () => {
143
167
let query = new Parse . Query ( TestObject ) ;
144
168
let point = new Parse . GeoPoint ( 1 , - 1 ) ;
145
169
query . equalTo ( 'construct' , 'small_dist' ) ;
146
- query . withinRadians ( 'location' , point , 3.14 * 0.25 , true ) ;
170
+ query . withinRadians ( 'location' , point , 3.14 * 0.25 ) ;
147
171
return query . find ( ) ;
148
172
} ) . then ( ( results ) => {
149
173
assert . equal ( results . length , 1 ) ;
@@ -155,7 +179,7 @@ describe('Geo Point', () => {
155
179
it ( 'can measure distance within km - everywhere' , ( done ) => {
156
180
let sfo = new Parse . GeoPoint ( 37.6189722 , - 122.3748889 ) ;
157
181
let query = new Parse . Query ( TestPoint ) ;
158
- query . withinKilometers ( 'location' , sfo , 4000.0 , true ) ;
182
+ query . withinKilometers ( 'location' , sfo , 4000.0 ) ;
159
183
query . find ( ) . then ( ( results ) => {
160
184
assert . equal ( results . length , 3 ) ;
161
185
done ( ) ;
@@ -165,7 +189,7 @@ describe('Geo Point', () => {
165
189
it ( 'can measure distance within km - california' , ( done ) => {
166
190
let sfo = new Parse . GeoPoint ( 37.6189722 , - 122.3748889 ) ;
167
191
let query = new Parse . Query ( TestPoint ) ;
168
- query . withinKilometers ( 'location' , sfo , 3700.0 , true ) ;
192
+ query . withinKilometers ( 'location' , sfo , 3700.0 ) ;
169
193
query . find ( ) . then ( ( results ) => {
170
194
assert . equal ( results . length , 2 ) ;
171
195
assert . equal ( results [ 0 ] . get ( 'name' ) , 'San Francisco' ) ;
@@ -177,7 +201,7 @@ describe('Geo Point', () => {
177
201
it ( 'can measure distance within km - bay area' , ( done ) => {
178
202
let sfo = new Parse . GeoPoint ( 37.6189722 , - 122.3748889 ) ;
179
203
let query = new Parse . Query ( TestPoint ) ;
180
- query . withinKilometers ( 'location' , sfo , 100.0 , true ) ;
204
+ query . withinKilometers ( 'location' , sfo , 100.0 ) ;
181
205
query . find ( ) . then ( ( results ) => {
182
206
assert . equal ( results . length , 1 ) ;
183
207
assert . equal ( results [ 0 ] . get ( 'name' ) , 'San Francisco' ) ;
@@ -188,7 +212,7 @@ describe('Geo Point', () => {
188
212
it ( 'can measure distance within km - mid peninsula' , ( done ) => {
189
213
let sfo = new Parse . GeoPoint ( 37.6189722 , - 122.3748889 ) ;
190
214
let query = new Parse . Query ( TestPoint ) ;
191
- query . withinKilometers ( 'location' , sfo , 10.0 , true ) ;
215
+ query . withinKilometers ( 'location' , sfo , 10.0 ) ;
192
216
query . find ( ) . then ( ( results ) => {
193
217
assert . equal ( results . length , 0 ) ;
194
218
done ( ) ;
@@ -198,7 +222,7 @@ describe('Geo Point', () => {
198
222
it ( 'can measure distance within miles - everywhere' , ( done ) => {
199
223
let sfo = new Parse . GeoPoint ( 37.6189722 , - 122.3748889 ) ;
200
224
let query = new Parse . Query ( TestPoint ) ;
201
- query . withinMiles ( 'location' , sfo , 2500.0 , true ) ;
225
+ query . withinMiles ( 'location' , sfo , 2500.0 ) ;
202
226
query . find ( ) . then ( ( results ) => {
203
227
assert . equal ( results . length , 3 ) ;
204
228
done ( ) ;
@@ -208,7 +232,7 @@ describe('Geo Point', () => {
208
232
it ( 'can measure distance within miles - california' , ( done ) => {
209
233
let sfo = new Parse . GeoPoint ( 37.6189722 , - 122.3748889 ) ;
210
234
let query = new Parse . Query ( TestPoint ) ;
211
- query . withinMiles ( 'location' , sfo , 2200.0 , true ) ;
235
+ query . withinMiles ( 'location' , sfo , 2200.0 ) ;
212
236
query . find ( ) . then ( ( results ) => {
213
237
assert . equal ( results . length , 2 ) ;
214
238
assert . equal ( results [ 0 ] . get ( 'name' ) , 'San Francisco' ) ;
@@ -220,7 +244,7 @@ describe('Geo Point', () => {
220
244
it ( 'can measure distance within miles - bay area' , ( done ) => {
221
245
let sfo = new Parse . GeoPoint ( 37.6189722 , - 122.3748889 ) ;
222
246
let query = new Parse . Query ( TestPoint ) ;
223
- query . withinMiles ( 'location' , sfo , 75.0 , true ) ;
247
+ query . withinMiles ( 'location' , sfo , 75.0 ) ;
224
248
query . find ( ) . then ( ( results ) => {
225
249
assert . equal ( results . length , 1 ) ;
226
250
assert . equal ( results [ 0 ] . get ( 'name' ) , 'San Francisco' ) ;
@@ -231,7 +255,7 @@ describe('Geo Point', () => {
231
255
it ( 'can measure distance within km - mid peninsula' , ( done ) => {
232
256
let sfo = new Parse . GeoPoint ( 37.6189722 , - 122.3748889 ) ;
233
257
let query = new Parse . Query ( TestPoint ) ;
234
- query . withinMiles ( 'location' , sfo , 10.0 , true ) ;
258
+ query . withinMiles ( 'location' , sfo , 10.0 ) ;
235
259
query . find ( ) . then ( ( results ) => {
236
260
assert . equal ( results . length , 0 ) ;
237
261
done ( ) ;
0 commit comments