Return first alternative in tests

This commit is contained in:
Jeff Miccolis 2016-03-29 15:17:46 -04:00 committed by Patrick Niklaus
parent fd000cad86
commit d48ee84ae7
2 changed files with 5 additions and 3 deletions

View File

@ -75,8 +75,10 @@ module.exports = function () {
got.route = (instructions || '').trim(); got.route = (instructions || '').trim();
if (headers.has('alternative')) { if (headers.has('alternative')) {
got.alternative = json.found_alternative ? // TODO examine more than first alternative?
this.wayList(json.alternative_instructions[0]) : ''; got.alternative ='';
if (json.routes && json.routes.length > 1)
got.alternative = this.wayList(json.routes[1]);
} }
var distance = hasRoute && json.routes[0].distance, var distance = hasRoute && json.routes[0].distance,

View File

@ -19,7 +19,7 @@ Feature: Alternative route
| ca | yes | | ca | yes |
And the query options And the query options
| alt | true | | alternative | true |
When I route I should get When I route I should get
| from | to | route | alternative | | from | to | route | alternative |