Skip to content

Commit 70449f4

Browse files
committed
spec: fix issue with realtime update spec
1 parent 6e66e32 commit 70449f4

File tree

3 files changed

+25
-22
lines changed

3 files changed

+25
-22
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,7 @@ Each doc also contains returns _distance_ and _bearing_ calculated on the query
119119

120120
### `point(latitude: number, longitude: number)`
121121

122-
Returns a GeoFirePoint allowing you to create geohashes, format data, and calculate relative distance/bearing.
122+
Returns an object with the required geohash format to save to Firestore.
123123

124124
Example: `const point = geo.point(38, -119)`
125125

spec/main.spec.ts

Lines changed: 21 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -118,24 +118,7 @@ describe('GeoFireX', () => {
118118
done();
119119
});
120120

121-
test('should update the query in realtime on add/delete', done => {
122-
const query = ref.within(center, 0.5, 'pos');
123-
const dbRef = firebase.firestore().doc('bearings/testPoint');
124-
let i = 1;
125-
query.pipe(take(3)).subscribe(async val => {
126-
if (i === 1) {
127-
expect(val.length).toBe(4);
128-
await dbRef.set({ pos: gfx.point(40.49999, -80) });
129-
i++;
130-
} else if (i === 2) {
131-
expect(val.length).toBe(5);
132-
await dbRef.delete();
133-
done();
134-
} else {
135-
expect(val.length).toBe(4);
136-
}
137-
});
138-
});
121+
139122
});
140123

141124
describe('Custom Operators', () => {
@@ -171,6 +154,26 @@ describe('GeoFireX', () => {
171154
expect(first).toBeLessThan(last);
172155
done();
173156
});
157+
158+
test('should update the query in realtime on add/delete', async done => {
159+
const query = ref.within(center, 0.4, 'pos');
160+
const dbRef = firebase.firestore().doc('bearings/testPoint');
161+
let i = 1;
162+
query.pipe(take(3)).subscribe(async val => {
163+
if (i === 1) {
164+
expect(val.length).toBe(4);
165+
i++;
166+
dbRef.set({ pos: gfx.point(40.49999, -80) });
167+
} else if (i === 2) {
168+
dbRef.delete();
169+
expect(val.length).toBe(5);
170+
i++;
171+
} else {
172+
expect(val.length).toBe(4);
173+
done();
174+
}
175+
});
176+
});
174177
});
175178
});
176179

src/query.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -42,9 +42,9 @@ export class GeoFireQuery<T = any> {
4242
// GEO QUERIES
4343
/**
4444
* Queries the Firestore collection based on geograpic radius
45-
* @param {GeoFirePoint} center the starting point for the query, i.e gfx.point(lat, lng)
45+
* @param {FirePoint} center the starting point for the query, i.e gfx.point(lat, lng)
4646
* @param {number} radius the radius to search from the centerpoint
47-
* @param {string} field the document field that contains the GeoFirePoint data
47+
* @param {string} field the document field that contains the FirePoint data
4848
* @param {GeoQueryOptions} opts=defaultOpts
4949
* @returns {Observable<GeoQueryDocument>} sorted by nearest to farthest
5050
*/
@@ -171,7 +171,7 @@ function createStream(input): Observable<any> {
171171
}
172172
/**
173173
* RxJS operator that converts a collection to a GeoJSON FeatureCollection
174-
* @param {string} field the document field that contains the GeoFirePoint
174+
* @param {string} field the document field that contains the FirePoint
175175
* @param {boolean=false} includeProps
176176
*/
177177
export function toGeoJSON(field: string, includeProps: boolean = false) {

0 commit comments

Comments
 (0)