From 81fb2cc9dad462694b2fc18569a87ea470e8da52 Mon Sep 17 00:00:00 2001 From: Lev Dragunov Date: Mon, 4 Mar 2019 13:08:40 +0300 Subject: [PATCH] Cucumner tests for data_version in matching --- features/step_definitions/matching.js | 4 +++ features/testbot/distance_matrix.feature | 2 +- features/testbot/matching.feature | 25 +++++++++++++++--- features/testbot/snap.feature | 32 +++++++++++++++++++----- features/testbot/trip.feature | 2 +- 5 files changed, 54 insertions(+), 11 deletions(-) diff --git a/features/step_definitions/matching.js b/features/step_definitions/matching.js index d7c62ee07..c8afa5838 100644 --- a/features/step_definitions/matching.js +++ b/features/step_definitions/matching.js @@ -117,6 +117,10 @@ module.exports = function () { got.duration = duration.toString(); } + if (headers.has('data_version')) { + got.data_version = json.data_version || ''; + } + // if header matches 'a:*', parse out the values for * // and return in that header headers.forEach((k) => { diff --git a/features/testbot/distance_matrix.feature b/features/testbot/distance_matrix.feature index 6ac1ce21b..4758669b1 100644 --- a/features/testbot/distance_matrix.feature +++ b/features/testbot/distance_matrix.feature @@ -722,4 +722,4 @@ Feature: Basic Distance Matrix When I request a travel distance matrix I should get | | 1 | 2 | | 1 | 0 | 1000.7 | - | 2 | 1000.7 | 0 | \ No newline at end of file + | 2 | 1000.7 | 0 | diff --git a/features/testbot/matching.feature b/features/testbot/matching.feature index 599afcb1d..56e77edf6 100644 --- a/features/testbot/matching.feature +++ b/features/testbot/matching.feature @@ -21,8 +21,27 @@ Feature: Basic Map Matching | abcd | no | When I match I should get - | trace | timestamps | matchings | - | ab1d | 0 1 2 3 | ad | + | trace | timestamps | matchings | data_version | + | ab1d | 0 1 2 3 | ad | | + + Scenario: Data_version test on matching + Given a grid size of 100 meters + Given the node map + """ + a b c d + + 1 + """ + + And the extract extra arguments "--data_version cucumber_data_version" + + And the ways + | nodes | oneway | + | abcd | no | + + When I match I should get + | trace | timestamps | matchings | data_version | + | ab1d | 0 1 2 3 | ad | cucumber_data_version | Scenario: Testbot - Map matching with trace splitting Given the node map @@ -792,4 +811,4 @@ Feature: Basic Map Matching When I match I should get | trace | geometry | a:distance | a:duration | a:weight | duration | | 2345 | 1.00018,1,1.000315,1 | 15.013264 | 1.5 | 1.5 | 1.5 | - | 4321 | 1.00027,1,1.000135,1 | 15.013264 | 1.5 | 1.5 | 1.5 | \ No newline at end of file + | 4321 | 1.00027,1,1.000135,1 | 15.013264 | 1.5 | 1.5 | 1.5 | diff --git a/features/testbot/snap.feature b/features/testbot/snap.feature index 924e84f75..f9a6fff81 100644 --- a/features/testbot/snap.feature +++ b/features/testbot/snap.feature @@ -47,11 +47,31 @@ Feature: Snap start/end point to the nearest way | adb | When I route I should get - | from | to | route | - | 1 | b | adb,adb | - | 2 | b | adb,adb | - | 6 | b | aub,aub | - | 7 | b | aub,aub | + | from | to | route | data_version | + | 1 | b | adb,adb | | + | 2 | b | adb,adb | | + | 6 | b | aub,aub | | + | 7 | b | aub,aub | | + + Scenario: Data_version check on nearest + Given the node map + """ + 4 5 6 7 + 3 a u + 2 + 1 d b + """ + + And the extract extra arguments "--data_version cucumber_data_version" + + And the ways + | nodes | + | aub | + | adb | + + When I route I should get + | from | to | route | data_version | + | 1 | b | adb,adb | cucumber_data_version | Scenario: Snap to edge right under start/end point Given the node map @@ -182,4 +202,4 @@ Feature: Snap start/end point to the nearest way | x | m | xe,xe | | x | n | xf,xf | | x | o | xg,xg | - | x | p | xh,xh | \ No newline at end of file + | x | p | xh,xh | diff --git a/features/testbot/trip.feature b/features/testbot/trip.feature index c254f8d75..62d2cabd6 100644 --- a/features/testbot/trip.feature +++ b/features/testbot/trip.feature @@ -370,4 +370,4 @@ Feature: Basic trip planning When I plan a trip I should get | waypoints | trips | durations | geometry | | a,b,c,d | abcda | 7.6 | 1,1,1,1.00009,0.99991,1,1,1.00009,1,1,0.99991,1.00009,1,1 | - | d,b,c,a | dbcad | 7.6 | 0.99991,1.00009,1,1,1,1.00009,0.99991,1,1,1.00009,1,1,0.99991,1.00009 | \ No newline at end of file + | d,b,c,a | dbcad | 7.6 | 0.99991,1.00009,1,1,1,1.00009,0.99991,1,1,1.00009,1,1,0.99991,1.00009 |