Browse Source

Add more test-cases for invalid bbox values.

test/unit/sanitiser/search.js
	-Add some more sanity-check test-cases to verify that bbox
	validation is working as expected.
pull/178/head
Severyn Kozak 10 years ago committed by Julian Simioni
parent
commit
9b77b4434f
  1. 20
      test/unit/sanitiser/search.js

20
test/unit/sanitiser/search.js

@ -167,20 +167,30 @@ 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: [
'-181,90,34,-180', // invalid top_right lon, bottom_left lat // invalid latitude coordinates
'-170,91,-181,45', // invalid top_right lat, bottom_left lon '-181,90,34,-180',
'-181,91,181,-91', // invalid top_right lon/lat, bottom_left lon/lat '-170,91,-181,45',
'91, -181,-91,181',// invalid - spaces between coordinates '-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
'these,are,not,numbers',
'0,0,0,notANumber',
',,,',
'91, -181, -91', // invalid - missing a coordinate '91, -181, -91', // invalid - missing a coordinate
'123,12', // invalid - missing coordinates '123,12', // invalid - missing coordinates
'' // invalid - empty param '' // invalid - empty param
], ],
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',
'10,20,30,40',
'-40,-20,10,30',
'-40,-20,10,30',
'-1200,20,1000,20',
'-1400,90,1400,-90'
] ]
}; };

Loading…
Cancel
Save