mirror of
https://github.com/public-transport/db-vendo-client.git
synced 2025-04-20 23:23:56 +03:00
INSA: enable journeyLeg
This commit is contained in:
parent
68bf199673
commit
ba97275bae
3 changed files with 35 additions and 2 deletions
|
@ -17,6 +17,11 @@ client.journeys('008010226', '008013456', {results: 1})
|
||||||
// longitude: 11.641705
|
// longitude: 11.641705
|
||||||
// }, {distance: 200})
|
// }, {distance: 200})
|
||||||
|
|
||||||
|
// .then(([journey]) => {
|
||||||
|
// const leg = journey.legs[0]
|
||||||
|
// return client.journeyLeg(leg.id, leg.line.name)
|
||||||
|
// })
|
||||||
|
|
||||||
.then(data => {
|
.then(data => {
|
||||||
console.log(require('util').inspect(data, { depth: null }))
|
console.log(require('util').inspect(data, { depth: null }))
|
||||||
})
|
})
|
||||||
|
|
|
@ -73,9 +73,9 @@ const insaProfile = {
|
||||||
parseProducts: createParseBitmask(products.allProducts, defaultProducts),
|
parseProducts: createParseBitmask(products.allProducts, defaultProducts),
|
||||||
formatProducts,
|
formatProducts,
|
||||||
|
|
||||||
parseLine: createParseLine
|
parseLine: createParseLine,
|
||||||
|
|
||||||
// todo: journeyLeg?
|
journeyLeg: true
|
||||||
// todo: radar?
|
// todo: radar?
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
28
test/insa.js
28
test/insa.js
|
@ -255,6 +255,34 @@ test('nearby Magdeburg Hbf', co(function*(t) {
|
||||||
t.end()
|
t.end()
|
||||||
}))
|
}))
|
||||||
|
|
||||||
|
test('journey leg details', co(function* (t) {
|
||||||
|
const magdeburgHbf = '8010224'
|
||||||
|
const magdeburgBuckau = '8013456'
|
||||||
|
const [journey] = yield client.journeys(magdeburgHbf, magdeburgBuckau, {
|
||||||
|
results: 1, when
|
||||||
|
})
|
||||||
|
|
||||||
|
const p = journey.legs[0]
|
||||||
|
t.ok(p, 'missing legs[0]')
|
||||||
|
t.ok(p.id, 'missing legs[0].id')
|
||||||
|
t.ok(p.line, 'missing legs[0].line')
|
||||||
|
t.ok(p.line.name, 'missing legs[0].line.name')
|
||||||
|
const leg = yield client.journeyLeg(p.id, p.line.name, {when})
|
||||||
|
|
||||||
|
t.equal(typeof leg.id, 'string')
|
||||||
|
t.ok(leg.id)
|
||||||
|
|
||||||
|
assertValidLine(t, leg.line)
|
||||||
|
|
||||||
|
t.equal(typeof leg.direction, 'string')
|
||||||
|
t.ok(leg.direction)
|
||||||
|
|
||||||
|
t.ok(Array.isArray(leg.passed))
|
||||||
|
for (let passed of leg.passed) assertValidStopover(t, passed)
|
||||||
|
|
||||||
|
t.end()
|
||||||
|
}))
|
||||||
|
|
||||||
test('locations named Magdeburg', co(function*(t) {
|
test('locations named Magdeburg', co(function*(t) {
|
||||||
const locations = yield client.locations('Magdeburg', {
|
const locations = yield client.locations('Magdeburg', {
|
||||||
results: 10
|
results: 10
|
||||||
|
|
Loading…
Add table
Reference in a new issue