diff --git a/test/e2e/bls.js b/test/e2e/bls.js index f0be4026..4b473e09 100644 --- a/test/e2e/bls.js +++ b/test/e2e/bls.js @@ -8,7 +8,8 @@ const blsProfile = require('../../p/bls') const createValidate = require('./lib/validate-fptf-with') const testJourneysStationToAddress = require('./lib/journeys-station-to-address') -const when = createWhen(blsProfile.timezone, blsProfile.locale) +const T_MOCK = 1641897000 * 1000 // 2022-01-11T11:30:00+01 +const when = createWhen(blsProfile.timezone, blsProfile.locale, T_MOCK) const cfg = { when, diff --git a/test/e2e/cfl.js b/test/e2e/cfl.js index 86a9ba5f..3e4a55fb 100644 --- a/test/e2e/cfl.js +++ b/test/e2e/cfl.js @@ -22,7 +22,8 @@ const journeysFailsWithNoProduct = require('./lib/journeys-fails-with-no-product const testDepartures = require('./lib/departures') const testArrivals = require('./lib/arrivals') -const when = createWhen('Europe/Berlin', 'de-DE') +const T_MOCK = 1641897000 * 1000 // 2022-01-11T11:30:00+01 +const when = createWhen(cflProfile.timezone, cflProfile.locale, T_MOCK) const cfg = { when, diff --git a/test/e2e/cmta.js b/test/e2e/cmta.js index 18aab262..8606bef2 100644 --- a/test/e2e/cmta.js +++ b/test/e2e/cmta.js @@ -18,7 +18,8 @@ const testArrivals = require('./lib/arrivals') const testJourneysWithDetour = require('./lib/journeys-with-detour') const testReachableFrom = require('./lib/reachable-from') -const when = createWhen(cmtaProfile.timezone, cmtaProfile.locale) +const T_MOCK = 1641897000 * 1000 // 2022-01-11T11:30:00+01 +const when = createWhen(cmtaProfile.timezone, cmtaProfile.locale, T_MOCK) const cfg = { when, diff --git a/test/e2e/dart.js b/test/e2e/dart.js index 34fc9fe5..8c2f3a1c 100644 --- a/test/e2e/dart.js +++ b/test/e2e/dart.js @@ -7,7 +7,9 @@ const createClient = require('../..') const dartProfile = require('../../p/dart') const createValidate = require('./lib/validate-fptf-with') -const when = createWhen(dartProfile.timezone, dartProfile.locale) +const T_MOCK = 1641897000 * 1000 // 2022-01-11T11:30:00+01 +const when = createWhen(dartProfile.timezone, dartProfile.locale, T_MOCK) + const cfg = { when, stationCoordsOptional: false, diff --git a/test/e2e/db-busradar-nrw.js b/test/e2e/db-busradar-nrw.js index 008f40d0..786f9994 100644 --- a/test/e2e/db-busradar-nrw.js +++ b/test/e2e/db-busradar-nrw.js @@ -12,7 +12,8 @@ const testArrivals = require('./lib/arrivals') const isObj = o => o !== null && 'object' === typeof o && !Array.isArray(o) -const when = createWhen('Europe/Berlin', 'de-DE') +const T_MOCK = 1641897000 * 1000 // 2022-01-11T11:30:00+01 +const when = createWhen(dbBusradarNrwProfile.timezone, dbBusradarNrwProfile.locale, T_MOCK) const cfg = { when, diff --git a/test/e2e/db.js b/test/e2e/db.js index 05ea8593..aa35a89d 100644 --- a/test/e2e/db.js +++ b/test/e2e/db.js @@ -31,7 +31,8 @@ const testServerInfo = require('./lib/server-info') const isObj = o => o !== null && 'object' === typeof o && !Array.isArray(o) const minute = 60 * 1000 -const when = createWhen('Europe/Berlin', 'de-DE') +const T_MOCK = 1641897000 * 1000 // 2022-01-11T11:30:00+01 +const when = createWhen(dbProfile.timezone, dbProfile.locale, T_MOCK) const cfg = { when, diff --git a/test/e2e/hvv.js b/test/e2e/hvv.js index bb4dbf41..866f89fd 100644 --- a/test/e2e/hvv.js +++ b/test/e2e/hvv.js @@ -17,7 +17,8 @@ const testDepartures = require('./lib/departures') const testDeparturesInDirection = require('./lib/departures-in-direction') const testArrivals = require('./lib/arrivals') -const when = createWhen('Europe/Berlin', 'de-DE') +const T_MOCK = 1641897000 * 1000 // 2022-01-11T11:30:00+01 +const when = createWhen(hvvProfile.timezone, hvvProfile.locale, T_MOCK) const cfg = { when, diff --git a/test/e2e/insa.js b/test/e2e/insa.js index d2f4a883..7a6129e4 100644 --- a/test/e2e/insa.js +++ b/test/e2e/insa.js @@ -24,7 +24,8 @@ const testJourneysWithDetour = require('./lib/journeys-with-detour') const isObj = o => o !== null && 'object' === typeof o && !Array.isArray(o) -const when = createWhen('Europe/Berlin', 'de-DE') +const T_MOCK = 1641897000 * 1000 // 2022-01-11T11:30:00+01 +const when = createWhen(insaProfile.timezone, insaProfile.locale, T_MOCK) const cfg = { when, diff --git a/test/e2e/invg.js b/test/e2e/invg.js index 3f8ad045..08b09ab3 100644 --- a/test/e2e/invg.js +++ b/test/e2e/invg.js @@ -20,7 +20,9 @@ const testRefreshJourney = require('./lib/refresh-journey') const journeysFailsWithNoProduct = require('./lib/journeys-fails-with-no-product') const testArrivals = require('./lib/arrivals') -const when = createWhen('Europe/Berlin', 'de-DE') +const T_MOCK = 1641897000 * 1000 // 2022-01-11T11:30:00+01 +const when = createWhen(invgProfile.timezone, invgProfile.locale, T_MOCK) + const cfg = {when, products} const _validateJourneyLeg = createValidateJourneyLeg(cfg) diff --git a/test/e2e/ivb.js b/test/e2e/ivb.js index bac80418..629a9642 100644 --- a/test/e2e/ivb.js +++ b/test/e2e/ivb.js @@ -7,7 +7,9 @@ const createClient = require('../..') const ivbProfile = require('../../p/ivb') const createValidate = require('./lib/validate-fptf-with') -const when = createWhen(ivbProfile.timezone, ivbProfile.locale) +const T_MOCK = 1641897000 * 1000 // 2022-01-11T11:30:00+01 +const when = createWhen(ivbProfile.timezone, ivbProfile.locale, T_MOCK) + const cfg = { when, stationCoordsOptional: false, diff --git a/test/e2e/kvb.js b/test/e2e/kvb.js index 625afadb..ba60ae54 100644 --- a/test/e2e/kvb.js +++ b/test/e2e/kvb.js @@ -7,7 +7,9 @@ const createClient = require('../..') const kvbProfile = require('../../p/kvb') const createValidate = require('./lib/validate-fptf-with') -const when = createWhen(kvbProfile.timezone, kvbProfile.locale) +const T_MOCK = 1641897000 * 1000 // 2022-01-11T11:30:00+01 +const when = createWhen(kvbProfile.timezone, kvbProfile.locale, T_MOCK) + const cfg = { when, stationCoordsOptional: false, diff --git a/test/e2e/lib/util.js b/test/e2e/lib/util.js index e235c900..25654c2d 100644 --- a/test/e2e/lib/util.js +++ b/test/e2e/lib/util.js @@ -1,7 +1,7 @@ 'use strict' const isRoughlyEqual = require('is-roughly-equal') -const {AssertionError} = require('assert') +const {ok, AssertionError} = require('assert') const {DateTime} = require('luxon') const a = require('assert') const {join} = require('path') @@ -10,12 +10,12 @@ const hour = 60 * 60 * 1000 const day = 24 * hour const week = 7 * day -const T_MOCK = 1641897000 * 1000 // 2022-01-11T11:30:00+01 - // next Monday 10 am -const createWhen = (timezone, locale) => { +const createWhen = (timezone, locale, tMock) => { + ok(Number.isInteger(tMock), 'tMock must be an integer') + const t = process.env.VCR_MODE && !process.env.VCR_OFF - ? T_MOCK + ? tMock : Date.now() return DateTime.fromMillis(t, { zone: timezone, diff --git a/test/e2e/lib/vbb-bvg-validators.js b/test/e2e/lib/vbb-bvg-validators.js index 049bea93..197d5b36 100644 --- a/test/e2e/lib/vbb-bvg-validators.js +++ b/test/e2e/lib/vbb-bvg-validators.js @@ -12,7 +12,8 @@ const { movement: createValidateMovement } = require('./validators') -const when = createWhen('Europe/Berlin', 'de-DE') +const T_MOCK = 1641897000 * 1000 // 2022-01-11T11:30:00+01 +const when = createWhen('Europe/Berlin', 'de-DE', T_MOCK) const cfg = { when, diff --git a/test/e2e/mobil-nrw.js b/test/e2e/mobil-nrw.js index a7538a0c..b3b5e41c 100644 --- a/test/e2e/mobil-nrw.js +++ b/test/e2e/mobil-nrw.js @@ -16,7 +16,8 @@ const testDepartures = require('./lib/departures') const testArrivals = require('./lib/arrivals') const testReachableFrom = require('./lib/reachable-from') -const when = createWhen(mobilNrwProfile.timezone, mobilNrwProfile.locale) +const T_MOCK = 1641897000 * 1000 // 2022-01-11T11:30:00+01 +const when = createWhen(mobilNrwProfile.timezone, mobilNrwProfile.locale, T_MOCK) const cfg = { when, diff --git a/test/e2e/mobiliteit-lu.js b/test/e2e/mobiliteit-lu.js index 665b6b19..1a4cd2ca 100644 --- a/test/e2e/mobiliteit-lu.js +++ b/test/e2e/mobiliteit-lu.js @@ -22,7 +22,8 @@ const journeysFailsWithNoProduct = require('./lib/journeys-fails-with-no-product const testDepartures = require('./lib/departures') const testArrivals = require('./lib/arrivals') -const when = createWhen('Europe/Berlin', 'de-DE') +const T_MOCK = 1641897000 * 1000 // 2022-01-11T11:30:00+01 +const when = createWhen(mobiliteitLuProfile.timezone, mobiliteitLuProfile.locale, T_MOCK) const cfg = { when, diff --git a/test/e2e/nahsh.js b/test/e2e/nahsh.js index f4f6aac3..81a4281d 100644 --- a/test/e2e/nahsh.js +++ b/test/e2e/nahsh.js @@ -23,7 +23,8 @@ const testDeparturesInDirection = require('./lib/departures-in-direction') const testArrivals = require('./lib/arrivals') const testReachableFrom = require('./lib/reachable-from') -const when = createWhen('Europe/Berlin', 'de-DE') +const T_MOCK = 1641897000 * 1000 // 2022-01-11T11:30:00+01 +const when = createWhen(nahshProfile.timezone, nahshProfile.locale, T_MOCK) const cfg = { when, diff --git a/test/e2e/nvv.js b/test/e2e/nvv.js index 5b938358..c786600b 100644 --- a/test/e2e/nvv.js +++ b/test/e2e/nvv.js @@ -20,7 +20,9 @@ const testJourneysWithDetour = require('./lib/journeys-with-detour') const isObj = o => o !== null && 'object' === typeof o && !Array.isArray(o) -const when = createWhen('Europe/Berlin', 'de-DE') +const T_MOCK = 1641897000 * 1000 // 2022-01-11T11:30:00+01 +const when = createWhen(nvvProfile.timezone, nvvProfile.locale, T_MOCK) + const cfg = { when, stationCoordsOptional: false, diff --git a/test/e2e/oebb.js b/test/e2e/oebb.js index 925a587a..538950bb 100644 --- a/test/e2e/oebb.js +++ b/test/e2e/oebb.js @@ -22,7 +22,8 @@ const journeysFailsWithNoProduct = require('./lib/journeys-fails-with-no-product const testJourneysWithDetour = require('./lib/journeys-with-detour') const testDeparturesInDirection = require('./lib/departures-in-direction') -const when = createWhen('Europe/Vienna', 'de-AT') +const T_MOCK = 1641897000 * 1000 // 2022-01-11T11:30:00+01 +const when = createWhen(oebbProfile.timezone, oebbProfile.locale, T_MOCK) const cfg = { when, diff --git a/test/e2e/ooevv.js b/test/e2e/ooevv.js index aa8d4338..5b38f467 100644 --- a/test/e2e/ooevv.js +++ b/test/e2e/ooevv.js @@ -7,7 +7,9 @@ const createClient = require('../..') const oövvProfile = require('../../p/ooevv') const createValidate = require('./lib/validate-fptf-with') -const when = createWhen(oövvProfile.timezone, oövvProfile.locale) +const T_MOCK = 1641897000 * 1000 // 2022-01-11T11:30:00+01 +const when = createWhen(oövvProfile.timezone, oövvProfile.locale, T_MOCK) + const cfg = { when, stationCoordsOptional: false, diff --git a/test/e2e/pkp.js b/test/e2e/pkp.js index 94916a61..94204e50 100644 --- a/test/e2e/pkp.js +++ b/test/e2e/pkp.js @@ -16,7 +16,8 @@ const testJourneysStationToStation = require('./lib/journeys-station-to-station' const testArrivals = require('./lib/arrivals') const testReachableFrom = require('./lib/reachable-from') -const when = createWhen(pkpProfile.timezone, pkpProfile.locale) +const T_MOCK = 1641897000 * 1000 // 2022-01-11T11:30:00+01 +const when = createWhen(pkpProfile.timezone, pkpProfile.locale, T_MOCK) const cfg = { when, diff --git a/test/e2e/rejseplanen.js b/test/e2e/rejseplanen.js index 16930af0..f4e99c70 100644 --- a/test/e2e/rejseplanen.js +++ b/test/e2e/rejseplanen.js @@ -15,7 +15,8 @@ const testEarlierLaterJourneys = require('./lib/earlier-later-journeys') const testDepartures = require('./lib/departures') const testArrivals = require('./lib/arrivals') -const when = createWhen('Europe/Berlin', 'de-DE') +const T_MOCK = 1641897000 * 1000 // 2022-01-11T11:30:00+01 +const when = createWhen(rejseplanenProfile.timezone, rejseplanenProfile.locale, T_MOCK) const validate = createValidate({ when, diff --git a/test/e2e/rmv.js b/test/e2e/rmv.js index e83f377e..09ef0e8c 100644 --- a/test/e2e/rmv.js +++ b/test/e2e/rmv.js @@ -12,7 +12,8 @@ const testRefreshJourney = require('./lib/refresh-journey') const testArrivals = require('./lib/arrivals') const testReachableFrom = require('./lib/reachable-from') -const when = createWhen(rmvProfile.timezone, rmvProfile.locale) +const T_MOCK = 1641897000 * 1000 // 2022-01-11T11:30:00+01 +const when = createWhen(rmvProfile.timezone, rmvProfile.locale, T_MOCK) const cfg = { when, diff --git a/test/e2e/rsag.js b/test/e2e/rsag.js index 9f830ccb..8897d847 100644 --- a/test/e2e/rsag.js +++ b/test/e2e/rsag.js @@ -13,7 +13,8 @@ const testRefreshJourney = require('./lib/refresh-journey') const testArrivals = require('./lib/arrivals') const testReachableFrom = require('./lib/reachable-from') -const when = createWhen(rsagProfile.timezone, rsagProfile.locale) +const T_MOCK = 1641897000 * 1000 // 2022-01-11T11:30:00+01 +const when = createWhen(rsagProfile.timezone, rsagProfile.locale, T_MOCK) const cfg = { when, diff --git a/test/e2e/saarfahrplan.js b/test/e2e/saarfahrplan.js index ee247383..f36283a6 100644 --- a/test/e2e/saarfahrplan.js +++ b/test/e2e/saarfahrplan.js @@ -22,7 +22,8 @@ const testJourneysWithDetour = require('./lib/journeys-with-detour') const testDepartures = require('./lib/departures') const testDeparturesInDirection = require('./lib/departures-in-direction') -const when = createWhen('Europe/Berlin', 'de-DE') +const T_MOCK = 1641897000 * 1000 // 2022-01-11T11:30:00+01 +const when = createWhen(saarfahrplanProfile.timezone, saarfahrplanProfile.locale, T_MOCK) const cfg = { when, diff --git a/test/e2e/salzburg.js b/test/e2e/salzburg.js index 1e90546b..2ddc28de 100644 --- a/test/e2e/salzburg.js +++ b/test/e2e/salzburg.js @@ -7,7 +7,9 @@ const createClient = require('../..') const salzburgProfile = require('../../p/salzburg') const createValidate = require('./lib/validate-fptf-with') -const when = createWhen(salzburgProfile.timezone, salzburgProfile.locale) +const T_MOCK = 1641897000 * 1000 // 2022-01-11T11:30:00+01 +const when = createWhen(salzburgProfile.timezone, salzburgProfile.locale, T_MOCK) + const cfg = { when, stationCoordsOptional: false, diff --git a/test/e2e/sbahn-muenchen.js b/test/e2e/sbahn-muenchen.js index ce74112e..cb9b451d 100644 --- a/test/e2e/sbahn-muenchen.js +++ b/test/e2e/sbahn-muenchen.js @@ -19,7 +19,8 @@ const testArrivals = require('./lib/arrivals') const testJourneysWithDetour = require('./lib/journeys-with-detour') const testReachableFrom = require('./lib/reachable-from') -const when = createWhen(sMunichProfile.timezone, sMunichProfile.locale) +const T_MOCK = 1641897000 * 1000 // 2022-01-11T11:30:00+01 +const when = createWhen(sMunichProfile.timezone, sMunichProfile.locale, T_MOCK) const cfg = { when, diff --git a/test/e2e/sncb.js b/test/e2e/sncb.js index cabcf7d0..b9080d52 100644 --- a/test/e2e/sncb.js +++ b/test/e2e/sncb.js @@ -12,7 +12,8 @@ const testRefreshJourney = require('./lib/refresh-journey') const testArrivals = require('./lib/arrivals') const testReachableFrom = require('./lib/reachable-from') -const when = createWhen(sncbProfile.timezone, sncbProfile.locale) +const T_MOCK = 1641897000 * 1000 // 2022-01-11T11:30:00+01 +const when = createWhen(sncbProfile.timezone, sncbProfile.locale, T_MOCK) const cfg = { when, diff --git a/test/e2e/stv.js b/test/e2e/stv.js index 40131607..435036f2 100644 --- a/test/e2e/stv.js +++ b/test/e2e/stv.js @@ -7,7 +7,9 @@ const createClient = require('../..') const stvProfile = require('../../p/stv') const createValidate = require('./lib/validate-fptf-with') -const when = createWhen(stvProfile.timezone, stvProfile.locale) +const T_MOCK = 1641897000 * 1000 // 2022-01-11T11:30:00+01 +const when = createWhen(stvProfile.timezone, stvProfile.locale, T_MOCK) + const cfg = { when, stationCoordsOptional: false, diff --git a/test/e2e/svv.js b/test/e2e/svv.js index da0eddf3..7d58d60f 100644 --- a/test/e2e/svv.js +++ b/test/e2e/svv.js @@ -13,7 +13,8 @@ const testArrivals = require('./lib/arrivals') const testReachableFrom = require('./lib/reachable-from') const testServerInfo = require('./lib/server-info') -const when = createWhen(svvProfile.timezone, svvProfile.locale) +const T_MOCK = 1641897000 * 1000 // 2022-01-11T11:30:00+01 +const when = createWhen(svvProfile.timezone, svvProfile.locale, T_MOCK) const cfg = { when, diff --git a/test/e2e/tpg.js b/test/e2e/tpg.js index fba52a75..00ee4323 100644 --- a/test/e2e/tpg.js +++ b/test/e2e/tpg.js @@ -8,7 +8,8 @@ const tpgProfile = require('../../p/tpg') const createValidate = require('./lib/validate-fptf-with') const testJourneysStationToAddress = require('./lib/journeys-station-to-address') -const when = createWhen(tpgProfile.timezone, tpgProfile.locale) +const T_MOCK = 1641897000 * 1000 // 2022-01-11T11:30:00+01 +const when = createWhen(tpgProfile.timezone, tpgProfile.locale, T_MOCK) const cfg = { when, diff --git a/test/e2e/vbn.js b/test/e2e/vbn.js index 09d59f5b..e47441e9 100644 --- a/test/e2e/vbn.js +++ b/test/e2e/vbn.js @@ -11,7 +11,8 @@ const testJourneysStationToStation = require('./lib/journeys-station-to-station' const testArrivals = require('./lib/arrivals') const testReachableFrom = require('./lib/reachable-from') -const when = createWhen(vbnProfile.timezone, vbnProfile.locale) +const T_MOCK = 1641897000 * 1000 // 2022-01-11T11:30:00+01 +const when = createWhen(vbnProfile.timezone, vbnProfile.locale, T_MOCK) const cfg = { when, diff --git a/test/e2e/vor.js b/test/e2e/vor.js index 346f052a..93faf003 100644 --- a/test/e2e/vor.js +++ b/test/e2e/vor.js @@ -7,7 +7,9 @@ const createClient = require('../..') const vorProfile = require('../../p/vor') const createValidate = require('./lib/validate-fptf-with') -const when = createWhen(vorProfile.timezone, vorProfile.locale) +const T_MOCK = 1641897000 * 1000 // 2022-01-11T11:30:00+01 +const when = createWhen(vorProfile.timezone, vorProfile.locale, T_MOCK) + const cfg = { when, stationCoordsOptional: false, diff --git a/test/e2e/vrn.js b/test/e2e/vrn.js index 663283ae..0a4084e1 100644 --- a/test/e2e/vrn.js +++ b/test/e2e/vrn.js @@ -17,7 +17,8 @@ const testDepartures = require('./lib/departures') const testDeparturesInDirection = require('./lib/departures-in-direction') const testArrivals = require('./lib/arrivals') -const when = createWhen('Europe/Berlin', 'de-DE') +const T_MOCK = 1641897000 * 1000 // 2022-01-11T11:30:00+01 +const when = createWhen(vrnProfile.timezone, vrnProfile.locale, T_MOCK) const cfg = { when, diff --git a/test/e2e/vsn.js b/test/e2e/vsn.js index fd9c9256..ad23a4bf 100644 --- a/test/e2e/vsn.js +++ b/test/e2e/vsn.js @@ -15,7 +15,8 @@ const testEarlierLaterJourneys = require('./lib/earlier-later-journeys') const testDepartures = require('./lib/departures') const testArrivals = require('./lib/arrivals') -const when = createWhen('Europe/Berlin', 'de-DE') +const T_MOCK = 1641897000 * 1000 // 2022-01-11T11:30:00+01 +const when = createWhen(vsnProfile.timezone, vsnProfile.locale, T_MOCK) const cfg = { when, diff --git a/test/e2e/vvv.js b/test/e2e/vvv.js index eac982c9..08e77f20 100644 --- a/test/e2e/vvv.js +++ b/test/e2e/vvv.js @@ -7,7 +7,9 @@ const createClient = require('../..') const vvvProfile = require('../../p/vvv') const createValidate = require('./lib/validate-fptf-with') -const when = createWhen(vvvProfile.timezone, vvvProfile.locale) +const T_MOCK = 1641897000 * 1000 // 2022-01-11T11:30:00+01 +const when = createWhen(vvvProfile.timezone, vvvProfile.locale, T_MOCK) + const cfg = { when, stationCoordsOptional: false, diff --git a/test/e2e/zvv.js b/test/e2e/zvv.js index 25adb8b0..5c55ba2b 100644 --- a/test/e2e/zvv.js +++ b/test/e2e/zvv.js @@ -17,7 +17,8 @@ const testDepartures = require('./lib/departures') const testDeparturesInDirection = require('./lib/departures-in-direction') const testArrivals = require('./lib/arrivals') -const when = createWhen('Europe/Zurich', 'de-CH') +const T_MOCK = 1641897000 * 1000 // 2022-01-11T11:30:00+01 +const when = createWhen(zvvProfile.timezone, zvvProfile.locale, T_MOCK) const validate = createValidate({ when,