provide rate and weight headers for checking in routability tests
This commit is contained in:
committed by
Patrick Niklaus
parent
24fe881d03
commit
1c25070572
@@ -92,7 +92,8 @@ module.exports = function () {
|
||||
}
|
||||
|
||||
var distance = hasRoute && json.routes[0].distance,
|
||||
time = hasRoute && json.routes[0].duration;
|
||||
time = hasRoute && json.routes[0].duration,
|
||||
weight = hasRoute && json.routes[0].weight;
|
||||
|
||||
if (headers.has('distance')) {
|
||||
if (row.distance.length) {
|
||||
@@ -104,6 +105,16 @@ module.exports = function () {
|
||||
}
|
||||
}
|
||||
|
||||
if (headers.has('weight')) {
|
||||
if (row.weight.length) {
|
||||
if (!row.weight.match(/[\d\.]+/))
|
||||
return cb(new Error('*** Weight must be specified as a numeric value. (ex: 8)'));
|
||||
got.weight = instructions ? util.format('%dm', weight) : '';
|
||||
} else {
|
||||
got.weight = '';
|
||||
}
|
||||
}
|
||||
|
||||
if (headers.has('time')) {
|
||||
if (!row.time.match(/\d+s/))
|
||||
return cb(new Error('*** Time must be specied in seconds. (ex: 60s)'));
|
||||
@@ -161,6 +172,7 @@ module.exports = function () {
|
||||
putValue('destinations', destinations);
|
||||
putValue('weight_name', weight_name);
|
||||
putValue('weights', weights);
|
||||
putValue('weight', weight);
|
||||
}
|
||||
|
||||
for (var key in row) {
|
||||
|
||||
Reference in New Issue
Block a user