From 18ee34b52e6eac1cc12ffad6d3f382e3cfafb640 Mon Sep 17 00:00:00 2001 From: Casey Thomas Date: Sun, 18 Sep 2016 13:31:29 -0400 Subject: [PATCH] Test that string coords are parsed to numbers Refs #24 --- test/test.js | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/test/test.js b/test/test.js index 826281c..afc86b5 100644 --- a/test/test.js +++ b/test/test.js @@ -382,5 +382,16 @@ describe('GeoJSON', function() { expect(function(){ GeoJSON.parse(data, options); }).to.not.throwException(); }); + + + it("converts string coordinates into numbers", function() { + var data = [{ lat: '39.343', lng: '-74.454'}]; + var output = GeoJSON.parse(data, {Point: ['lat', 'lng']}); + + output.features.forEach(function(feature) { + expect(feature.geometry.coordinates[0]).to.be.a('number'); + expect(feature.geometry.coordinates[1]).to.be.a('number'); + }); + }); }); });