From 1afe4caf411af2b7b9a1a1afc53580bf58f5ec6f Mon Sep 17 00:00:00 2001 From: Jannis R Date: Sun, 28 Oct 2018 17:55:52 +0100 Subject: [PATCH] =?UTF-8?q?BVG:=20test=20for=20BerlK=C3=B6nig=20:white=5Fc?= =?UTF-8?q?heck=5Fmark:?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- test/bvg.js | 36 ++++++++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) diff --git a/test/bvg.js b/test/bvg.js index af745a4c..c359f8fb 100644 --- a/test/bvg.js +++ b/test/bvg.js @@ -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') @@ -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,