|
|
|
@ -241,13 +241,12 @@ module.exports.tests.rect = function(test, common) {
|
|
|
|
|
}; |
|
|
|
|
var mandatory = false; |
|
|
|
|
|
|
|
|
|
sanitize.sanitize_rect( 'boundary.rect', clean, params, mandatory ); |
|
|
|
|
t.equal(clean['boundary.rect.min_lat'], params['boundary.rect.min_lat'], 'min_lat approved'); |
|
|
|
|
t.equal(clean['boundary.rect.max_lat'], params['boundary.rect.max_lat'], 'min_lat approved'); |
|
|
|
|
t.equal(clean['boundary.rect.min_lon'], params['boundary.rect.min_lon'], 'min_lat approved'); |
|
|
|
|
t.equal(clean['boundary.rect.max_lon'], params['boundary.rect.max_lon'], 'min_lat approved'); |
|
|
|
|
t.throws( function(){ |
|
|
|
|
sanitize.sanitize_rect( 'boundary.rect', clean, params, mandatory ); |
|
|
|
|
},/boundary.rect.min_lat \(0\) must be less than boundary.rect.max_lat \(0\)/); |
|
|
|
|
t.end(); |
|
|
|
|
}); |
|
|
|
|
|
|
|
|
|
test('invalid rect - partially specified', function (t) { |
|
|
|
|
var clean = {}; |
|
|
|
|
var params = { |
|
|
|
@ -293,11 +292,59 @@ module.exports.tests.rect = function(test, common) {
|
|
|
|
|
}; |
|
|
|
|
var mandatory = false; |
|
|
|
|
|
|
|
|
|
t.throws( function() { |
|
|
|
|
sanitize.sanitize_rect( 'boundary.rect', clean, params, mandatory ); |
|
|
|
|
},/boundary.rect.min_lat \(52.7945\) must be less than boundary.rect.max_lat \(52.2387\)/, 'should error when min >= max'); |
|
|
|
|
t.end(); |
|
|
|
|
}); |
|
|
|
|
|
|
|
|
|
test('invalid rect - max/min equal', function (t) { |
|
|
|
|
var clean = {}; |
|
|
|
|
var params = { |
|
|
|
|
'boundary.rect.max_lat': 52, |
|
|
|
|
'boundary.rect.max_lon': 14, |
|
|
|
|
'boundary.rect.min_lat': 52, |
|
|
|
|
'boundary.rect.min_lon': 12 |
|
|
|
|
}; |
|
|
|
|
var mandatory = false; |
|
|
|
|
|
|
|
|
|
t.throws( function() { |
|
|
|
|
sanitize.sanitize_rect( 'boundary.rect', clean, params, mandatory ); |
|
|
|
|
}); |
|
|
|
|
t.end(); |
|
|
|
|
}); |
|
|
|
|
|
|
|
|
|
test('invalid rect - out of range latitude', function(t) { |
|
|
|
|
var clean = {}; |
|
|
|
|
var params = { |
|
|
|
|
'boundary.rect.max_lat': 352.2387, |
|
|
|
|
'boundary.rect.max_lon': 14.1367, |
|
|
|
|
'boundary.rect.min_lat': 52.7945, |
|
|
|
|
'boundary.rect.min_lon': 12.6398 |
|
|
|
|
}; |
|
|
|
|
var mandatory = false; |
|
|
|
|
|
|
|
|
|
t.throws( function() { |
|
|
|
|
sanitize.sanitize_rect( 'boundary.rect', clean, params, mandatory ); |
|
|
|
|
}, /boundary.rect.max_lat value 352.2387 is outside range -90,90/, 'should throw error on boundary.rect.max_lat value'); |
|
|
|
|
t.end(); |
|
|
|
|
}); |
|
|
|
|
|
|
|
|
|
test('invalid rect - out of range longitude', function(t) { |
|
|
|
|
var clean = {}; |
|
|
|
|
var params = { |
|
|
|
|
'boundary.rect.max_lat': 52.2387, |
|
|
|
|
'boundary.rect.max_lon': 14.1367, |
|
|
|
|
'boundary.rect.min_lat': 12.7945, |
|
|
|
|
'boundary.rect.min_lon': -200.6398 |
|
|
|
|
}; |
|
|
|
|
var mandatory = false; |
|
|
|
|
|
|
|
|
|
t.throws( function() { |
|
|
|
|
sanitize.sanitize_rect( 'boundary.rect', clean, params, mandatory ); |
|
|
|
|
}, /boundary.rect.min_lon value -200.6398 is outside range -180,180/, 'should throw error on boundary.rect.min_lon'); |
|
|
|
|
t.end(); |
|
|
|
|
}); |
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
module.exports.tests.circle = function(test, common) { |
|
|
|
|