Skip to content

Commit

Permalink
BVG: test for BerlKönig ✅
Browse files Browse the repository at this point in the history
  • Loading branch information
derhuerst committed Mar 12, 2019
1 parent ae2e950 commit 04c9a71
Showing 1 changed file with 36 additions and 0 deletions.
36 changes: 36 additions & 0 deletions test/bvg.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ const shorten = require('vbb-short-station-name')
const tapePromise = require('tape-promise').default
const tape = require('tape')
const isRoughlyEqual = require('is-roughly-equal')
const {DateTime} = require('luxon')
const flatMap = require('lodash/flatMap')

const createClient = require('..')
const bvgProfile = require('../p/bvg')
Expand Down Expand Up @@ -131,6 +133,40 @@ test('journeys – fails with no product', (t) => {
t.end()
})

test('journeys – BerlKönig', async (t) => {
const when = DateTime.fromMillis(Date.now(), {
zone: 'Europe/Berlin',
locale: 'de-De',
}).startOf('day').plus({days: 1, hours: 18}).toISO()

const {journeys} = await client.journeys({
type: 'location',
address: '12101 Berlin-Tempelhof, Peter-Str.r-Weg 1',
latitude: 52.476283,
longitude: 13.384947
}, {
type: 'location',
id: '900981505',
poi: true,
name: 'Berlin, Tempelhofer Park Eingang Oderstr.',
latitude: 52.476688,
longitude: 13.41872
}, {
berlkoenig: true,
departure: when
})

const withBerlkoenig = flatMap(journeys, j => j.legs)
.find(l => l.line && l.line.product === 'berlkoenig')
t.ok(withBerlkoenig, 'journey with BerlKönig not found')

t.ok(withBerlkoenig.line)
t.equal(withBerlkoenig.line.public, true)
t.equal(withBerlkoenig.line.mode, 'taxi')
t.equal(withBerlkoenig.line.product, 'berlkoenig')
t.end()
})

test('earlier/later journeys', async (t) => {
await testEarlierLaterJourneys({
test: t,
Expand Down

0 comments on commit 04c9a71

Please sign in to comment.