Add tests for node bindings.
This commit is contained in:
parent
4f0418684c
commit
f3b72106c4
@ -606,3 +606,51 @@ test('route: route in Monaco without motorways', function(assert) {
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
|
test('route: throws on invalid waypoints values needs at least two', function (assert) {
|
||||||
|
assert.plan(1);
|
||||||
|
var osrm = new OSRM(monaco_path);
|
||||||
|
var options = {
|
||||||
|
steps: true,
|
||||||
|
coordinates: three_test_coordinates,
|
||||||
|
waypoints: [0]
|
||||||
|
};
|
||||||
|
assert.throws(function () { osrm.route(options, function (err, response) { }); },
|
||||||
|
'At least two waypoints must be provided');
|
||||||
|
});
|
||||||
|
|
||||||
|
test('route: throws on invalid waypoints values, needs first and last coordinate indices', function (assert) {
|
||||||
|
assert.plan(1);
|
||||||
|
var osrm = new OSRM(monaco_path);
|
||||||
|
var options = {
|
||||||
|
steps: true,
|
||||||
|
coordinates: three_test_coordinates,
|
||||||
|
waypoints: [1, 2]
|
||||||
|
};
|
||||||
|
assert.throws(function () { osrm.route(options, function (err, response) { console.log(err); }); },
|
||||||
|
'First and last waypoints values must correspond to first and last coordinate indices');
|
||||||
|
});
|
||||||
|
|
||||||
|
test('route: throws on invalid waypoints values, order matters', function (assert) {
|
||||||
|
assert.plan(1);
|
||||||
|
var osrm = new OSRM(monaco_path);
|
||||||
|
var options = {
|
||||||
|
steps: true,
|
||||||
|
coordinates: three_test_coordinates,
|
||||||
|
waypoints: [2, 0]
|
||||||
|
};
|
||||||
|
assert.throws(function () { osrm.route(options, function (err, response) { console.log(err); }); },
|
||||||
|
'First and last waypoints values must correspond to first and last coordinate indices');
|
||||||
|
});
|
||||||
|
|
||||||
|
test('route: throws on invalid waypoints values, waypoints must correspond with a coordinate index', function (assert) {
|
||||||
|
assert.plan(1);
|
||||||
|
var osrm = new OSRM(monaco_path);
|
||||||
|
var options = {
|
||||||
|
steps: true,
|
||||||
|
coordinates: three_test_coordinates,
|
||||||
|
waypoints: [0, 3, 2]
|
||||||
|
};
|
||||||
|
assert.throws(function () { osrm.route(options, function (err, response) { console.log(err); }); },
|
||||||
|
'Waypoints must correspond with the index of an input coordinate');
|
||||||
|
});
|
||||||
Loading…
Reference in New Issue
Block a user