Allow -1.0 as unlimited for default_radius value (#6599)
This commit is contained in:
+12
-3
@@ -118,10 +118,17 @@ test('constructor: takes a default_radius argument', function(assert) {
|
||||
assert.ok(osrm);
|
||||
});
|
||||
|
||||
test('constructor: takes a default_radius unlimited argument', function(assert) {
|
||||
assert.plan(1);
|
||||
var osrm = new OSRM({algorithm: 'MLD', path: monaco_mld_path, default_radius: 'unlimited'});
|
||||
assert.ok(osrm);
|
||||
});
|
||||
|
||||
test('constructor: throws if default_radius is not a number', function(assert) {
|
||||
assert.plan(2);
|
||||
assert.throws(function() { new OSRM({algorithm: 'MLD', path: monaco_mld_path, default_radius: 'abc'}); }, /default_radius must be an integral number/, 'Does not accept string');
|
||||
assert.plan(3);
|
||||
assert.throws(function() { new OSRM({algorithm: 'MLD', path: monaco_mld_path, default_radius: 'abc'}); }, /default_radius must be unlimited or an integral number/, 'Does not accept invalid string');
|
||||
assert.ok(new OSRM({algorithm: 'MLD', path: monaco_mld_path, default_radius: 1}), 'Does accept number');
|
||||
assert.ok(new OSRM({algorithm: 'MLD', path: monaco_mld_path, default_radius: 'unlimited'}), 'Does accept unlimited');
|
||||
});
|
||||
|
||||
test('constructor: parses custom limits', function(assert) {
|
||||
@@ -135,6 +142,7 @@ test('constructor: parses custom limits', function(assert) {
|
||||
max_locations_map_matching: 1,
|
||||
max_results_nearest: 1,
|
||||
max_alternatives: 1,
|
||||
default_radius: 1
|
||||
});
|
||||
assert.ok(osrm);
|
||||
});
|
||||
@@ -150,7 +158,8 @@ test('constructor: throws on invalid custom limits', function(assert) {
|
||||
max_locations_distance_table: false,
|
||||
max_locations_map_matching: 'a lot',
|
||||
max_results_nearest: null,
|
||||
max_alternatives: '10'
|
||||
max_alternatives: '10',
|
||||
default_radius: '10'
|
||||
})
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user