Skip to content

Commit

Permalink
bugfixes :bug, test for locations
Browse files Browse the repository at this point in the history
  • Loading branch information
derhuerst committed Jun 11, 2016
1 parent 18d1f5e commit 83b5c5a
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 1 deletion.
1 change: 1 addition & 0 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,5 @@ module.exports = {
routes: require('./lib/routes')
, departures: require('./lib/departures')
, nearby: require('./lib/nearby')
, locations: require('./lib/locations')
}
1 change: 0 additions & 1 deletion lib/locations.js
Original file line number Diff line number Diff line change
Expand Up @@ -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'}
Expand Down
14 changes: 14 additions & 0 deletions test.js
Original file line number Diff line number Diff line change
Expand Up @@ -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)

0 comments on commit 83b5c5a

Please sign in to comment.