From 75b9688ac9fe9fdd5519a346adab5e4dc3148aef Mon Sep 17 00:00:00 2001 From: Sebastian Schmidt Date: Mon, 30 Oct 2017 11:37:01 -0700 Subject: [PATCH 1/2] Adding toString() to GeoPoint. --- src/document.js | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/document.js b/src/document.js index 6b9925d5e..935767e35 100644 --- a/src/document.js +++ b/src/document.js @@ -121,6 +121,16 @@ class GeoPoint { return this._longitude; } + /** + * Returns a string representation for this GeoPoint. + * + * @return {string} The string representation. + */ + toString() { + return `GeoPoint { latitude: ${this.latitude}, longitude: ${this + .longitude} }`; + } + /** * Converts the GeoPoint to a google.type.LatLng proto. * @private From 9a303fbd27a4ab1e2ea0a4866231f95d5f7b9041 Mon Sep 17 00:00:00 2001 From: Sebastian Schmidt Date: Mon, 30 Oct 2017 13:32:04 -0700 Subject: [PATCH 2/2] Adding 100% test coverage --- test/index.js | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/test/index.js b/test/index.js index 3855d1a1c..bb42c61a7 100644 --- a/test/index.js +++ b/test/index.js @@ -490,8 +490,12 @@ describe('snapshot_() method', function() { // We specifically test the GeoPoint properties to ensure 100% test // coverage. - assert.equal(50.1430847, data.geoPointValue.latitude); - assert.equal(-122.947778, data.geoPointValue.longitude); + assert.equal(data.geoPointValue.latitude, 50.1430847); + assert.equal(data.geoPointValue.longitude, -122.947778); + assert.equal( + data.geoPointValue.toString(), + 'GeoPoint { latitude: 50.1430847, longitude: -122.947778 }' + ); } beforeEach(function() {