mirror of
https://github.com/public-transport/db-vendo-client.git
synced 2025-02-23 15:19:35 +02:00
BVG: test for BerlKönig ✅
This commit is contained in:
parent
a40006f5ca
commit
1afe4caf41
1 changed files with 36 additions and 0 deletions
36
test/bvg.js
36
test/bvg.js
|
@ -8,6 +8,8 @@ const shorten = require('vbb-short-station-name')
|
||||||
const tapePromise = require('tape-promise').default
|
const tapePromise = require('tape-promise').default
|
||||||
const tape = require('tape')
|
const tape = require('tape')
|
||||||
const isRoughlyEqual = require('is-roughly-equal')
|
const isRoughlyEqual = require('is-roughly-equal')
|
||||||
|
const {DateTime} = require('luxon')
|
||||||
|
const flatMap = require('lodash/flatMap')
|
||||||
|
|
||||||
const createClient = require('..')
|
const createClient = require('..')
|
||||||
const bvgProfile = require('../p/bvg')
|
const bvgProfile = require('../p/bvg')
|
||||||
|
@ -131,6 +133,40 @@ test('journeys – fails with no product', (t) => {
|
||||||
t.end()
|
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) => {
|
test('earlier/later journeys', async (t) => {
|
||||||
await testEarlierLaterJourneys({
|
await testEarlierLaterJourneys({
|
||||||
test: t,
|
test: t,
|
||||||
|
|
Loading…
Add table
Reference in a new issue