Fix fallback speed validity checks (#5300)
* fix fallback_speeds check to only accept values > 0 * add invalid_fallback_speed
This commit is contained in:
@@ -260,6 +260,29 @@ tables.forEach(function(annotation) {
|
||||
});
|
||||
});
|
||||
|
||||
test('table: ' + annotation + ' table in Monaco with invalid fallback speeds and fallback coordinates', function(assert) {
|
||||
assert.plan(4);
|
||||
var osrm = new OSRM({path: mld_data_path, algorithm: 'MLD'});
|
||||
var options = {
|
||||
coordinates: two_test_coordinates,
|
||||
annotations: [annotation.slice(0,-1)],
|
||||
fallback_speed: -1
|
||||
};
|
||||
|
||||
assert.throws(()=>osrm.table(options, (err, res) => {}), /fallback_speed must be > 0/, "should throw on invalid fallback_speeds");
|
||||
|
||||
options.fallback_speed = '10';
|
||||
assert.throws(()=>osrm.table(options, (err, res) => {}), /fallback_speed must be a number/, "should throw on invalid fallback_speeds");
|
||||
|
||||
options.fallback_speed = 10;
|
||||
options.fallback_coordinate = 'bla';
|
||||
assert.throws(()=>osrm.table(options, (err, res) => {}), /fallback_coordinate' param must be one of \[input, snapped\]/, "should throw on invalid fallback_coordinate");
|
||||
|
||||
options.fallback_coordinate = 10;
|
||||
assert.throws(()=>osrm.table(options, (err, res) => {}), /fallback_coordinate must be a string: \[input, snapped\]/, "should throw on invalid fallback_coordinate");
|
||||
|
||||
});
|
||||
|
||||
test('table: ' + annotation + ' table in Monaco with invalid scale factor', function(assert) {
|
||||
assert.plan(3);
|
||||
var osrm = new OSRM({path: mld_data_path, algorithm: 'MLD'});
|
||||
|
||||
Reference in New Issue
Block a user