Skip to content

Commit

Permalink
Test that string coords are parsed to numbers
Browse files Browse the repository at this point in the history
Refs #24
  • Loading branch information
Casey Thomas committed Sep 18, 2016
1 parent 22fb0e5 commit d9313b4
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions test/test.js
Original file line number Diff line number Diff line change
Expand Up @@ -395,7 +395,16 @@ describe('GeoJSON', function() {
expect(output.features[0].geometry.coordinates[1]).to.equal(10.1);
expect(output.features[0].geometry.type).to.equal('Point');
expect(output.features[0].properties.name).to.equal('Location A');
});

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');
});
});
});
});

0 comments on commit d9313b4

Please sign in to comment.