Add cucumber tests for node IDs
This commit is contained in:
parent
a4ac07866a
commit
6777127497
@ -34,7 +34,8 @@ module.exports = function () {
|
||||
turns = '',
|
||||
route = '',
|
||||
duration = '',
|
||||
annotation = '';
|
||||
annotation = '',
|
||||
OSMIDs = '';
|
||||
|
||||
|
||||
if (res.statusCode === 200) {
|
||||
@ -61,6 +62,11 @@ module.exports = function () {
|
||||
if (json.matchings.length != 1) throw new Error('*** Checking annotation only supported for matchings with one subtrace');
|
||||
annotation = this.annotationList(json.matchings[0]);
|
||||
}
|
||||
|
||||
if (headers.has('OSM IDs')) {
|
||||
if (json.matchings.length != 1) throw new Error('*** CHecking annotation only supported for matchings with one subtrace');
|
||||
OSMIDs = this.OSMIDList(json.matchings[0]);
|
||||
}
|
||||
}
|
||||
|
||||
if (headers.has('turns')) {
|
||||
@ -79,6 +85,10 @@ module.exports = function () {
|
||||
got.annotation = annotation.toString();
|
||||
}
|
||||
|
||||
if (headers.has('OSM IDs')) {
|
||||
got['OSM IDs'] = OSMIDs;
|
||||
}
|
||||
|
||||
var ok = true;
|
||||
var encodedResult = '',
|
||||
extendedTarget = '';
|
||||
|
@ -163,6 +163,11 @@ module.exports = function () {
|
||||
return matching.legs.map(l => {return zip(l.annotation.duration, l.annotation.distance).map(p => { return p.join(':'); }).join(','); }).join(',');
|
||||
};
|
||||
|
||||
this.OSMIDList = (instructions) => {
|
||||
// OSM node IDs also come from the annotation list
|
||||
return instructions.annotation.nodes.map(x => x.toString()).join(',');
|
||||
}
|
||||
|
||||
this.turnList = (instructions) => {
|
||||
return instructions.legs.reduce((m, v) => m.concat(v.steps), [])
|
||||
.map(v => {
|
||||
|
@ -122,3 +122,9 @@ Feature: Basic Map Matching
|
||||
| trace | matchings | annotation |
|
||||
| abeh | abcedgh | 1:9.897633,0:0,1:10.008842,1:10.008842,1:10.008842,0:0,2:20.017685,1:10.008842 |
|
||||
| abci | abc,ci | 1:9.897633,0:0,1:10.008842,0:0.111209,1:10.010367 |
|
||||
|
||||
# The following is the same as the above, but separated for readability (line length)
|
||||
When I match I should get
|
||||
| trace | matchings | OSM IDs |
|
||||
| abeh | abcedgh | 1,2,3,2,3,4,5,4,5,6,7 |
|
||||
| abci | abc,ci | 1,2,3,2,3,8,3,8 |
|
||||
|
Loading…
Reference in New Issue
Block a user