From 28a8079eefbf92bb5a8c1d645be82445cbd1f25e Mon Sep 17 00:00:00 2001 From: Lauren Budorick Date: Wed, 30 Mar 2016 12:23:57 -0700 Subject: [PATCH] Fix trips + matchLocation --- features/step_definitions/trip.js | 7 ++++++- features/support/data_classes.js | 4 ++-- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/features/step_definitions/trip.js b/features/step_definitions/trip.js index b1cbad177..b1727da3c 100644 --- a/features/step_definitions/trip.js +++ b/features/step_definitions/trip.js @@ -44,7 +44,12 @@ module.exports = function () { var subTrips; if (res.statusCode === 200) { if (headers.has('trips')) { - subTrips = json.trips.filter(t => !!t).map(sub => sub.via_points); + subTrips = json.trips.filter(t => !!t).map(t => t.legs).map(tl => Array.prototype.concat.apply([], tl.map((sl, i) => { + var toAdd = []; + if (i === 0) toAdd.push(sl.steps[0].maneuver.location); + toAdd.push(sl.steps[sl.steps.length-1].maneuver.location); + return toAdd; + }))); } } diff --git a/features/support/data_classes.js b/features/support/data_classes.js index 91909d215..8eeaab336 100644 --- a/features/support/data_classes.js +++ b/features/support/data_classes.js @@ -78,8 +78,8 @@ module.exports = { } matchLocation (got, want) { - return this.match(got[0], util.format('%d ~0.0025%', want.lat)) && - this.match(got[1], util.format('%d ~0.0025%', want.lon)); + return this.match(got[0], util.format('%d ~0.0025%', want.lon)) && + this.match(got[1], util.format('%d ~0.0025%', want.lat)); } } };