More cucumber tests for the nearest plugin to restore coverage metric
This commit is contained in:
parent
81fb2cc9da
commit
f2946163d6
@ -59,6 +59,31 @@ Feature: Locating Nearest node on a Way - pick closest way
|
||||
| 3 | u |
|
||||
| 4 | w |
|
||||
|
||||
Scenario: Nearest - inside a oneway triangle
|
||||
Given the node map
|
||||
"""
|
||||
c
|
||||
|
||||
y z
|
||||
0 1
|
||||
2 3 4
|
||||
a x u w b
|
||||
"""
|
||||
|
||||
And the ways
|
||||
| nodes | oneway |
|
||||
| ab | yes |
|
||||
| bc | yes |
|
||||
| ca | yes |
|
||||
|
||||
When I request nearest I should get
|
||||
| in | out |
|
||||
| 0 | y |
|
||||
| 1 | z |
|
||||
| 2 | x |
|
||||
| 3 | u |
|
||||
| 4 | w |
|
||||
|
||||
Scenario: Nearest - High lat/lon
|
||||
Given the node locations
|
||||
| node | lat | lon |
|
||||
@ -78,3 +103,30 @@ Feature: Locating Nearest node on a Way - pick closest way
|
||||
| x | a |
|
||||
| y | b |
|
||||
| z | c |
|
||||
|
||||
Scenario: Nearest - data version
|
||||
Given the node map
|
||||
"""
|
||||
c
|
||||
|
||||
y z
|
||||
0 1
|
||||
2 3 4
|
||||
a x u w b
|
||||
"""
|
||||
|
||||
And the ways
|
||||
| nodes |
|
||||
| ab |
|
||||
| bc |
|
||||
| ca |
|
||||
|
||||
And the extract extra arguments "--data_version cucumber_data_version"
|
||||
|
||||
When I request nearest I should get
|
||||
| in | out | data_version |
|
||||
| 0 | y | cucumber_data_version |
|
||||
| 1 | z | cucumber_data_version |
|
||||
| 2 | x | cucumber_data_version |
|
||||
| 3 | u | cucumber_data_version |
|
||||
| 4 | w | cucumber_data_version |
|
||||
|
||||
@ -5,6 +5,7 @@ module.exports = function () {
|
||||
this.reprocessAndLoadData((e) => {
|
||||
if (e) return callback(e);
|
||||
var testRow = (row, ri, cb) => {
|
||||
|
||||
var inNode = this.findNodeByName(row.in);
|
||||
if (!inNode) throw new Error(util.format('*** unknown in-node "%s"', row.in));
|
||||
|
||||
@ -14,6 +15,7 @@ module.exports = function () {
|
||||
this.requestNearest(inNode, this.queryParams, (err, response) => {
|
||||
if (err) return cb(err);
|
||||
var coord;
|
||||
var headers = new Set(table.raw()[0]);
|
||||
|
||||
if (response.statusCode === 200 && response.body.length) {
|
||||
var json = JSON.parse(response.body);
|
||||
@ -22,6 +24,10 @@ module.exports = function () {
|
||||
|
||||
var got = { in: row.in, out: row.out };
|
||||
|
||||
if (headers.has('data_version')) {
|
||||
got.data_version = json.data_version || '';
|
||||
}
|
||||
|
||||
Object.keys(row).forEach((key) => {
|
||||
if (key === 'out') {
|
||||
if (this.FuzzyMatch.matchLocation(coord, outNode)) {
|
||||
|
||||
Loading…
Reference in New Issue
Block a user