From c44f33b1adce9dccf5047451e6b7b9aed7b30b5f Mon Sep 17 00:00:00 2001 From: Evan Siroky Date: Fri, 24 Feb 2017 16:02:04 -0800 Subject: [PATCH 1/2] fix(validation): correct error message for invalid latitude --- index.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/index.js b/index.js index e6eef1a..0af6229 100644 --- a/index.js +++ b/index.js @@ -62,7 +62,7 @@ function floatize (lonlat) { throw new Error('Invalid longitude value: ' + (lonlat.lon || lonlat.lng || lonlat.longitude)) } if ((!lat || lat > 90 || lat < -90) && lat !== 0) { - throw new Error('Invalid longitude value: ' + (lonlat.lat || lonlat.latitude)) + throw new Error('Invalid latitude value: ' + (lonlat.lat || lonlat.latitude)) } return {lon: lon, lat: lat} } From 8d31b0aa2bc5dfb9f270de6350a90290bdd08afd Mon Sep 17 00:00:00 2001 From: Evan Siroky Date: Fri, 24 Feb 2017 16:06:50 -0800 Subject: [PATCH 2/2] refactor(test): correct snapshot --- __snapshots__/index.test.js.snap | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/__snapshots__/index.test.js.snap b/__snapshots__/index.test.js.snap index fd2d2d2..8da5eaf 100644 --- a/__snapshots__/index.test.js.snap +++ b/__snapshots__/index.test.js.snap @@ -1,8 +1,8 @@ exports[`lonlat errors invalid coordinates should throw error when parsing: "-999,999" 1`] = `"Invalid longitude value: -999"`; -exports[`lonlat errors invalid coordinates should throw error when parsing: "0,999" 1`] = `"Invalid longitude value: 999"`; +exports[`lonlat errors invalid coordinates should throw error when parsing: "0,999" 1`] = `"Invalid latitude value: 999"`; -exports[`lonlat errors invalid coordinates should throw error when parsing: {"lng":1,"latitude":1234} 1`] = `"Invalid longitude value: 1234"`; +exports[`lonlat errors invalid coordinates should throw error when parsing: {"lng":1,"latitude":1234} 1`] = `"Invalid latitude value: 1234"`; exports[`lonlat errors invalid coordinates should throw error when parsing: {} 1`] = `"Invalid longitude value: undefined"`;