Browse Source

Mark previously invalid lat/lon test values as valid

These examples should all now pass with the lat/lon wrapping.
pull/178/head
Julian Simioni 10 years ago
parent
commit
396f27dcba
  1. 14
      test/unit/sanitiser/search.js
  2. 10
      test/unit/sanitiser/suggest.js

14
test/unit/sanitiser/search.js

@ -167,12 +167,6 @@ module.exports.tests.sanitize_optional_geo = function(test, common) {
module.exports.tests.sanitize_bbox = function(test, common) { module.exports.tests.sanitize_bbox = function(test, common) {
var bboxes = { var bboxes = {
invalid_coordinates: [ invalid_coordinates: [
// invalid latitude coordinates
'-181,90,34,-180',
'-170,91,-181,45',
'-181,91,181,-91',
'91, -181,-91,11',
'91, -11,-91,181'
], ],
invalid: [ invalid: [
'91;-181,-91,181', // invalid - semicolon between coordinates '91;-181,-91,181', // invalid - semicolon between coordinates
@ -190,7 +184,13 @@ module.exports.tests.sanitize_bbox = function(test, common) {
'-40,-20,10,30', '-40,-20,10,30',
'-40,-20,10,30', '-40,-20,10,30',
'-1200,20,1000,20', '-1200,20,1000,20',
'-1400,90,1400,-90' '-1400,90,1400,-90',
// wrapped latitude coordinates
'-181,90,34,-180',
'-170,91,-181,45',
'-181,91,181,-91',
'91, -181,-91,11',
'91, -11,-91,181'
] ]
}; };

10
test/unit/sanitiser/suggest.js

@ -129,10 +129,6 @@ module.exports.tests.sanitize_lon = function(test, common) {
module.exports.tests.sanitize_bbox = function(test, common) { module.exports.tests.sanitize_bbox = function(test, common) {
var bboxes = { var bboxes = {
invalid_coordinates: [ invalid_coordinates: [
'-181,90,34,-180', // invalid top_right lon, bottom_left lat
'-170,91,-181,45', // invalid top_right lat, bottom_left lon
'-181,91,181,-91', // invalid top_right lon/lat, bottom_left lon/lat
'91, -181,-91,181',// invalid - spaces between coordinates
], ],
invalid: [ invalid: [
'91;-181,-91,181', // invalid - semicolon between coordinates '91;-181,-91,181', // invalid - semicolon between coordinates
@ -142,7 +138,11 @@ module.exports.tests.sanitize_bbox = function(test, common) {
], ],
valid: [ valid: [
'-179,90,34,-80', // valid top_right lon/lat, bottom_left lon/lat '-179,90,34,-80', // valid top_right lon/lat, bottom_left lon/lat
'0,0,0,0' // valid top_right lat/lon, bottom_left lat/lon '0,0,0,0', // valid top_right lat/lon, bottom_left lat/lon
'-181,90,34,-180', // wrapped top_right lon, bottom_left lat
'-170,91,-181,45', // wrapped top_right lat, bottom_left lon
'-181,91,181,-91', // wrapped top_right lon/lat, bottom_left lon/lat
'91, -181,-91,181',// valid - spaces between coordinates
] ]
}; };

Loading…
Cancel
Save