mirror of
https://github.com/public-transport/db-vendo-client.git
synced 2025-02-23 15:19:35 +02:00
earlierJourneysRef -> earlierRef, laterJourneysRef -> laterRef
This commit is contained in:
parent
fe7822883e
commit
88c511da27
4 changed files with 20 additions and 20 deletions
4
index.js
4
index.js
|
@ -132,8 +132,8 @@ const createClient = (profile, request = _request) => {
|
||||||
const parse = profile.parseJourney(profile, d.locations, d.lines, d.remarks)
|
const parse = profile.parseJourney(profile, d.locations, d.lines, d.remarks)
|
||||||
const res = d.outConL.map(parse)
|
const res = d.outConL.map(parse)
|
||||||
|
|
||||||
if (d.outCtxScrB) res.earlierJourneysRef = d.outCtxScrB
|
if (d.outCtxScrB) res.earlierRef = d.outCtxScrB
|
||||||
if (d.outCtxScrF) res.laterJourneysRef = d.outCtxScrF
|
if (d.outCtxScrF) res.laterRef = d.outCtxScrF
|
||||||
return res
|
return res
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
12
test/db.js
12
test/db.js
|
@ -238,10 +238,10 @@ test('earlier/later journeys, Jungfernheide -> München Hbf', co(function* (t) {
|
||||||
results: 3, when
|
results: 3, when
|
||||||
})
|
})
|
||||||
|
|
||||||
t.equal(typeof model.earlierJourneysRef, 'string')
|
t.equal(typeof model.earlierRef, 'string')
|
||||||
t.ok(model.earlierJourneysRef)
|
t.ok(model.earlierRef)
|
||||||
t.equal(typeof model.laterJourneysRef, 'string')
|
t.equal(typeof model.laterRef, 'string')
|
||||||
t.ok(model.laterJourneysRef)
|
t.ok(model.laterRef)
|
||||||
|
|
||||||
let earliestDep = Infinity, latestDep = -Infinity
|
let earliestDep = Infinity, latestDep = -Infinity
|
||||||
for (let j of model) {
|
for (let j of model) {
|
||||||
|
@ -253,7 +253,7 @@ test('earlier/later journeys, Jungfernheide -> München Hbf', co(function* (t) {
|
||||||
const earlier = yield client.journeys(jungfernh, münchenHbf, {
|
const earlier = yield client.journeys(jungfernh, münchenHbf, {
|
||||||
results: 3,
|
results: 3,
|
||||||
// todo: single journey ref?
|
// todo: single journey ref?
|
||||||
beforeJourneys: model.earlierJourneysRef
|
beforeJourneys: model.earlierRef
|
||||||
})
|
})
|
||||||
for (let j of earlier) {
|
for (let j of earlier) {
|
||||||
t.ok(new Date(j.departure) < earliestDep)
|
t.ok(new Date(j.departure) < earliestDep)
|
||||||
|
@ -262,7 +262,7 @@ test('earlier/later journeys, Jungfernheide -> München Hbf', co(function* (t) {
|
||||||
const later = yield client.journeys(jungfernh, münchenHbf, {
|
const later = yield client.journeys(jungfernh, münchenHbf, {
|
||||||
results: 3,
|
results: 3,
|
||||||
// todo: single journey ref?
|
// todo: single journey ref?
|
||||||
afterJourneys: model.laterJourneysRef
|
afterJourneys: model.laterRef
|
||||||
})
|
})
|
||||||
for (let j of later) {
|
for (let j of later) {
|
||||||
t.ok(new Date(j.departure) > latestDep)
|
t.ok(new Date(j.departure) > latestDep)
|
||||||
|
|
12
test/oebb.js
12
test/oebb.js
|
@ -279,10 +279,10 @@ test('earlier/later journeys, Salzburg Hbf -> Wien Westbahnhof', co(function* (t
|
||||||
results: 3, when
|
results: 3, when
|
||||||
})
|
})
|
||||||
|
|
||||||
t.equal(typeof model.earlierJourneysRef, 'string')
|
t.equal(typeof model.earlierRef, 'string')
|
||||||
t.ok(model.earlierJourneysRef)
|
t.ok(model.earlierRef)
|
||||||
t.equal(typeof model.laterJourneysRef, 'string')
|
t.equal(typeof model.laterRef, 'string')
|
||||||
t.ok(model.laterJourneysRef)
|
t.ok(model.laterRef)
|
||||||
|
|
||||||
let earliestDep = Infinity, latestDep = -Infinity
|
let earliestDep = Infinity, latestDep = -Infinity
|
||||||
for (let j of model) {
|
for (let j of model) {
|
||||||
|
@ -294,7 +294,7 @@ test('earlier/later journeys, Salzburg Hbf -> Wien Westbahnhof', co(function* (t
|
||||||
const earlier = yield client.journeys(salzburgHbf, wienWestbahnhof, {
|
const earlier = yield client.journeys(salzburgHbf, wienWestbahnhof, {
|
||||||
results: 3,
|
results: 3,
|
||||||
// todo: single journey ref?
|
// todo: single journey ref?
|
||||||
beforeJourneys: model.earlierJourneysRef
|
beforeJourneys: model.earlierRef
|
||||||
})
|
})
|
||||||
for (let j of earlier) {
|
for (let j of earlier) {
|
||||||
t.ok(new Date(j.departure) < earliestDep)
|
t.ok(new Date(j.departure) < earliestDep)
|
||||||
|
@ -303,7 +303,7 @@ test('earlier/later journeys, Salzburg Hbf -> Wien Westbahnhof', co(function* (t
|
||||||
const later = yield client.journeys(salzburgHbf, wienWestbahnhof, {
|
const later = yield client.journeys(salzburgHbf, wienWestbahnhof, {
|
||||||
results: 3,
|
results: 3,
|
||||||
// todo: single journey ref?
|
// todo: single journey ref?
|
||||||
afterJourneys: model.laterJourneysRef
|
afterJourneys: model.laterRef
|
||||||
})
|
})
|
||||||
for (let j of later) {
|
for (let j of later) {
|
||||||
t.ok(new Date(j.departure) > latestDep)
|
t.ok(new Date(j.departure) > latestDep)
|
||||||
|
|
12
test/vbb.js
12
test/vbb.js
|
@ -173,10 +173,10 @@ test('earlier/later journeys', co(function* (t) {
|
||||||
results: 3, when
|
results: 3, when
|
||||||
})
|
})
|
||||||
|
|
||||||
t.equal(typeof model.earlierJourneysRef, 'string')
|
t.equal(typeof model.earlierRef, 'string')
|
||||||
t.ok(model.earlierJourneysRef)
|
t.ok(model.earlierRef)
|
||||||
t.equal(typeof model.laterJourneysRef, 'string')
|
t.equal(typeof model.laterRef, 'string')
|
||||||
t.ok(model.laterJourneysRef)
|
t.ok(model.laterRef)
|
||||||
|
|
||||||
let earliestDep = Infinity, latestDep = -Infinity
|
let earliestDep = Infinity, latestDep = -Infinity
|
||||||
for (let j of model) {
|
for (let j of model) {
|
||||||
|
@ -188,7 +188,7 @@ test('earlier/later journeys', co(function* (t) {
|
||||||
const earlier = yield client.journeys(spichernstr, bismarckstr, {
|
const earlier = yield client.journeys(spichernstr, bismarckstr, {
|
||||||
results: 3,
|
results: 3,
|
||||||
// todo: single journey ref?
|
// todo: single journey ref?
|
||||||
beforeJourneys: model.earlierJourneysRef
|
beforeJourneys: model.earlierRef
|
||||||
})
|
})
|
||||||
for (let j of earlier) {
|
for (let j of earlier) {
|
||||||
t.ok(new Date(j.departure) < earliestDep)
|
t.ok(new Date(j.departure) < earliestDep)
|
||||||
|
@ -197,7 +197,7 @@ test('earlier/later journeys', co(function* (t) {
|
||||||
const later = yield client.journeys(spichernstr, bismarckstr, {
|
const later = yield client.journeys(spichernstr, bismarckstr, {
|
||||||
results: 3,
|
results: 3,
|
||||||
// todo: single journey ref?
|
// todo: single journey ref?
|
||||||
afterJourneys: model.laterJourneysRef
|
afterJourneys: model.laterRef
|
||||||
})
|
})
|
||||||
for (let j of later) {
|
for (let j of later) {
|
||||||
t.ok(new Date(j.departure) > latestDep)
|
t.ok(new Date(j.departure) > latestDep)
|
||||||
|
|
Loading…
Add table
Reference in a new issue