diff --git a/test/e2e/cfl.js b/test/e2e/cfl.js index 06766b3d..ef7bf0fe 100644 --- a/test/e2e/cfl.js +++ b/test/e2e/cfl.js @@ -159,7 +159,8 @@ test('earlier/later journeys', async (t) => { fetchJourneys: client.journeys, validate, fromId: luxembourg, - toId: ettelbruck + toId: ettelbruck, + when, }) t.end() diff --git a/test/e2e/db-busradar-nrw.js b/test/e2e/db-busradar-nrw.js index cb6b48a9..c5bac552 100644 --- a/test/e2e/db-busradar-nrw.js +++ b/test/e2e/db-busradar-nrw.js @@ -49,7 +49,7 @@ test('departures at Hagen Bauhaus', async (t) => { test('trip details', async (t) => { const deps = await client.departures(hagenBauhaus, { - results: 1, duration: 120, departure: when + results: 1, duration: 120, when }) const p = deps[0] || {} diff --git a/test/e2e/db.js b/test/e2e/db.js index fdebe7e3..9b9390f4 100644 --- a/test/e2e/db.js +++ b/test/e2e/db.js @@ -407,6 +407,7 @@ test('stop', async (t) => { test('line with additionalName', async (t) => { const departures = await client.departures(potsdamHbf, { + when, duration: 12 * 60, // 12 minutes products: {bus: false, suburban: false, tram: false} }) diff --git a/test/e2e/invg.js b/test/e2e/invg.js index d848ce58..fcc1251d 100644 --- a/test/e2e/invg.js +++ b/test/e2e/invg.js @@ -136,7 +136,8 @@ test('earlier/later journeys', async (t) => { fetchJourneys: client.journeys, validate, fromId: ingolstadtHbf, - toId: telemannstr + toId: telemannstr, + when, }) t.end() diff --git a/test/e2e/lib/journeys-walking-speed.js b/test/e2e/lib/journeys-walking-speed.js index 62e57c4f..9b7210a1 100644 --- a/test/e2e/lib/journeys-walking-speed.js +++ b/test/e2e/lib/journeys-walking-speed.js @@ -3,15 +3,17 @@ const isRoughlyEqual = require('is-roughly-equal') const testJourneysWalkingSpeed = async (cfg) => { - const {test: t, journeys, validate, from, to, products, minTimeDifference} = cfg + const {test: t, journeys, validate, from, to, when, products, minTimeDifference} = cfg const {journeys: [journeyWithFastWalking]} = await journeys(from, to, { + departure: when, results: 1, products, walkingSpeed: 'fast' }) const legWithFastWalking = journeyWithFastWalking.legs.find(l => l.walking) t.ok(legWithFastWalking, 'no walking leg in journey with fast walking') const {journeys: [journeyWithSlowWalking]} = await journeys(from, to, { + departure: when, results: 1, products, walkingSpeed: 'slow' }) const legWithSlowWalking = journeyWithSlowWalking.legs.find(l => l.walking) diff --git a/test/e2e/lib/util.js b/test/e2e/lib/util.js index 836e73bd..3050563f 100644 --- a/test/e2e/lib/util.js +++ b/test/e2e/lib/util.js @@ -10,9 +10,14 @@ const hour = 60 * 60 * 1000 const day = 24 * hour const week = 7 * day +const T_MOCK = 1592225430 * 1000 + // next Monday 10 am const createWhen = (timezone, locale) => { - return DateTime.fromMillis(Date.now(), { + const t = process.env.VCR_MODE && !process.env.VCR_OFF + ? T_MOCK + : Date.now() + return DateTime.fromMillis(t, { zone: timezone, locale, }).startOf('week').plus({weeks: 1, hours: 10}).toJSDate() diff --git a/test/e2e/vbb.js b/test/e2e/vbb.js index f28291a1..bc67ce10 100644 --- a/test/e2e/vbb.js +++ b/test/e2e/vbb.js @@ -133,6 +133,7 @@ test('journeys: walkingSpeed', async (t) => { validate, from: havelchaussee, to: wannsee, + when, products: {bus: false}, minTimeDifference: 5 * 60 * 1000 }) diff --git a/test/e2e/vsn.js b/test/e2e/vsn.js index afe7a611..d8ee98a2 100644 --- a/test/e2e/vsn.js +++ b/test/e2e/vsn.js @@ -78,7 +78,8 @@ test('earlier/later journeys', async (t) => { fetchJourneys: client.journeys, validate, fromId: ewaldstrasse, - toId: kornmarkt + toId: kornmarkt, + when }) t.end()