diff --git a/index.js b/index.js index a5d2560e..21826517 100644 --- a/index.js +++ b/index.js @@ -132,8 +132,8 @@ const createClient = (profile, request = _request) => { const parse = profile.parseJourney(profile, d.locations, d.lines, d.remarks) const res = d.outConL.map(parse) - if (d.outCtxScrB) res.earlierJourneysRef = d.outCtxScrB - if (d.outCtxScrF) res.laterJourneysRef = d.outCtxScrF + if (d.outCtxScrB) res.earlierRef = d.outCtxScrB + if (d.outCtxScrF) res.laterRef = d.outCtxScrF return res }) } diff --git a/test/db.js b/test/db.js index afb5d797..56ff0ce2 100644 --- a/test/db.js +++ b/test/db.js @@ -238,10 +238,10 @@ test('earlier/later journeys, Jungfernheide -> München Hbf', co(function* (t) { results: 3, when }) - t.equal(typeof model.earlierJourneysRef, 'string') - t.ok(model.earlierJourneysRef) - t.equal(typeof model.laterJourneysRef, 'string') - t.ok(model.laterJourneysRef) + t.equal(typeof model.earlierRef, 'string') + t.ok(model.earlierRef) + t.equal(typeof model.laterRef, 'string') + t.ok(model.laterRef) let earliestDep = Infinity, latestDep = -Infinity 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, { results: 3, // todo: single journey ref? - beforeJourneys: model.earlierJourneysRef + beforeJourneys: model.earlierRef }) for (let j of earlier) { 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, { results: 3, // todo: single journey ref? - afterJourneys: model.laterJourneysRef + afterJourneys: model.laterRef }) for (let j of later) { t.ok(new Date(j.departure) > latestDep) diff --git a/test/oebb.js b/test/oebb.js index 2feaf8eb..eb7bd7ec 100644 --- a/test/oebb.js +++ b/test/oebb.js @@ -279,10 +279,10 @@ test('earlier/later journeys, Salzburg Hbf -> Wien Westbahnhof', co(function* (t results: 3, when }) - t.equal(typeof model.earlierJourneysRef, 'string') - t.ok(model.earlierJourneysRef) - t.equal(typeof model.laterJourneysRef, 'string') - t.ok(model.laterJourneysRef) + t.equal(typeof model.earlierRef, 'string') + t.ok(model.earlierRef) + t.equal(typeof model.laterRef, 'string') + t.ok(model.laterRef) let earliestDep = Infinity, latestDep = -Infinity 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, { results: 3, // todo: single journey ref? - beforeJourneys: model.earlierJourneysRef + beforeJourneys: model.earlierRef }) for (let j of earlier) { 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, { results: 3, // todo: single journey ref? - afterJourneys: model.laterJourneysRef + afterJourneys: model.laterRef }) for (let j of later) { t.ok(new Date(j.departure) > latestDep) diff --git a/test/vbb.js b/test/vbb.js index 3c8dd45f..908ae980 100644 --- a/test/vbb.js +++ b/test/vbb.js @@ -173,10 +173,10 @@ test('earlier/later journeys', co(function* (t) { results: 3, when }) - t.equal(typeof model.earlierJourneysRef, 'string') - t.ok(model.earlierJourneysRef) - t.equal(typeof model.laterJourneysRef, 'string') - t.ok(model.laterJourneysRef) + t.equal(typeof model.earlierRef, 'string') + t.ok(model.earlierRef) + t.equal(typeof model.laterRef, 'string') + t.ok(model.laterRef) let earliestDep = Infinity, latestDep = -Infinity for (let j of model) { @@ -188,7 +188,7 @@ test('earlier/later journeys', co(function* (t) { const earlier = yield client.journeys(spichernstr, bismarckstr, { results: 3, // todo: single journey ref? - beforeJourneys: model.earlierJourneysRef + beforeJourneys: model.earlierRef }) for (let j of earlier) { 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, { results: 3, // todo: single journey ref? - afterJourneys: model.laterJourneysRef + afterJourneys: model.laterRef }) for (let j of later) { t.ok(new Date(j.departure) > latestDep)