add tests for the gaps and tidy map matching flags #4145

This commit is contained in:
Stepan Kuzmin 2017-06-12 13:15:05 +03:00 committed by Patrick Niklaus
parent 5ee3c4de9f
commit 9d30817294

View File

@ -133,7 +133,9 @@ test('match: match in Monaco with all options', function(assert) {
steps: true,
annotations: true,
overview: 'false',
geometries: 'geojson'
geometries: 'geojson',
gaps: 'split',
tidy: false
};
osrm.match(options, function(err, response) {
assert.ifError(err);
@ -196,3 +198,28 @@ test('match: throws on invalid timestamps param', function(assert) {
assert.throws(function() { osrm.match(options, function(err, response) {}) },
/Timestamp array must have the same size as the coordinates array/);
});
test('match: throws on invalid gaps param', function(assert) {
assert.plan(2);
var osrm = new OSRM(data_path);
var options = {
coordinates: three_test_coordinates,
gaps: ['invalid gaps param']
};
assert.throws(function() { osrm.match(options, function(err, response) {}) },
/Gaps must be a string: \[split, ignore\]/);
options.gaps = 'invalid gaps param';
assert.throws(function() { osrm.match(options, function(err, response) {}) },
/'gaps' param must be one of \[split, ignore\]/);
});
test('match: throws on invalid tidy param', function(assert) {
assert.plan(1);
var osrm = new OSRM(data_path);
var options = {
coordinates: three_test_coordinates,
tidy: 'invalid tidy param'
};
assert.throws(function() { osrm.match(options, function(err, response) {}) },
/tidy must be of type Boolean/);
});