|
|
@ -61,10 +61,9 @@ module.exports.tests.sanitize_lat = function(test, common) { |
|
|
|
lats.valid.forEach( function( lat ){ |
|
|
|
lats.valid.forEach( function( lat ){ |
|
|
|
var req = { query: { 'point.lat': lat, 'point.lon': 0 } }; |
|
|
|
var req = { query: { 'point.lat': lat, 'point.lon': 0 } }; |
|
|
|
sanitize(req, function(){ |
|
|
|
sanitize(req, function(){ |
|
|
|
var expected = JSON.parse(JSON.stringify( defaultClean )); |
|
|
|
var expected_lat = parseFloat( lat ); |
|
|
|
expected.lat = parseFloat( lat ); |
|
|
|
|
|
|
|
t.deepEqual(req.errors, [], 'no errors'); |
|
|
|
t.deepEqual(req.errors, [], 'no errors'); |
|
|
|
t.equal(req.clean.lat, parseFloat(lat), 'clean set correctly (' + lat + ')'); |
|
|
|
t.equal(req.clean.lat, expected_lat, 'clean set correctly (' + lat + ')'); |
|
|
|
}); |
|
|
|
}); |
|
|
|
}); |
|
|
|
}); |
|
|
|
t.end(); |
|
|
|
t.end(); |
|
|
@ -90,10 +89,9 @@ module.exports.tests.sanitize_lon = function(test, common) { |
|
|
|
lons.valid.forEach( function( lon ){ |
|
|
|
lons.valid.forEach( function( lon ){ |
|
|
|
var req = { query: { 'point.lat': 0, 'point.lon': lon } }; |
|
|
|
var req = { query: { 'point.lat': 0, 'point.lon': lon } }; |
|
|
|
sanitize(req, function(){ |
|
|
|
sanitize(req, function(){ |
|
|
|
var expected = JSON.parse(JSON.stringify( defaultClean )); |
|
|
|
var expected_lon = parseFloat( lon ); |
|
|
|
expected.lon = parseFloat( lon ); |
|
|
|
|
|
|
|
t.deepEqual(req.errors, [], 'no errors'); |
|
|
|
t.deepEqual(req.errors, [], 'no errors'); |
|
|
|
t.equal(req.clean.lon, parseFloat(lon), 'clean set correctly (' + lon + ')'); |
|
|
|
t.equal(req.clean.lon, expected_lon, 'clean set correctly (' + lon + ')'); |
|
|
|
}); |
|
|
|
}); |
|
|
|
}); |
|
|
|
}); |
|
|
|
t.end(); |
|
|
|
t.end(); |
|
|
|