Map matching test coverage fix (#3201)

* fixed map matching test coverage
This commit is contained in:
Kajari Ghosh
2016-10-29 11:22:09 -04:00
committed by GitHub
parent f02b7b0910
commit 6fc0609a62
4 changed files with 29 additions and 19 deletions
+12 -2
View File
@@ -43,7 +43,17 @@ module.exports = function () {
if (res.statusCode === 200) {
if (headers.has('matchings')) {
subMatchings = json.matchings.filter(m => !!m).map(sub => sub.matched_points);
subMatchings = [];
var sub = [json.tracepoints[0].location];
for(var i = 1; i < json.tracepoints.length; i++){
if(json.tracepoints[i-1].matchings_index === json.tracepoints[i].matchings_index) {
sub.push(json.tracepoints[i].location);
} else {
subMatchings.push(sub);
sub = [json.tracepoints[i].location];
}
}
subMatchings.push(sub);
}
if (headers.has('turns')) {
@@ -68,7 +78,7 @@ module.exports = function () {
if (headers.has('geometry')) {
if (json.matchings.length != 1) throw new Error('*** Checking geometry only supported for matchings with one subtrace');
geometry = json.matchings[0].geometry;
geometry = json.matchings[0].geometry.coordinates;
}
if (headers.has('OSM IDs')) {