From 83b5c5a8955ace622e40b383479d33e5e701e75a Mon Sep 17 00:00:00 2001 From: Jannis R Date: Sat, 11 Jun 2016 21:54:28 +0200 Subject: [PATCH] bugfixes :bug, test for locations --- index.js | 1 + lib/locations.js | 1 - test.js | 14 ++++++++++++++ 3 files changed, 15 insertions(+), 1 deletion(-) diff --git a/index.js b/index.js index ea954b5..cfb01ba 100644 --- a/index.js +++ b/index.js @@ -4,4 +4,5 @@ module.exports = { routes: require('./lib/routes') , departures: require('./lib/departures') , nearby: require('./lib/nearby') + , locations: require('./lib/locations') } diff --git a/lib/locations.js b/lib/locations.js index 02830d5..801c497 100644 --- a/lib/locations.js +++ b/lib/locations.js @@ -21,7 +21,6 @@ const locations = (query, opt) => { opt = Object.assign({}, defaults, opt || {}) const type = util.locations.types.stringify( {station: opt.stations, address: opt.addresses, poi: opt.poi}) - console.log(type) return request({ cfg: {polyEnc: 'GPA'} diff --git a/test.js b/test.js index ca328fb..ea169c0 100755 --- a/test.js +++ b/test.js @@ -182,3 +182,17 @@ hafas.nearby(52.5137344, 13.4744798, {results: 2, distance: 400}) // U Spicherns a.ok(location.distance < 400) } }).catch(onError) + + + +hafas.locations('Alexanderplatz', {results: 10}) +.catch(onError) +.then((locations) => { + a.ok(Array.isArray(locations)) + a.ok(locations.length > 0) + a.ok(locations.length <= 10) + a.ok(locations.every(validLocation)) + a.ok(locations.find(validStation)) + a.ok(locations.find(validPoi)) + a.ok(locations.find(validAddress)) +}).catch(onError)