Add node binding integration
This commit is contained in:
committed by
Patrick Niklaus
parent
a4460abc83
commit
da252c7597
@@ -1,6 +1,7 @@
|
||||
var OSRM = require('../../');
|
||||
var test = require('tape');
|
||||
var data_path = require('./constants').data_path;
|
||||
var mld_data_path = require('./constants').mld_data_path;
|
||||
var three_test_coordinates = require('./constants').three_test_coordinates;
|
||||
var two_test_coordinates = require('./constants').two_test_coordinates;
|
||||
|
||||
@@ -223,3 +224,17 @@ test('match: throws on invalid tidy param', function(assert) {
|
||||
assert.throws(function() { osrm.match(options, function(err, response) {}) },
|
||||
/tidy must be of type Boolean/);
|
||||
});
|
||||
|
||||
test('match: match in Monaco without motorways', function(assert) {
|
||||
assert.plan(3);
|
||||
var osrm = new OSRM({path: mld_data_path, algorithm: 'MLD'});
|
||||
var options = {
|
||||
coordinates: three_test_coordinates,
|
||||
exclude: ['motorway']
|
||||
};
|
||||
osrm.match(options, function(err, response) {
|
||||
assert.ifError(err);
|
||||
assert.equal(response.tracepoints.length, 3);
|
||||
assert.equal(response.matchings.length, 1);
|
||||
});
|
||||
});
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
var OSRM = require('../../');
|
||||
var test = require('tape');
|
||||
var data_path = require('./constants').data_path;
|
||||
var mld_data_path = require('./constants').mld_data_path;
|
||||
var three_test_coordinates = require('./constants').three_test_coordinates;
|
||||
var two_test_coordinates = require('./constants').two_test_coordinates;
|
||||
|
||||
@@ -52,3 +53,16 @@ test('nearest: throws on invalid args', function(assert) {
|
||||
assert.throws(function() { osrm.nearest(options, function(err, res) {}); },
|
||||
/Number must be an integer greater than or equal to 1/);
|
||||
});
|
||||
|
||||
test('nearest: nearest in Monaco without motorways', function(assert) {
|
||||
assert.plan(2);
|
||||
var osrm = new OSRM({path: mld_data_path, algorithm: 'MLD'});
|
||||
var options = {
|
||||
coordinates: [two_test_coordinates[0]],
|
||||
exclude: ['motorway']
|
||||
};
|
||||
osrm.nearest(options, function(err, response) {
|
||||
assert.ifError(err);
|
||||
assert.equal(response.waypoints.length, 1);
|
||||
});
|
||||
});
|
||||
|
||||
@@ -576,3 +576,17 @@ test('route: in Monaco with custom limits on MLD', function(assert) {
|
||||
});
|
||||
});
|
||||
|
||||
test('route: route in Monaco without motorways', function(assert) {
|
||||
assert.plan(3);
|
||||
var osrm = new OSRM({path: monaco_mld_path, algorithm: 'MLD'});
|
||||
var options = {
|
||||
coordinates: two_test_coordinates,
|
||||
exclude: ['motorway']
|
||||
};
|
||||
osrm.route(options, function(err, response) {
|
||||
assert.ifError(err);
|
||||
assert.equal(response.waypoints.length, 2);
|
||||
assert.equal(response.routes.length, 1);
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
var OSRM = require('../../');
|
||||
var test = require('tape');
|
||||
var data_path = require('./constants').data_path;
|
||||
var mld_data_path = require('./constants').mld_data_path;
|
||||
var three_test_coordinates = require('./constants').three_test_coordinates;
|
||||
var two_test_coordinates = require('./constants').two_test_coordinates;
|
||||
|
||||
@@ -166,3 +167,17 @@ test('table: distance table in Monaco without hints', function(assert) {
|
||||
table.destinations.map(assertHasNoHints);
|
||||
});
|
||||
});
|
||||
|
||||
test('table: table in Monaco without motorways', function(assert) {
|
||||
assert.plan(2);
|
||||
var osrm = new OSRM({path: mld_data_path, algorithm: 'MLD'});
|
||||
var options = {
|
||||
coordinates: two_test_coordinates,
|
||||
exclude: ['motorway']
|
||||
};
|
||||
osrm.table(options, function(err, response) {
|
||||
assert.ifError(err);
|
||||
assert.equal(response.durations.length, 2);
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
var OSRM = require('../../');
|
||||
var test = require('tape');
|
||||
var data_path = require('./constants').data_path;
|
||||
var mld_data_path = require('./constants').mld_data_path;
|
||||
var three_test_coordinates = require('./constants').three_test_coordinates;
|
||||
var two_test_coordinates = require('./constants').two_test_coordinates;
|
||||
|
||||
@@ -325,3 +326,18 @@ test('trip: fixed start and end combinations', function(assert) {
|
||||
|
||||
assert.end();
|
||||
});
|
||||
|
||||
test('trip: trip in Monaco without motorways', function(assert) {
|
||||
assert.plan(3);
|
||||
var osrm = new OSRM({path: mld_data_path, algorithm: 'MLD'});
|
||||
var options = {
|
||||
coordinates: two_test_coordinates,
|
||||
exclude: ['motorway']
|
||||
};
|
||||
osrm.trip(options, function(err, response) {
|
||||
assert.ifError(err);
|
||||
assert.equal(response.waypoints.length, 2);
|
||||
assert.equal(response.trips.length, 1);
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user