diff --git a/docs/profile-boilerplate.js b/docs/profile-boilerplate.js
index 925a36fd..ffc5784a 100644
--- a/docs/profile-boilerplate.js
+++ b/docs/profile-boilerplate.js
@@ -7,7 +7,7 @@ const products = [
bitmasks: [16],
name: 'ACME Commuter Rail',
short: 'CR',
- default: true
+ default: true,
},
{
id: 'metro',
@@ -15,9 +15,9 @@ const products = [
bitmasks: [8],
name: 'Foo Bar Metro',
short: 'M',
- default: true
- }
-]
+ default: true,
+ },
+];
const transformReqBody = (body) => {
// get these from the recorded app requests
@@ -25,8 +25,8 @@ const transformReqBody = (body) => {
// body.ver = …
// body.auth = { … }
// body.lang = …
- return body
-}
+ return body;
+};
const insaProfile = {
// locale: …,
@@ -37,9 +37,9 @@ const insaProfile = {
products: products,
trip: false,
- radar: false
-}
+ radar: false,
+};
export {
insaProfile,
-}
+};
diff --git a/format/address.js b/format/address.js
index 74c73ce6..6621ff6d 100644
--- a/format/address.js
+++ b/format/address.js
@@ -1,25 +1,27 @@
-import {formatLocationIdentifier} from './location-identifier.js'
-import {formatCoord} from './coord.js'
+import {formatLocationIdentifier} from './location-identifier.js';
+import {formatCoord} from './coord.js';
const formatAddress = (a) => {
if (a.type !== 'location' || !a.latitude || !a.longitude || !a.address) {
- throw new TypeError('invalid address')
+ throw new TypeError('invalid address');
}
const data = {
A: '2', // address?
O: a.address,
X: formatCoord(a.longitude),
- Y: formatCoord(a.latitude)
+ Y: formatCoord(a.latitude),
+ };
+ if (a.id) {
+ data.L = a.id;
}
- if (a.id) data.L = a.id
return {
type: 'A', // address
name: a.address,
- lid: formatLocationIdentifier(data)
- }
-}
+ lid: formatLocationIdentifier(data),
+ };
+};
export {
formatAddress,
-}
+};
diff --git a/format/coord.js b/format/coord.js
index bc8404d6..58ce094b 100644
--- a/format/coord.js
+++ b/format/coord.js
@@ -1,5 +1,5 @@
-const formatCoord = x => Math.round(x * 1000000)
+const formatCoord = x => Math.round(x * 1000000);
export {
formatCoord,
-}
+};
diff --git a/format/date.js b/format/date.js
index 45f6faff..e4d37563 100644
--- a/format/date.js
+++ b/format/date.js
@@ -1,21 +1,24 @@
-import {DateTime, IANAZone} from 'luxon'
-import {luxonIANAZonesByProfile as timezones} from '../lib/luxon-timezones.js'
+import {DateTime, IANAZone} from 'luxon';
+import {luxonIANAZonesByProfile as timezones} from '../lib/luxon-timezones.js';
// todo: change to `(profile) => (when) => {}`
const formatDate = (profile, when) => {
- let timezone
- if (timezones.has(profile)) timezone = timezones.get(profile)
- else {
- timezone = new IANAZone(profile.timezone)
- timezones.set(profile, timezone)
+ let timezone;
+ if (timezones.has(profile)) {
+ timezone = timezones.get(profile);
+ } else {
+ timezone = new IANAZone(profile.timezone);
+ timezones.set(profile, timezone);
}
- return DateTime.fromMillis(+when, {
- locale: profile.locale,
- zone: timezone
- }).toFormat('yyyyMMdd')
-}
+ return DateTime
+ .fromMillis(Number(when), {
+ locale: profile.locale,
+ zone: timezone,
+ })
+ .toFormat('yyyyMMdd');
+};
export {
formatDate,
-}
+};
diff --git a/format/filters.js b/format/filters.js
index 92630998..3eecd8f6 100644
--- a/format/filters.js
+++ b/format/filters.js
@@ -1,12 +1,12 @@
-const bike = {type: 'BC', mode: 'INC'}
+const bike = {type: 'BC', mode: 'INC'};
const accessibility = {
none: {type: 'META', mode: 'INC', meta: 'notBarrierfree'},
partial: {type: 'META', mode: 'INC', meta: 'limitedBarrierfree'},
- complete: {type: 'META', mode: 'INC', meta: 'completeBarrierfree'}
-}
+ complete: {type: 'META', mode: 'INC', meta: 'completeBarrierfree'},
+};
export {
bike,
accessibility,
-}
+};
diff --git a/format/lines-req.js b/format/lines-req.js
index 8eab450f..6d78a93c 100644
--- a/format/lines-req.js
+++ b/format/lines-req.js
@@ -3,10 +3,10 @@ const formatLinesReq = (ctx, query) => {
meth: 'LineMatch',
req: {
input: query,
- }
- }
-}
+ },
+ };
+};
export {
formatLinesReq,
-}
+};
diff --git a/format/location-filter.js b/format/location-filter.js
index 49fdc4c1..e7bec0ba 100644
--- a/format/location-filter.js
+++ b/format/location-filter.js
@@ -1,8 +1,14 @@
const formatLocationFilter = (stops, addresses, poi) => {
- if (stops && addresses && poi) return 'ALL'
- return (stops ? 'S' : '') + (addresses ? 'A' : '') + (poi ? 'P' : '')
-}
+ if (stops && addresses && poi) {
+ return 'ALL';
+ }
+ return (
+ (stops ? 'S' : '')
+ + (addresses ? 'A' : '')
+ + (poi ? 'P' : '')
+ );
+};
export {
formatLocationFilter,
-}
+};
diff --git a/format/location-identifier.js b/format/location-identifier.js
index 15a471fc..59cb284e 100644
--- a/format/location-identifier.js
+++ b/format/location-identifier.js
@@ -1,16 +1,18 @@
-const sep = '@'
+const sep = '@';
const formatLocationIdentifier = (data) => {
- let str = ''
+ let str = '';
for (let key in data) {
- if (!Object.prototype.hasOwnProperty.call(data, key)) continue
+ if (!Object.prototype.hasOwnProperty.call(data, key)) {
+ continue;
+ }
- str += key + '=' + data[key] + sep // todo: escape, but how?
+ str += key + '=' + data[key] + sep; // todo: escape, but how?
}
- return str
-}
+ return str;
+};
export {
formatLocationIdentifier,
-}
+};
diff --git a/format/location.js b/format/location.js
index 65962e3b..28650fad 100644
--- a/format/location.js
+++ b/format/location.js
@@ -1,17 +1,25 @@
const formatLocation = (profile, l, name = 'location') => {
- if ('string' === typeof l) return profile.formatStation(l)
+ if ('string' === typeof l) {
+ return profile.formatStation(l);
+ }
if ('object' === typeof l && !Array.isArray(l)) {
if (l.type === 'station' || l.type === 'stop') {
- return profile.formatStation(l.id)
+ return profile.formatStation(l.id);
}
- if (l.poi) return profile.formatPoi(l)
- if ('string' === typeof l.address) return profile.formatAddress(l)
- if (!l.type) throw new TypeError(`missing ${name}.type`)
- throw new TypeError(`invalid ${name}.type: ${l.type}`)
+ if (l.poi) {
+ return profile.formatPoi(l);
+ }
+ if ('string' === typeof l.address) {
+ return profile.formatAddress(l);
+ }
+ if (!l.type) {
+ throw new TypeError(`missing ${name}.type`);
+ }
+ throw new TypeError(`invalid ${name}.type: ${l.type}`);
}
- throw new TypeError(name + ': valid station, address or poi required.')
-}
+ throw new TypeError(name + ': valid station, address or poi required.');
+};
export {
formatLocation,
-}
+};
diff --git a/format/locations-req.js b/format/locations-req.js
index c5192f8c..704af61d 100644
--- a/format/locations-req.js
+++ b/format/locations-req.js
@@ -1,5 +1,5 @@
const formatLocationsReq = (ctx, query) => {
- const {profile, opt} = ctx
+ const {profile, opt} = ctx;
return {
cfg: {polyEnc: 'GPA'},
@@ -7,14 +7,16 @@ const formatLocationsReq = (ctx, query) => {
req: {input: {
loc: {
type: profile.formatLocationFilter(opt.stops, opt.addresses, opt.poi),
- name: opt.fuzzy ? query + '?' : query
+ name: opt.fuzzy
+ ? query + '?'
+ : query,
},
maxLoc: opt.results,
- field: 'S' // todo: what is this?
- }}
- }
-}
+ field: 'S', // todo: what is this?
+ }},
+ };
+};
export {
formatLocationsReq,
-}
+};
diff --git a/format/nearby-req.js b/format/nearby-req.js
index 94e9b7e8..5e4f8f7e 100644
--- a/format/nearby-req.js
+++ b/format/nearby-req.js
@@ -1,5 +1,5 @@
const formatNearbyReq = (ctx, location) => {
- const {profile, opt} = ctx
+ const {profile, opt} = ctx;
return {
cfg: {polyEnc: 'GPA'},
@@ -8,21 +8,21 @@ const formatNearbyReq = (ctx, location) => {
ring: {
cCrd: {
x: profile.formatCoord(location.longitude),
- y: profile.formatCoord(location.latitude)
+ y: profile.formatCoord(location.latitude),
},
maxDist: opt.distance || -1,
- minDist: 0
+ minDist: 0,
},
locFltrL: [
profile.formatProductsFilter(ctx, opt.products || {}),
],
- getPOIs: !!opt.poi,
- getStops: !!opt.stops,
- maxLoc: opt.results
- }
- }
-}
+ getPOIs: Boolean(opt.poi),
+ getStops: Boolean(opt.stops),
+ maxLoc: opt.results,
+ },
+ };
+};
export {
formatNearbyReq,
-}
+};
diff --git a/format/poi.js b/format/poi.js
index 7e5101b6..48586494 100644
--- a/format/poi.js
+++ b/format/poi.js
@@ -1,10 +1,10 @@
-import {formatLocationIdentifier} from './location-identifier.js'
-import {formatCoord} from './coord.js'
+import {formatLocationIdentifier} from './location-identifier.js';
+import {formatCoord} from './coord.js';
const formatPoi = (p) => {
// todo: use Number.isFinite()!
if (p.type !== 'location' || !p.latitude || !p.longitude || !p.id || !p.name) {
- throw new TypeError('invalid POI')
+ throw new TypeError('invalid POI');
}
return {
@@ -15,11 +15,11 @@ const formatPoi = (p) => {
O: p.name,
L: p.id,
X: formatCoord(p.longitude),
- Y: formatCoord(p.latitude)
- })
- }
-}
+ Y: formatCoord(p.latitude),
+ }),
+ };
+};
export {
formatPoi,
-}
+};
diff --git a/format/products-filter.js b/format/products-filter.js
index 569b0614..6158ec0e 100644
--- a/format/products-filter.js
+++ b/format/products-filter.js
@@ -1,35 +1,45 @@
-import isObj from 'lodash/isObject.js'
+import isObj from 'lodash/isObject.js';
-const hasProp = (o, k) => Object.prototype.hasOwnProperty.call(o, k)
+const hasProp = (o, k) => Object.prototype.hasOwnProperty.call(o, k);
const formatProductsFilter = (ctx, filter) => {
- if (!isObj(filter)) throw new TypeError('products filter must be an object')
- const {profile} = ctx
+ if (!isObj(filter)) {
+ throw new TypeError('products filter must be an object');
+ }
+ const {profile} = ctx;
- const byProduct = {}
- const defaultProducts = {}
+ const byProduct = {};
+ const defaultProducts = {};
for (let product of profile.products) {
- byProduct[product.id] = product
- defaultProducts[product.id] = product.default
+ byProduct[product.id] = product;
+ defaultProducts[product.id] = product.default;
}
- filter = Object.assign({}, defaultProducts, filter)
+ filter = Object.assign({}, defaultProducts, filter);
- let res = 0, products = 0
+ let res = 0, products = 0;
for (let product in filter) {
- if (!hasProp(filter, product) || filter[product] !== true) continue
- if (!byProduct[product]) throw new TypeError('unknown product ' + product)
- products++
- for (let bitmask of byProduct[product].bitmasks) res = res | bitmask
+ if (!hasProp(filter, product) || filter[product] !== true) {
+ continue;
+ }
+ if (!byProduct[product]) {
+ throw new TypeError('unknown product ' + product);
+ }
+ products++;
+ for (let bitmask of byProduct[product].bitmasks) {
+ res = res | bitmask;
+ }
+ }
+ if (products === 0) {
+ throw new Error('no products used');
}
- if (products === 0) throw new Error('no products used')
return {
type: 'PROD',
mode: 'INC',
- value: res + ''
- }
-}
+ value: String(res),
+ };
+};
export {
formatProductsFilter,
-}
+};
diff --git a/format/radar-req.js b/format/radar-req.js
index c4aaa631..54d00723 100644
--- a/format/radar-req.js
+++ b/format/radar-req.js
@@ -1,5 +1,5 @@
const formatRadarReq = (ctx, north, west, south, east) => {
- const {profile, opt} = ctx
+ const {profile, opt} = ctx;
return {
meth: 'JourneyGeoPos',
@@ -14,16 +14,16 @@ const formatRadarReq = (ctx, north, west, south, east) => {
perStep: Math.round(opt.duration / Math.max(opt.frames, 1) * 1000),
ageOfReport: true, // todo: what is this?
jnyFltrL: [
- profile.formatProductsFilter(ctx, opt.products || {})
+ profile.formatProductsFilter(ctx, opt.products || {}),
],
// todo: what is this? what about realtime?
// - CALC
// - CALC_REPORT (as seen in the INSA Young app)
trainPosMode: 'CALC',
- }
- }
-}
+ },
+ };
+};
export {
formatRadarReq,
-}
+};
diff --git a/format/reachable-from-req.js b/format/reachable-from-req.js
index 95dd7d96..1a0f4906 100644
--- a/format/reachable-from-req.js
+++ b/format/reachable-from-req.js
@@ -1,22 +1,24 @@
const formatReachableFromReq = (ctx, address) => {
- const {profile, opt} = ctx
+ const {profile, opt} = ctx;
return {
meth: 'LocGeoReach',
req: {
loc: profile.formatLocation(profile, address, 'address'),
- maxDur: opt.maxDuration === null ? -1 : opt.maxDuration,
+ maxDur: opt.maxDuration === null
+ ? -1
+ : opt.maxDuration,
maxChg: opt.maxTransfers,
date: profile.formatDate(profile, opt.when),
time: profile.formatTime(profile, opt.when),
period: 120, // todo: what is this?
jnyFltrL: [
- profile.formatProductsFilter(ctx, opt.products || {})
- ]
- }
- }
-}
+ profile.formatProductsFilter(ctx, opt.products || {}),
+ ],
+ },
+ };
+};
export {
formatReachableFromReq,
-}
+};
diff --git a/format/rectangle.js b/format/rectangle.js
index eb12da17..c36fd827 100644
--- a/format/rectangle.js
+++ b/format/rectangle.js
@@ -2,15 +2,15 @@ const formatRectangle = (profile, north, west, south, east) => {
return {
llCrd: {
x: profile.formatCoord(west),
- y: profile.formatCoord(south)
+ y: profile.formatCoord(south),
},
urCrd: {
x: profile.formatCoord(east),
- y: profile.formatCoord(north)
- }
- }
-}
+ y: profile.formatCoord(north),
+ },
+ };
+};
export {
formatRectangle,
-}
+};
diff --git a/format/refresh-journey-req.js b/format/refresh-journey-req.js
index b91a7604..92f23b18 100644
--- a/format/refresh-journey-req.js
+++ b/format/refresh-journey-req.js
@@ -1,25 +1,24 @@
const formatRefreshJourneyReq = (ctx, refreshToken) => {
- // eslint-disable-next-line no-unused-vars
- const {profile, opt} = ctx
+ const {profile, opt} = ctx;
const req = {
getIST: true, // todo: make an option
- getPasslist: !!opt.stopovers,
- getPolyline: !!opt.polylines,
- getTariff: !!opt.tickets
- }
+ getPasslist: Boolean(opt.stopovers),
+ getPolyline: Boolean(opt.polylines),
+ getTariff: Boolean(opt.tickets),
+ };
if (profile.refreshJourneyUseOutReconL) {
- req.outReconL = [{ctx: refreshToken}]
+ req.outReconL = [{ctx: refreshToken}];
} else {
- req.ctxRecon = refreshToken
+ req.ctxRecon = refreshToken;
}
return {
meth: 'Reconstruction',
req,
- }
-}
+ };
+};
export {
formatRefreshJourneyReq,
-}
+};
diff --git a/format/remarks-req.js b/format/remarks-req.js
index bf203ac3..ba45bc3e 100644
--- a/format/remarks-req.js
+++ b/format/remarks-req.js
@@ -1,34 +1,38 @@
const formatRemarksReq = (ctx) => {
- const {profile, opt} = ctx
+ const {profile, opt} = ctx;
- const himFltrL = []
+ const himFltrL = [];
// todo: https://github.com/marudor/BahnhofsAbfahrten/blob/95fef0217d01344642dd423457473fe9b8b6056e/src/types/HAFAS/index.ts#L76-L91
if (opt.products) {
- himFltrL.push(profile.formatProductsFilter(ctx, opt.products))
+ himFltrL.push(profile.formatProductsFilter(ctx, opt.products));
}
const req = {
himFltrL,
+ };
+ if (profile.remarksGetPolyline) {
+ req.getPolyline = Boolean(opt.polylines);
}
- if (profile.remarksGetPolyline) req.getPolyline = !!opt.polylines
// todo: stLoc, dirLoc
// todo: comp, dept, onlyHimId, onlyToday
// todo: dailyB, dailyE
// see https://github.com/marudor/BahnhofsAbfahrten/blob/46a74957d68edc15713112df44e1a25150f5a178/src/types/HAFAS/HimSearch.ts#L3-L18
- if (opt.results !== null) req.maxNum = opt.results
+ if (opt.results !== null) {
+ req.maxNum = opt.results;
+ }
if (opt.from !== null) {
- req.dateB = profile.formatDate(profile, opt.from)
- req.timeB = profile.formatTime(profile, opt.from)
+ req.dateB = profile.formatDate(profile, opt.from);
+ req.timeB = profile.formatTime(profile, opt.from);
}
if (opt.to !== null) {
- req.dateE = profile.formatDate(profile, opt.to)
- req.timeE = profile.formatTime(profile, opt.to)
+ req.dateE = profile.formatDate(profile, opt.to);
+ req.timeE = profile.formatTime(profile, opt.to);
}
- return {meth: 'HimSearch', req}
-}
+ return {meth: 'HimSearch', req};
+};
export {
formatRemarksReq,
-}
+};
diff --git a/format/station-board-req.js b/format/station-board-req.js
index e4bbc001..9a8e779f 100644
--- a/format/station-board-req.js
+++ b/format/station-board-req.js
@@ -1,11 +1,11 @@
const formatStationBoardReq = (ctx, station, type) => {
- const {profile, opt} = ctx
+ const {profile, opt} = ctx;
const jnyFltrL = [
- profile.formatProductsFilter(ctx, opt.products || {})
- ]
+ profile.formatProductsFilter(ctx, opt.products || {}),
+ ];
if (opt.line !== null) {
- jnyFltrL.push({type: 'LINEID', mode: 'INC', value: opt.line})
+ jnyFltrL.push({type: 'LINEID', mode: 'INC', value: opt.line});
}
const req = {
@@ -13,22 +13,30 @@ const formatStationBoardReq = (ctx, station, type) => {
date: profile.formatDate(profile, opt.when),
time: profile.formatTime(profile, opt.when),
stbLoc: station,
- dirLoc: opt.direction ? profile.formatStation(opt.direction) : undefined,
+ dirLoc: opt.direction
+ ? profile.formatStation(opt.direction)
+ : undefined,
jnyFltrL,
- dur: opt.duration
- }
+ dur: opt.duration,
+ };
if (opt.results !== null) {
- req.maxJny = opt.results === Infinity ? 10000 : opt.results
+ req.maxJny = opt.results === Infinity
+ ? 10000
+ : opt.results;
+ }
+ if (profile.departuresGetPasslist) {
+ req.getPasslist = Boolean(opt.stopovers);
+ }
+ if (profile.departuresStbFltrEquiv) {
+ req.stbFltrEquiv = !opt.includeRelatedStations;
}
- if (profile.departuresGetPasslist) req.getPasslist = !!opt.stopovers
- if (profile.departuresStbFltrEquiv) req.stbFltrEquiv = !opt.includeRelatedStations
return {
meth: 'StationBoard',
- req
- }
-}
+ req,
+ };
+};
export {
formatStationBoardReq,
-}
+};
diff --git a/format/station.js b/format/station.js
index d9ce95ab..dc9e793c 100644
--- a/format/station.js
+++ b/format/station.js
@@ -1,4 +1,4 @@
-import {formatLocationIdentifier} from './location-identifier.js'
+import {formatLocationIdentifier} from './location-identifier.js';
const formatStation = (id) => {
return {
@@ -6,12 +6,12 @@ const formatStation = (id) => {
// todo: name necessary?
lid: formatLocationIdentifier({
A: '1', // station?
- L: id
+ L: id,
// todo: `p` – timestamp of when the ID was obtained
- })
- }
-}
+ }),
+ };
+};
export {
formatStation,
-}
+};
diff --git a/format/stop-req.js b/format/stop-req.js
index 6a98a911..11f3a5f4 100644
--- a/format/stop-req.js
+++ b/format/stop-req.js
@@ -3,11 +3,11 @@ const formatStopReq = (ctx, stopRef) => {
// todo: there's also `StationDetails`, are there differences?
meth: 'LocDetails',
req: {
- locL: [stopRef]
- }
- }
-}
+ locL: [stopRef],
+ },
+ };
+};
export {
formatStopReq,
-}
+};
diff --git a/format/time.js b/format/time.js
index bd7a31bd..f1e11bba 100644
--- a/format/time.js
+++ b/format/time.js
@@ -1,21 +1,24 @@
-import {DateTime, IANAZone} from 'luxon'
-import {luxonIANAZonesByProfile as timezones} from '../lib/luxon-timezones.js'
+import {DateTime, IANAZone} from 'luxon';
+import {luxonIANAZonesByProfile as timezones} from '../lib/luxon-timezones.js';
// todo: change to `(profile) => (when) => {}`
const formatTime = (profile, when) => {
- let timezone
- if (timezones.has(profile)) timezone = timezones.get(profile)
- else {
- timezone = new IANAZone(profile.timezone)
- timezones.set(profile, timezone)
+ let timezone;
+ if (timezones.has(profile)) {
+ timezone = timezones.get(profile);
+ } else {
+ timezone = new IANAZone(profile.timezone);
+ timezones.set(profile, timezone);
}
- return DateTime.fromMillis(+when, {
- locale: profile.locale,
- zone: timezone
- }).toFormat('HHmmss')
-}
+ return DateTime
+ .fromMillis(Number(when), {
+ locale: profile.locale,
+ zone: timezone,
+ })
+ .toFormat('HHmmss');
+};
export {
formatTime,
-}
+};
diff --git a/format/trip-req.js b/format/trip-req.js
index bca4f25c..7a4af097 100644
--- a/format/trip-req.js
+++ b/format/trip-req.js
@@ -8,11 +8,11 @@ const formatTripReq = ({opt}, id) => {
// HAFAS apparently ignores the date in the trip ID and uses the `date` field.
// Thus, it will find a different trip if you pass the wrong date via `opt.when`.
// date: profile.formatDate(profile, opt.when),
- getPolyline: !!opt.polyline
- }
- }
-}
+ getPolyline: Boolean(opt.polyline),
+ },
+ };
+};
export {
formatTripReq,
-}
+};
diff --git a/index.js b/index.js
index d9b411a0..d665b9cf 100644
--- a/index.js
+++ b/index.js
@@ -1,43 +1,43 @@
-import isObj from 'lodash/isObject.js'
-import sortBy from 'lodash/sortBy.js'
-import omit from 'lodash/omit.js'
+import isObj from 'lodash/isObject.js';
+import sortBy from 'lodash/sortBy.js';
+import omit from 'lodash/omit.js';
-import {defaultProfile} from './lib/default-profile.js'
-import {validateProfile} from './lib/validate-profile.js'
-import {INVALID_REQUEST} from './lib/errors.js'
-import {sliceLeg} from './lib/slice-leg.js'
-import {HafasError} from './lib/errors.js'
+import {defaultProfile} from './lib/default-profile.js';
+import {validateProfile} from './lib/validate-profile.js';
+import {INVALID_REQUEST} from './lib/errors.js';
+import {sliceLeg} from './lib/slice-leg.js';
+import {HafasError} from './lib/errors.js';
// background info: https://github.com/public-transport/hafas-client/issues/286
const FORBIDDEN_USER_AGENTS = [
'my-awesome-program', // previously used in readme.md, p/*/readme.md & docs/*.md
'hafas-client-example', // previously used in p/*/example.js
'link-to-your-project-or-email', // now used throughout
-]
+];
-const isNonEmptyString = str => 'string' === typeof str && str.length > 0
+const isNonEmptyString = str => 'string' === typeof str && str.length > 0;
const validateLocation = (loc, name = 'location') => {
if (!isObj(loc)) {
- throw new TypeError(name + ' must be an object.')
+ throw new TypeError(name + ' must be an object.');
} else if (loc.type !== 'location') {
- throw new TypeError('invalid location object.')
+ throw new TypeError('invalid location object.');
} else if ('number' !== typeof loc.latitude) {
- throw new TypeError(name + '.latitude must be a number.')
+ throw new TypeError(name + '.latitude must be a number.');
} else if ('number' !== typeof loc.longitude) {
- throw new TypeError(name + '.longitude must be a number.')
+ throw new TypeError(name + '.longitude must be a number.');
}
-}
+};
const validateWhen = (when, name = 'when') => {
- if (Number.isNaN(+when)) {
- throw new TypeError(name + ' is invalid')
+ if (Number.isNaN(Number(when))) {
+ throw new TypeError(name + ' is invalid');
}
-}
+};
const createClient = (profile, userAgent, opt = {}) => {
- profile = Object.assign({}, defaultProfile, profile)
- validateProfile(profile)
+ profile = Object.assign({}, defaultProfile, profile);
+ validateProfile(profile);
if ('string' !== typeof userAgent) {
throw new TypeError('userAgent must be a string');
@@ -47,19 +47,23 @@ const createClient = (profile, userAgent, opt = {}) => {
}
const _stationBoard = async (station, type, resultsField, parse, opt = {}) => {
- if (isObj(station)) station = profile.formatStation(station.id)
- else if ('string' === typeof station) station = profile.formatStation(station)
- else throw new TypeError('station must be an object or a string.')
+ if (isObj(station)) {
+ station = profile.formatStation(station.id);
+ } else if ('string' === typeof station) {
+ station = profile.formatStation(station);
+ } else {
+ throw new TypeError('station must be an object or a string.');
+ }
if ('string' !== typeof type || !type) {
- throw new TypeError('type must be a non-empty string.')
+ throw new TypeError('type must be a non-empty string.');
}
- if (!profile.departuresGetPasslist && ('stopovers' in opt)) {
- throw new Error('opt.stopovers is not supported by this endpoint')
+ if (!profile.departuresGetPasslist && 'stopovers' in opt) {
+ throw new Error('opt.stopovers is not supported by this endpoint');
}
- if (!profile.departuresStbFltrEquiv && ('includeRelatedStations' in opt)) {
- throw new Error('opt.includeRelatedStations is not supported by this endpoint')
+ if (!profile.departuresStbFltrEquiv && 'includeRelatedStations' in opt) {
+ throw new Error('opt.includeRelatedStations is not supported by this endpoint');
}
opt = Object.assign({
@@ -75,63 +79,67 @@ const createClient = (profile, userAgent, opt = {}) => {
stopovers: false, // fetch & parse previous/next stopovers?
// departures at related stations
// e.g. those that belong together on the metro map.
- includeRelatedStations: true
- }, opt)
- opt.when = new Date(opt.when || Date.now())
- if (Number.isNaN(+opt.when)) throw new Error('opt.when is invalid')
+ includeRelatedStations: true,
+ }, opt);
+ opt.when = new Date(opt.when || Date.now());
+ if (Number.isNaN(Number(opt.when))) {
+ throw new Error('opt.when is invalid');
+ }
- const req = profile.formatStationBoardReq({profile, opt}, station, type)
+ const req = profile.formatStationBoardReq({profile, opt}, station, type);
- const {res, common} = await profile.request({profile, opt}, userAgent, req)
+ const {res, common} = await profile.request({profile, opt}, userAgent, req);
- const ctx = {profile, opt, common, res}
- const jnyL = Array.isArray(res.jnyL) ? res.jnyL : []
+ const ctx = {profile, opt, common, res};
+ const jnyL = Array.isArray(res.jnyL)
+ ? res.jnyL
+ : [];
const results = jnyL.map(res => parse(ctx, res))
- .sort((a, b) => new Date(a.when) - new Date(b.when)) // todo
+ .sort((a, b) => new Date(a.when) - new Date(b.when)); // todo
return {
[resultsField]: results,
realtimeDataUpdatedAt: res.planrtTS && res.planrtTS !== '0'
? parseInt(res.planrtTS)
: null,
- }
- }
+ };
+ };
const departures = async (station, opt = {}) => {
- return await _stationBoard(station, 'DEP', 'departures', profile.parseDeparture, opt)
- }
+ return await _stationBoard(station, 'DEP', 'departures', profile.parseDeparture, opt);
+ };
const arrivals = async (station, opt = {}) => {
- return await _stationBoard(station, 'ARR', 'arrivals', profile.parseArrival, opt)
- }
+ return await _stationBoard(station, 'ARR', 'arrivals', profile.parseArrival, opt);
+ };
const journeys = async (from, to, opt = {}) => {
- from = profile.formatLocation(profile, from, 'from')
- to = profile.formatLocation(profile, to, 'to')
+ from = profile.formatLocation(profile, from, 'from');
+ to = profile.formatLocation(profile, to, 'to');
- if (('earlierThan' in opt) && ('laterThan' in opt)) {
- throw new TypeError('opt.earlierThan and opt.laterThan are mutually exclusive.')
+ if ('earlierThan' in opt && 'laterThan' in opt) {
+ throw new TypeError('opt.earlierThan and opt.laterThan are mutually exclusive.');
}
- if (('departure' in opt) && ('arrival' in opt)) {
- throw new TypeError('opt.departure and opt.arrival are mutually exclusive.')
+ if ('departure' in opt && 'arrival' in opt) {
+ throw new TypeError('opt.departure and opt.arrival are mutually exclusive.');
}
- let journeysRef = null
+ let journeysRef = null;
if ('earlierThan' in opt) {
if (!isNonEmptyString(opt.earlierThan)) {
- throw new TypeError('opt.earlierThan must be a non-empty string.')
+ throw new TypeError('opt.earlierThan must be a non-empty string.');
}
- if (('departure' in opt) || ('arrival' in opt)) {
- throw new TypeError('opt.earlierThan and opt.departure/opt.arrival are mutually exclusive.')
+ if ('departure' in opt || 'arrival' in opt) {
+ throw new TypeError('opt.earlierThan and opt.departure/opt.arrival are mutually exclusive.');
}
- journeysRef = opt.earlierThan
+ journeysRef = opt.earlierThan;
}
if ('laterThan' in opt) {
if (!isNonEmptyString(opt.laterThan)) {
- throw new TypeError('opt.laterThan must be a non-empty string.')
+ throw new TypeError('opt.laterThan must be a non-empty string.');
}
- if (('departure' in opt) || ('arrival' in opt)) {
- throw new TypeError('opt.laterThan and opt.departure/opt.arrival are mutually exclusive.')
+ if ('departure' in opt || 'arrival' in opt) {
+ throw new TypeError('opt.laterThan and opt.departure/opt.arrival are mutually exclusive.');
}
- journeysRef = opt.laterThan
+ journeysRef = opt.laterThan;
}
opt = Object.assign({
@@ -152,88 +160,103 @@ const createClient = (profile, userAgent, opt = {}) => {
entrances: true, // parse & expose entrances of stops/stations?
remarks: true, // parse & expose hints & warnings?
scheduledDays: false, // parse & expose dates each journey is valid on?
- }, opt)
- if (opt.via) opt.via = profile.formatLocation(profile, opt.via, 'opt.via')
+ }, opt);
+ if (opt.via) {
+ opt.via = profile.formatLocation(profile, opt.via, 'opt.via');
+ }
if (opt.when !== undefined) {
- throw new Error('opt.when is not supported anymore. Use opt.departure/opt.arrival.')
+ throw new Error('opt.when is not supported anymore. Use opt.departure/opt.arrival.');
}
- let when = new Date(), outFrwd = true
+ let when = new Date(), outFrwd = true;
if (opt.departure !== undefined && opt.departure !== null) {
- when = new Date(opt.departure)
- if (Number.isNaN(+when)) throw new TypeError('opt.departure is invalid')
+ when = new Date(opt.departure);
+ if (Number.isNaN(Number(when))) {
+ throw new TypeError('opt.departure is invalid');
+ }
} else if (opt.arrival !== undefined && opt.arrival !== null) {
if (!profile.journeysOutFrwd) {
- throw new Error('opt.arrival is unsupported')
+ throw new Error('opt.arrival is unsupported');
}
- when = new Date(opt.arrival)
- if (Number.isNaN(+when)) throw new TypeError('opt.arrival is invalid')
- outFrwd = false
+ when = new Date(opt.arrival);
+ if (Number.isNaN(Number(when))) {
+ throw new TypeError('opt.arrival is invalid');
+ }
+ outFrwd = false;
}
const filters = [
- profile.formatProductsFilter({profile}, opt.products || {})
- ]
+ profile.formatProductsFilter({profile}, opt.products || {}),
+ ];
if (
- opt.accessibility &&
- profile.filters &&
- profile.filters.accessibility &&
- profile.filters.accessibility[opt.accessibility]
+ opt.accessibility
+ && profile.filters
+ && profile.filters.accessibility
+ && profile.filters.accessibility[opt.accessibility]
) {
- filters.push(profile.filters.accessibility[opt.accessibility])
+ filters.push(profile.filters.accessibility[opt.accessibility]);
}
- if (!['slow','normal','fast'].includes(opt.walkingSpeed)) {
- throw new Error('opt.walkingSpeed must be one of these values: "slow", "normal", "fast".')
+ if (!['slow', 'normal', 'fast'].includes(opt.walkingSpeed)) {
+ throw new Error('opt.walkingSpeed must be one of these values: "slow", "normal", "fast".');
}
- const gisFltrL = []
+ const gisFltrL = [];
if (profile.journeysWalkingSpeed) {
gisFltrL.push({
meta: 'foot_speed_' + opt.walkingSpeed,
mode: 'FB',
- type: 'M'
- })
+ type: 'M',
+ });
}
const query = {
- getPasslist: !!opt.stopovers,
+ getPasslist: Boolean(opt.stopovers),
maxChg: opt.transfers,
minChgTime: opt.transferTime,
depLocL: [from],
- viaLocL: opt.via ? [{loc: opt.via}] : [],
+ viaLocL: opt.via
+ ? [{loc: opt.via}]
+ : [],
arrLocL: [to],
jnyFltrL: filters,
gisFltrL,
- getTariff: !!opt.tickets,
+ getTariff: Boolean(opt.tickets),
// todo: this is actually "take additional stations nearby the given start and destination station into account"
// see rest.exe docs
- ushrp: !!opt.startWithWalking,
+ ushrp: Boolean(opt.startWithWalking),
getPT: true, // todo: what is this?
getIV: false, // todo: walk & bike as alternatives?
- getPolyline: !!opt.polylines
+ getPolyline: Boolean(opt.polylines),
// todo: `getConGroups: false` what is this?
// todo: what is getEco, fwrd?
+ };
+ if (journeysRef) {
+ query.ctxScr = journeysRef;
+ } else {
+ query.outDate = profile.formatDate(profile, when);
+ query.outTime = profile.formatTime(profile, when);
}
- if (journeysRef) query.ctxScr = journeysRef
- else {
- query.outDate = profile.formatDate(profile, when)
- query.outTime = profile.formatTime(profile, when)
+ if (opt.results !== null) {
+ query.numF = opt.results;
+ }
+ if (profile.journeysOutFrwd) {
+ query.outFrwd = outFrwd;
}
- if (opt.results !== null) query.numF = opt.results
- if (profile.journeysOutFrwd) query.outFrwd = outFrwd
const {res, common} = await profile.request({profile, opt}, userAgent, {
cfg: {polyEnc: 'GPA'},
meth: 'TripSearch',
- req: profile.transformJourneysQuery({profile, opt}, query)
- })
- if (!Array.isArray(res.outConL)) return []
+ req: profile.transformJourneysQuery({profile, opt}, query),
+ });
+ if (!Array.isArray(res.outConL)) {
+ return [];
+ }
// todo: outConGrpL
- const ctx = {profile, opt, common, res}
+ const ctx = {profile, opt, common, res};
const journeys = res.outConL
- .map(j => profile.parseJourney(ctx, j))
+ .map(j => profile.parseJourney(ctx, j));
return {
earlierRef: res.outCtxScrB || null,
@@ -242,12 +265,12 @@ const createClient = (profile, userAgent, opt = {}) => {
realtimeDataUpdatedAt: res.planrtTS && res.planrtTS !== '0'
? parseInt(res.planrtTS)
: null,
- }
- }
+ };
+ };
const refreshJourney = async (refreshToken, opt = {}) => {
if ('string' !== typeof refreshToken || !refreshToken) {
- throw new TypeError('refreshToken must be a non-empty string.')
+ throw new TypeError('refreshToken must be a non-empty string.');
}
opt = Object.assign({
@@ -258,57 +281,63 @@ const createClient = (profile, userAgent, opt = {}) => {
entrances: true, // parse & expose entrances of stops/stations?
remarks: true, // parse & expose hints & warnings?
scheduledDays: false, // parse & expose dates the journey is valid on?
- }, opt)
+ }, opt);
- const req = profile.formatRefreshJourneyReq({profile, opt}, refreshToken)
+ const req = profile.formatRefreshJourneyReq({profile, opt}, refreshToken);
- const {res, common} = await profile.request({profile, opt}, userAgent, req)
+ const {res, common} = await profile.request({profile, opt}, userAgent, req);
if (!Array.isArray(res.outConL) || !res.outConL[0]) {
- throw new HafasError('invalid response, expected outConL[0]', null, {})
+ throw new HafasError('invalid response, expected outConL[0]', null, {});
}
- const ctx = {profile, opt, common, res}
+ const ctx = {profile, opt, common, res};
return {
journey: profile.parseJourney(ctx, res.outConL[0]),
realtimeDataUpdatedAt: res.planrtTS && res.planrtTS !== '0'
? parseInt(res.planrtTS)
: null,
- }
- }
+ };
+ };
// Although the DB Navigator app passes the *first* stopover of the trip
// (instead of the previous one), it seems to work with the previous one as well.
const journeysFromTrip = async (fromTripId, previousStopover, to, opt = {}) => {
if (!isNonEmptyString(fromTripId)) {
- throw new Error('fromTripId must be a non-empty string.')
+ throw new Error('fromTripId must be a non-empty string.');
}
if ('string' === typeof to) {
- to = profile.formatStation(to)
+ to = profile.formatStation(to);
} else if (isObj(to) && (to.type === 'station' || to.type === 'stop')) {
- to = profile.formatStation(to.id)
- } else throw new Error('to must be a valid stop or station.')
-
- if (!isObj(previousStopover)) throw new Error('previousStopover must be an object.')
-
- let prevStop = previousStopover.stop
- if (isObj(prevStop)) {
- prevStop = profile.formatStation(prevStop.id)
- } else if ('string' === typeof prevStop) {
- prevStop = profile.formatStation(prevStop)
- } else throw new Error('previousStopover.stop must be a valid stop or station.')
-
- let depAtPrevStop = previousStopover.departure || previousStopover.plannedDeparture
- if (!isNonEmptyString(depAtPrevStop)) {
- throw new Error('previousStopover.(planned)departure must be a string')
+ to = profile.formatStation(to.id);
+ } else {
+ throw new Error('to must be a valid stop or station.');
}
- depAtPrevStop = Date.parse(depAtPrevStop)
+
+ if (!isObj(previousStopover)) {
+ throw new Error('previousStopover must be an object.');
+ }
+
+ let prevStop = previousStopover.stop;
+ if (isObj(prevStop)) {
+ prevStop = profile.formatStation(prevStop.id);
+ } else if ('string' === typeof prevStop) {
+ prevStop = profile.formatStation(prevStop);
+ } else {
+ throw new Error('previousStopover.stop must be a valid stop or station.');
+ }
+
+ let depAtPrevStop = previousStopover.departure || previousStopover.plannedDeparture;
+ if (!isNonEmptyString(depAtPrevStop)) {
+ throw new Error('previousStopover.(planned)departure must be a string');
+ }
+ depAtPrevStop = Date.parse(depAtPrevStop);
if (Number.isNaN(depAtPrevStop)) {
- throw new Error('previousStopover.(planned)departure is invalid')
+ throw new Error('previousStopover.(planned)departure is invalid');
}
if (depAtPrevStop > Date.now()) {
- throw new Error('previousStopover.(planned)departure must be in the past')
+ throw new Error('previousStopover.(planned)departure must be in the past');
}
opt = Object.assign({
@@ -320,23 +349,29 @@ const createClient = (profile, userAgent, opt = {}) => {
subStops: true, // parse & expose sub-stops of stations?
entrances: true, // parse & expose entrances of stops/stations?
remarks: true, // parse & expose hints & warnings?
- }, opt)
+ }, opt);
// make clear that `departure`/`arrival`/`when` are not supported
- if (opt.departure) throw new Error('journeysFromTrip + opt.departure is not supported by HAFAS.')
- if (opt.arrival) throw new Error('journeysFromTrip + opt.arrival is not supported by HAFAS.')
- if (opt.when) throw new Error('journeysFromTrip + opt.when is not supported by HAFAS.')
+ if (opt.departure) {
+ throw new Error('journeysFromTrip + opt.departure is not supported by HAFAS.');
+ }
+ if (opt.arrival) {
+ throw new Error('journeysFromTrip + opt.arrival is not supported by HAFAS.');
+ }
+ if (opt.when) {
+ throw new Error('journeysFromTrip + opt.when is not supported by HAFAS.');
+ }
const filters = [
- profile.formatProductsFilter({profile}, opt.products || {})
- ]
+ profile.formatProductsFilter({profile}, opt.products || {}),
+ ];
if (
- opt.accessibility &&
- profile.filters &&
- profile.filters.accessibility &&
- profile.filters.accessibility[opt.accessibility]
+ opt.accessibility
+ && profile.filters
+ && profile.filters.accessibility
+ && profile.filters.accessibility[opt.accessibility]
) {
- filters.push(profile.filters.accessibility[opt.accessibility])
+ filters.push(profile.filters.accessibility[opt.accessibility]);
}
// todo: support walking speed filter
@@ -360,55 +395,59 @@ const createClient = (profile, userAgent, opt = {}) => {
loc: prevStop,
type: 'DEP', // todo: are there other values?
date: profile.formatDate(profile, depAtPrevStop),
- time: profile.formatTime(profile, depAtPrevStop)
+ time: profile.formatTime(profile, depAtPrevStop),
},
arrLocL: [to],
jnyFltrL: filters,
- getPasslist: !!opt.stopovers,
- getPolyline: !!opt.polylines,
+ getPasslist: Boolean(opt.stopovers),
+ getPolyline: Boolean(opt.polylines),
minChgTime: opt.transferTime,
- getTariff: !!opt.tickets,
- }
+ getTariff: Boolean(opt.tickets),
+ };
const {res, common} = await profile.request({profile, opt}, userAgent, {
cfg: {polyEnc: 'GPA'},
meth: 'SearchOnTrip',
req: query,
- })
- if (!Array.isArray(res.outConL)) return []
+ });
+ if (!Array.isArray(res.outConL)) {
+ return [];
+ }
- const ctx = {profile, opt, common, res}
+ const ctx = {profile, opt, common, res};
const journeys = res.outConL
- .map(rawJourney => profile.parseJourney(ctx, rawJourney))
- .map((journey) => {
+ .map(rawJourney => profile.parseJourney(ctx, rawJourney))
+ .map((journey) => {
// For the first (transit) leg, HAFAS sometimes returns *all* past
// stopovers of the trip, even though it should only return stopovers
// between the specified `depAtPrevStop` and the arrival at the
// interchange station. We slice the leg accordingly.
- const fromLegI = journey.legs.findIndex(l => l.tripId === fromTripId)
- if (fromLegI < 0) return journey
- const fromLeg = journey.legs[fromLegI]
- return {
- ...journey,
- legs: [
- ...journey.legs.slice(0, fromLegI),
- sliceLeg(fromLeg, previousStopover.stop, fromLeg.destination),
- ...journey.legs.slice(fromLegI + 2),
- ],
- }
- })
+ const fromLegI = journey.legs.findIndex(l => l.tripId === fromTripId);
+ if (fromLegI < 0) {
+ return journey;
+ }
+ const fromLeg = journey.legs[fromLegI];
+ return {
+ ...journey,
+ legs: [
+ ...journey.legs.slice(0, fromLegI),
+ sliceLeg(fromLeg, previousStopover.stop, fromLeg.destination),
+ ...journey.legs.slice(fromLegI + 2),
+ ],
+ };
+ });
return {
journeys,
realtimeDataUpdatedAt: res.planrtTS && res.planrtTS !== '0'
? parseInt(res.planrtTS)
: null,
- }
- }
+ };
+ };
const locations = async (query, opt = {}) => {
if (!isNonEmptyString(query)) {
- throw new TypeError('query must be a non-empty string.')
+ throw new TypeError('query must be a non-empty string.');
}
opt = Object.assign({
fuzzy: true, // find only exact matches?
@@ -418,46 +457,52 @@ const createClient = (profile, userAgent, opt = {}) => {
poi: true, // points of interest
subStops: true, // parse & expose sub-stops of stations?
entrances: true, // parse & expose entrances of stops/stations?
- linesOfStops: false // parse & expose lines at each stop/station?
- }, opt)
+ linesOfStops: false, // parse & expose lines at each stop/station?
+ }, opt);
- const req = profile.formatLocationsReq({profile, opt}, query)
+ const req = profile.formatLocationsReq({profile, opt}, query);
- const {res, common} = await profile.request({profile, opt}, userAgent, req)
- if (!res.match || !Array.isArray(res.match.locL)) return []
+ const {res, common} = await profile.request({profile, opt}, userAgent, req);
+ if (!res.match || !Array.isArray(res.match.locL)) {
+ return [];
+ }
- const ctx = {profile, opt, common, res}
- return res.match.locL.map(loc => profile.parseLocation(ctx, loc))
- }
+ const ctx = {profile, opt, common, res};
+ return res.match.locL.map(loc => profile.parseLocation(ctx, loc));
+ };
const stop = async (stop, opt = {}) => {
- if ('object' === typeof stop) stop = profile.formatStation(stop.id)
- else if ('string' === typeof stop) stop = profile.formatStation(stop)
- else throw new TypeError('stop must be an object or a string.')
+ if ('object' === typeof stop) {
+ stop = profile.formatStation(stop.id);
+ } else if ('string' === typeof stop) {
+ stop = profile.formatStation(stop);
+ } else {
+ throw new TypeError('stop must be an object or a string.');
+ }
opt = Object.assign({
linesOfStops: false, // parse & expose lines at the stop/station?
subStops: true, // parse & expose sub-stops of stations?
entrances: true, // parse & expose entrances of stops/stations?
remarks: true, // parse & expose hints & warnings?
- }, opt)
+ }, opt);
- const req = profile.formatStopReq({profile, opt}, stop)
+ const req = profile.formatStopReq({profile, opt}, stop);
- const {res, common} = await profile.request({profile, opt}, userAgent, req)
+ const {res, common} = await profile.request({profile, opt}, userAgent, req);
if (!res || !Array.isArray(res.locL) || !res.locL[0]) {
throw new HafasError('invalid response, expected locL[0]', null, {
// This problem occurs on invalid input. 🙄
code: INVALID_REQUEST,
- })
+ });
}
- const ctx = {profile, opt, res, common}
- return profile.parseLocation(ctx, res.locL[0])
- }
+ const ctx = {profile, opt, res, common};
+ return profile.parseLocation(ctx, res.locL[0]);
+ };
const nearby = async (location, opt = {}) => {
- validateLocation(location, 'location')
+ validateLocation(location, 'location');
opt = Object.assign({
results: 8, // maximum number of results
@@ -466,25 +511,27 @@ const createClient = (profile, userAgent, opt = {}) => {
stops: true, // return stops/stations?
subStops: true, // parse & expose sub-stops of stations?
entrances: true, // parse & expose entrances of stops/stations?
- linesOfStops: false // parse & expose lines at each stop/station?
- }, opt)
+ linesOfStops: false, // parse & expose lines at each stop/station?
+ }, opt);
- const req = profile.formatNearbyReq({profile, opt}, location)
+ const req = profile.formatNearbyReq({profile, opt}, location);
- const {res, common} = await profile.request({profile, opt}, userAgent, req)
- if (!Array.isArray(res.locL)) return []
+ const {res, common} = await profile.request({profile, opt}, userAgent, req);
+ if (!Array.isArray(res.locL)) {
+ return [];
+ }
// todo: parse `.dur` – walking duration?
- const ctx = {profile, opt, common, res}
- const results = res.locL.map(loc => profile.parseNearby(ctx, loc))
+ const ctx = {profile, opt, common, res};
+ const results = res.locL.map(loc => profile.parseNearby(ctx, loc));
return Number.isInteger(opt.results)
? results.slice(0, opt.results)
- : results
- }
+ : results;
+ };
const trip = async (id, opt = {}) => {
if (!isNonEmptyString(id)) {
- throw new TypeError('id must be a non-empty string.')
+ throw new TypeError('id must be a non-empty string.');
}
opt = Object.assign({
stopovers: true, // return stations on the way?
@@ -493,27 +540,27 @@ const createClient = (profile, userAgent, opt = {}) => {
entrances: true, // parse & expose entrances of stops/stations?
remarks: true, // parse & expose hints & warnings?
scheduledDays: false, // parse & expose dates trip is valid on?
- }, opt)
+ }, opt);
- const req = profile.formatTripReq({profile, opt}, id)
+ const req = profile.formatTripReq({profile, opt}, id);
- const {res, common} = await profile.request({profile, opt}, userAgent, req)
- const ctx = {profile, opt, common, res}
+ const {res, common} = await profile.request({profile, opt}, userAgent, req);
+ const ctx = {profile, opt, common, res};
- const trip = profile.parseTrip(ctx, res.journey)
+ const trip = profile.parseTrip(ctx, res.journey);
return {
trip,
realtimeDataUpdatedAt: res.planrtTS && res.planrtTS !== '0'
? parseInt(res.planrtTS)
: null,
- }
- }
+ };
+ };
// todo [breaking]: rename to trips()?
const tripsByName = async (lineNameOrFahrtNr = '*', opt = {}) => {
if (!isNonEmptyString(lineNameOrFahrtNr)) {
- throw new TypeError('lineNameOrFahrtNr must be a non-empty string.')
+ throw new TypeError('lineNameOrFahrtNr must be a non-empty string.');
}
opt = Object.assign({
when: null,
@@ -524,7 +571,7 @@ const createClient = (profile, userAgent, opt = {}) => {
lineName: null,
operatorNames: null,
additionalFilters: [], // undocumented
- }, opt)
+ }, opt);
const req = {
// fields: https://github.com/marudor/BahnhofsAbfahrten/blob/f619e754f212980261eb7e2b151cd73ba0213da8/packages/types/HAFAS/JourneyMatch.ts#L4-L23
@@ -538,33 +585,33 @@ const createClient = (profile, userAgent, opt = {}) => {
// todo: `onlyRT: true` reduces the number of results, but filters recent trips 🤔
// todo: `onlyTN: true` yields a `NO_MATCH` error
// todo: useAeqi
- }
+ };
if (opt.when !== null) {
- req.date = profile.formatDate(profile, new Date(opt.when))
- req.time = profile.formatTime(profile, new Date(opt.when))
+ req.date = profile.formatDate(profile, new Date(opt.when));
+ req.time = profile.formatTime(profile, new Date(opt.when));
}
// todo: fromWhen doesn't work yet, but untilWhen does
if (opt.fromWhen !== null) {
- req.dateB = profile.formatDate(profile, new Date(opt.fromWhen))
- req.timeB = profile.formatTime(profile, new Date(opt.fromWhen))
+ req.dateB = profile.formatDate(profile, new Date(opt.fromWhen));
+ req.timeB = profile.formatTime(profile, new Date(opt.fromWhen));
}
if (opt.untilWhen !== null) {
- req.dateE = profile.formatDate(profile, new Date(opt.untilWhen))
- req.timeE = profile.formatTime(profile, new Date(opt.untilWhen))
+ req.dateE = profile.formatDate(profile, new Date(opt.untilWhen));
+ req.timeE = profile.formatTime(profile, new Date(opt.untilWhen));
}
- const filter = (mode, type, value) => ({mode, type, value})
+ const filter = (mode, type, value) => ({mode, type, value});
if (opt.currentlyStoppingAt !== null) {
if (!isNonEmptyString(opt.currentlyStoppingAt)) {
- throw new TypeError('opt.currentlyStoppingAt must be a non-empty string.')
+ throw new TypeError('opt.currentlyStoppingAt must be a non-empty string.');
}
- req.jnyFltrL.push(filter('INC', 'STATIONS', opt.currentlyStoppingAt))
+ req.jnyFltrL.push(filter('INC', 'STATIONS', opt.currentlyStoppingAt));
}
if (opt.lineName !== null) {
if (!isNonEmptyString(opt.lineName)) {
- throw new TypeError('opt.lineName must be a non-empty string.')
+ throw new TypeError('opt.lineName must be a non-empty string.');
}
// todo: does this target `line` or `lineId`?
- req.jnyFltrL.push(filter('INC', 'LINE', opt.lineName))
+ req.jnyFltrL.push(filter('INC', 'LINE', opt.lineName));
}
if (opt.operatorNames !== null) {
if (
@@ -572,38 +619,50 @@ const createClient = (profile, userAgent, opt = {}) => {
|| opt.operatorNames.length === 0
|| !opt.operatorNames.every(isNonEmptyString)
) {
- throw new TypeError('opt.operatorNames must be an array of non-empty strings.')
+ throw new TypeError('opt.operatorNames must be an array of non-empty strings.');
}
// todo: is the an escaping mechanism for ","
- req.jnyFltrL.push(filter('INC', 'OP', opt.operatorNames.join(',')))
+ req.jnyFltrL.push(filter('INC', 'OP', opt.operatorNames.join(',')));
}
- req.jnyFltrL = [...req.jnyFltrL, ...opt.additionalFilters]
+ req.jnyFltrL = [...req.jnyFltrL, ...opt.additionalFilters];
const {res, common} = await profile.request({profile, opt}, userAgent, {
cfg: {polyEnc: 'GPA'},
meth: 'JourneyMatch',
req,
- })
+ });
// todo [breaking]: catch `NO_MATCH` errors, return []
- const ctx = {profile, opt, common, res}
+ const ctx = {profile, opt, common, res};
- const trips = res.jnyL.map(t => profile.parseTrip(ctx, t))
+ const trips = res.jnyL.map(t => profile.parseTrip(ctx, t));
return {
trips,
realtimeDataUpdatedAt: res.planrtTS && res.planrtTS !== '0'
? parseInt(res.planrtTS)
: null,
- }
- }
+ };
+ };
const radar = async ({north, west, south, east}, opt) => {
- if ('number' !== typeof north) throw new TypeError('north must be a number.')
- if ('number' !== typeof west) throw new TypeError('west must be a number.')
- if ('number' !== typeof south) throw new TypeError('south must be a number.')
- if ('number' !== typeof east) throw new TypeError('east must be a number.')
- if (north <= south) throw new Error('north must be larger than south.')
- if (east <= west) throw new Error('east must be larger than west.')
+ if ('number' !== typeof north) {
+ throw new TypeError('north must be a number.');
+ }
+ if ('number' !== typeof west) {
+ throw new TypeError('west must be a number.');
+ }
+ if ('number' !== typeof south) {
+ throw new TypeError('south must be a number.');
+ }
+ if ('number' !== typeof east) {
+ throw new TypeError('east must be a number.');
+ }
+ if (north <= south) {
+ throw new Error('north must be larger than south.');
+ }
+ if (east <= west) {
+ throw new Error('east must be larger than west.');
+ }
opt = Object.assign({
results: 256, // maximum number of vehicles
@@ -614,28 +673,32 @@ const createClient = (profile, userAgent, opt = {}) => {
polylines: true, // return a track shape for each vehicle?
subStops: true, // parse & expose sub-stops of stations?
entrances: true, // parse & expose entrances of stops/stations?
- }, opt || {})
- opt.when = new Date(opt.when || Date.now())
- if (Number.isNaN(+opt.when)) throw new TypeError('opt.when is invalid')
+ }, opt || {});
+ opt.when = new Date(opt.when || Date.now());
+ if (Number.isNaN(Number(opt.when))) {
+ throw new TypeError('opt.when is invalid');
+ }
- const req = profile.formatRadarReq({profile, opt}, north, west, south, east)
+ const req = profile.formatRadarReq({profile, opt}, north, west, south, east);
- const {res, common} = await profile.request({profile, opt}, userAgent, req)
- if (!Array.isArray(res.jnyL)) return []
- const ctx = {profile, opt, common, res}
+ const {res, common} = await profile.request({profile, opt}, userAgent, req);
+ if (!Array.isArray(res.jnyL)) {
+ return [];
+ }
+ const ctx = {profile, opt, common, res};
- const movements = res.jnyL.map(m => profile.parseMovement(ctx, m))
+ const movements = res.jnyL.map(m => profile.parseMovement(ctx, m));
return {
movements,
realtimeDataUpdatedAt: res.planrtTS && res.planrtTS !== '0'
? parseInt(res.planrtTS)
: null,
- }
- }
+ };
+ };
const reachableFrom = async (address, opt = {}) => {
- validateLocation(address, 'address')
+ validateLocation(address, 'address');
opt = Object.assign({
when: Date.now(),
@@ -645,32 +708,36 @@ const createClient = (profile, userAgent, opt = {}) => {
subStops: true, // parse & expose sub-stops of stations?
entrances: true, // parse & expose entrances of stops/stations?
polylines: false, // return leg shapes?
- }, opt)
- if (Number.isNaN(+opt.when)) throw new TypeError('opt.when is invalid')
+ }, opt);
+ if (Number.isNaN(Number(opt.when))) {
+ throw new TypeError('opt.when is invalid');
+ }
- const req = profile.formatReachableFromReq({profile, opt}, address)
+ const req = profile.formatReachableFromReq({profile, opt}, address);
- const {res, common} = await profile.request({profile, opt}, userAgent, req)
+ const {res, common} = await profile.request({profile, opt}, userAgent, req);
if (!Array.isArray(res.posL)) {
throw new HafasError('invalid response, expected posL[0]', null, {
shouldRetry: true,
- })
+ });
}
- const byDuration = []
- let i = 0, lastDuration = NaN
+ const byDuration = [];
+ let i = 0, lastDuration = NaN;
for (const pos of sortBy(res.posL, 'dur')) {
- const loc = common.locations[pos.locX]
- if (!loc) continue
+ const loc = common.locations[pos.locX];
+ if (!loc) {
+ continue;
+ }
if (pos.dur !== lastDuration) {
- lastDuration = pos.dur
- i = byDuration.length
+ lastDuration = pos.dur;
+ i = byDuration.length;
byDuration.push({
duration: pos.dur,
- stations: [loc]
- })
+ stations: [loc],
+ });
} else {
- byDuration[i].stations.push(loc)
+ byDuration[i].stations.push(loc);
}
}
@@ -679,8 +746,8 @@ const createClient = (profile, userAgent, opt = {}) => {
realtimeDataUpdatedAt: res.planrtTS && res.planrtTS !== '0'
? parseInt(res.planrtTS)
: null,
- }
- }
+ };
+ };
const remarks = async (opt = {}) => {
opt = {
@@ -690,49 +757,51 @@ const createClient = (profile, userAgent, opt = {}) => {
to: null,
products: null, // filter by affected products
polylines: false, // return leg shapes? (not supported by all endpoints)
- ...opt
- }
+ ...opt,
+ };
if (opt.from !== null) {
- opt.from = new Date(opt.from)
- validateWhen(opt.from, 'opt.from')
+ opt.from = new Date(opt.from);
+ validateWhen(opt.from, 'opt.from');
}
if (opt.to !== null) {
- opt.to = new Date(opt.to)
- validateWhen(opt.to, 'opt.to')
+ opt.to = new Date(opt.to);
+ validateWhen(opt.to, 'opt.to');
}
- const req = profile.formatRemarksReq({profile, opt})
+ const req = profile.formatRemarksReq({profile, opt});
const {
res, common,
- } = await profile.request({profile, opt}, userAgent, req)
+ } = await profile.request({profile, opt}, userAgent, req);
- const ctx = {profile, opt, common, res}
+ const ctx = {profile, opt, common, res};
const remarks = (res.msgL || [])
- .map(w => profile.parseWarning(ctx, w))
+ .map(w => profile.parseWarning(ctx, w));
return {
remarks,
realtimeDataUpdatedAt: res.planrtTS && res.planrtTS !== '0'
? parseInt(res.planrtTS)
: null,
- }
- }
+ };
+ };
const lines = async (query, opt = {}) => {
if (!isNonEmptyString(query)) {
- throw new TypeError('query must be a non-empty string.')
+ throw new TypeError('query must be a non-empty string.');
}
- const req = profile.formatLinesReq({profile, opt}, query)
+ const req = profile.formatLinesReq({profile, opt}, query);
const {
res, common,
- } = await profile.request({profile, opt}, userAgent, req)
+ } = await profile.request({profile, opt}, userAgent, req);
- if (!Array.isArray(res.lineL)) return []
- const ctx = {profile, opt, common, res}
+ if (!Array.isArray(res.lineL)) {
+ return [];
+ }
+ const ctx = {profile, opt, common, res};
const lines = res.lineL.map(l => {
- const parseDirRef = i => (res.common.dirL[i] || {}).txt || null
+ const parseDirRef = i => (res.common.dirL[i] || {}).txt || null;
return {
...omit(l.line, ['id', 'fahrtNr']),
id: l.lineId,
@@ -743,31 +812,31 @@ const createClient = (profile, userAgent, opt = {}) => {
trips: Array.isArray(l.jnyL)
? l.jnyL.map(t => profile.parseTrip(ctx, t))
: null,
- }
- })
+ };
+ });
return {
lines,
realtimeDataUpdatedAt: res.planrtTS && res.planrtTS !== '0'
? parseInt(res.planrtTS)
: null,
- }
- }
+ };
+ };
const serverInfo = async (opt = {}) => {
opt = {
versionInfo: true, // query HAFAS versions?
- ...opt
- }
+ ...opt,
+ };
const {res, common} = await profile.request({profile, opt}, userAgent, {
meth: 'ServerInfo',
req: {
getVersionInfo: opt.versionInfo,
},
- })
+ });
- const ctx = {profile, opt, common, res}
+ const ctx = {profile, opt, common, res};
return {
// todo: what are .serverVersion & .clientVersion?
hciVersion: res.hciVersion || null,
@@ -779,8 +848,8 @@ const createClient = (profile, userAgent, opt = {}) => {
realtimeDataUpdatedAt: res.planrtTS && res.planrtTS !== '0'
? parseInt(res.planrtTS)
: null,
- }
- }
+ };
+ };
const client = {
departures,
@@ -790,19 +859,35 @@ const createClient = (profile, userAgent, opt = {}) => {
stop,
nearby,
serverInfo,
+ };
+ if (profile.trip) {
+ client.trip = trip;
}
- if (profile.trip) client.trip = trip
- if (profile.radar) client.radar = radar
- if (profile.refreshJourney) client.refreshJourney = refreshJourney
- if (profile.journeysFromTrip) client.journeysFromTrip = journeysFromTrip
- if (profile.reachableFrom) client.reachableFrom = reachableFrom
- if (profile.tripsByName) client.tripsByName = tripsByName
- if (profile.remarks !== false) client.remarks = remarks
- if (profile.lines !== false) client.lines = lines
- Object.defineProperty(client, 'profile', {value: profile})
- return client
-}
+ if (profile.radar) {
+ client.radar = radar;
+ }
+ if (profile.refreshJourney) {
+ client.refreshJourney = refreshJourney;
+ }
+ if (profile.journeysFromTrip) {
+ client.journeysFromTrip = journeysFromTrip;
+ }
+ if (profile.reachableFrom) {
+ client.reachableFrom = reachableFrom;
+ }
+ if (profile.tripsByName) {
+ client.tripsByName = tripsByName;
+ }
+ if (profile.remarks !== false) {
+ client.remarks = remarks;
+ }
+ if (profile.lines !== false) {
+ client.lines = lines;
+ }
+ Object.defineProperty(client, 'profile', {value: profile});
+ return client;
+};
export {
createClient,
-}
+};
diff --git a/lib/default-profile.js b/lib/default-profile.js
index 2578bd70..0dff1858 100644
--- a/lib/default-profile.js
+++ b/lib/default-profile.js
@@ -1,60 +1,60 @@
-import {request} from '../lib/request.js'
+import {request} from '../lib/request.js';
-import {formatStationBoardReq} from '../format/station-board-req.js'
-import {formatLocationsReq} from '../format/locations-req.js'
-import {formatStopReq} from '../format/stop-req.js'
-import {formatNearbyReq} from '../format/nearby-req.js'
-import {formatTripReq} from '../format/trip-req.js'
-import {formatRadarReq} from '../format/radar-req.js'
-import {formatReachableFromReq} from '../format/reachable-from-req.js'
-import {formatRefreshJourneyReq} from '../format/refresh-journey-req.js'
-import {formatRemarksReq} from '../format/remarks-req.js'
-import {formatLinesReq} from '../format/lines-req.js'
+import {formatStationBoardReq} from '../format/station-board-req.js';
+import {formatLocationsReq} from '../format/locations-req.js';
+import {formatStopReq} from '../format/stop-req.js';
+import {formatNearbyReq} from '../format/nearby-req.js';
+import {formatTripReq} from '../format/trip-req.js';
+import {formatRadarReq} from '../format/radar-req.js';
+import {formatReachableFromReq} from '../format/reachable-from-req.js';
+import {formatRefreshJourneyReq} from '../format/refresh-journey-req.js';
+import {formatRemarksReq} from '../format/remarks-req.js';
+import {formatLinesReq} from '../format/lines-req.js';
-import {parseDateTime} from '../parse/date-time.js'
-import {parsePlatform} from '../parse/platform.js'
-import {parseBitmask as parseProductsBitmask} from '../parse/products-bitmask.js'
-import {parseIcon} from '../parse/icon.js'
-import {parseWhen} from '../parse/when.js'
-import {parsePrognosisType} from '../parse/prognosis-type.js'
-import {parseScheduledDays} from '../parse/scheduled-days.js'
-import {parseDeparture} from '../parse/departure.js'
-import {parseArrival} from '../parse/arrival.js'
-import {parseTrip} from '../parse/trip.js'
-import {parseJourneyLeg} from '../parse/journey-leg.js'
-import {parseJourney} from '../parse/journey.js'
-import {parseLine} from '../parse/line.js'
-import {parseLocation} from '../parse/location.js'
-import {parseCommonData as parseCommon} from '../parse/common.js'
-import {parsePolyline} from '../parse/polyline.js'
-import {parseMovement} from '../parse/movement.js'
-import {parseNearby} from '../parse/nearby.js'
-import {parseOperator} from '../parse/operator.js'
-import {parseHint} from '../parse/hint.js'
-import {parseWarning} from '../parse/warning.js'
-import {parseStopover} from '../parse/stopover.js'
+import {parseDateTime} from '../parse/date-time.js';
+import {parsePlatform} from '../parse/platform.js';
+import {parseBitmask as parseProductsBitmask} from '../parse/products-bitmask.js';
+import {parseIcon} from '../parse/icon.js';
+import {parseWhen} from '../parse/when.js';
+import {parsePrognosisType} from '../parse/prognosis-type.js';
+import {parseScheduledDays} from '../parse/scheduled-days.js';
+import {parseDeparture} from '../parse/departure.js';
+import {parseArrival} from '../parse/arrival.js';
+import {parseTrip} from '../parse/trip.js';
+import {parseJourneyLeg} from '../parse/journey-leg.js';
+import {parseJourney} from '../parse/journey.js';
+import {parseLine} from '../parse/line.js';
+import {parseLocation} from '../parse/location.js';
+import {parseCommonData as parseCommon} from '../parse/common.js';
+import {parsePolyline} from '../parse/polyline.js';
+import {parseMovement} from '../parse/movement.js';
+import {parseNearby} from '../parse/nearby.js';
+import {parseOperator} from '../parse/operator.js';
+import {parseHint} from '../parse/hint.js';
+import {parseWarning} from '../parse/warning.js';
+import {parseStopover} from '../parse/stopover.js';
-import {formatAddress} from '../format/address.js'
-import {formatCoord} from '../format/coord.js'
-import {formatDate} from '../format/date.js'
-import {formatLocationFilter} from '../format/location-filter.js'
-import {formatProductsFilter} from '../format/products-filter.js'
-import {formatPoi} from '../format/poi.js'
-import {formatStation} from '../format/station.js'
-import {formatTime} from '../format/time.js'
-import {formatLocation} from '../format/location.js'
-import {formatRectangle} from '../format/rectangle.js'
-import * as filters from '../format/filters.js'
+import {formatAddress} from '../format/address.js';
+import {formatCoord} from '../format/coord.js';
+import {formatDate} from '../format/date.js';
+import {formatLocationFilter} from '../format/location-filter.js';
+import {formatProductsFilter} from '../format/products-filter.js';
+import {formatPoi} from '../format/poi.js';
+import {formatStation} from '../format/station.js';
+import {formatTime} from '../format/time.js';
+import {formatLocation} from '../format/location.js';
+import {formatRectangle} from '../format/rectangle.js';
+import * as filters from '../format/filters.js';
-const DEBUG = /(^|,)hafas-client(,|$)/.test(process.env.DEBUG || '')
+const DEBUG = (/(^|,)hafas-client(,|$)/).test(process.env.DEBUG || '');
const logRequest = DEBUG
- ? (_, req, reqId) => console.error(req.body + '')
- : () => {}
+ ? (_, req, reqId) => console.error(String(req.body))
+ : () => {};
const logResponse = DEBUG
? (_, res, body, reqId) => console.error(body)
- : () => {}
+ : () => {};
-const id = (ctx, x) => x
+const id = (ctx, x) => x;
const defaultProfile = {
request,
@@ -115,7 +115,7 @@ const defaultProfile = {
formatRectangle,
filters,
- journeysOutFrwd: true, // `journeys()` method: support for `outFrwd` field?
+ journeysOutFrwd: true, // `journeys()` method: support for `outFrwd` field?
// todo: https://github.com/KDE/kpublictransport/commit/c7c54304160d8f22eab0c91812a107aca82304b7
// `departures()` method: support for `getPasslist` field?
@@ -133,8 +133,8 @@ const defaultProfile = {
// `remarks()` method: support for `getPolyline` field?
remarksGetPolyline: true, // `remarks()` method: support for `getPolyline` field?
lines: true,
-}
+};
export {
defaultProfile,
-}
+};
diff --git a/lib/errors.js b/lib/errors.js
index b11f2259..31819070 100644
--- a/lib/errors.js
+++ b/lib/errors.js
@@ -1,59 +1,59 @@
-const ACCESS_DENIED = 'ACCESS_DENIED'
-const INVALID_REQUEST = 'INVALID_REQUEST'
-const NOT_FOUND = 'NOT_FOUND'
-const SERVER_ERROR = 'SERVER_ERROR'
+const ACCESS_DENIED = 'ACCESS_DENIED';
+const INVALID_REQUEST = 'INVALID_REQUEST';
+const NOT_FOUND = 'NOT_FOUND';
+const SERVER_ERROR = 'SERVER_ERROR';
class HafasError extends Error {
constructor (cleanMessage, hafasCode, props) {
const msg = hafasCode
? hafasCode + ': ' + cleanMessage
- : cleanMessage
- super(msg)
+ : cleanMessage;
+ super(msg);
// generic props
- this.isHafasError = true
+ this.isHafasError = true;
// error-specific props
- this.code = null
+ this.code = null;
// By default, we take the blame, unless we know for sure.
- this.isCausedByServer = false
- this.hafasCode = hafasCode
- Object.assign(this, props)
+ this.isCausedByServer = false;
+ this.hafasCode = hafasCode;
+ Object.assign(this, props);
- return this
+ return this;
}
}
class HafasAccessDeniedError extends HafasError {
constructor (cleanMessage, hafasCode, props) {
- super(cleanMessage, hafasCode, props)
- this.code = ACCESS_DENIED
- return this
+ super(cleanMessage, hafasCode, props);
+ this.code = ACCESS_DENIED;
+ return this;
}
}
class HafasInvalidRequestError extends HafasError {
constructor (cleanMessage, hafasCode, props) {
- super(cleanMessage, hafasCode, props)
- this.code = INVALID_REQUEST
- return this
+ super(cleanMessage, hafasCode, props);
+ this.code = INVALID_REQUEST;
+ return this;
}
}
class HafasNotFoundError extends HafasError {
constructor (cleanMessage, hafasCode, props) {
- super(cleanMessage, hafasCode, props)
- this.code = NOT_FOUND
- return this
+ super(cleanMessage, hafasCode, props);
+ this.code = NOT_FOUND;
+ return this;
}
}
class HafasServerError extends HafasError {
constructor (cleanMessage, hafasCode, props) {
- super(cleanMessage, hafasCode, props)
- this.code = SERVER_ERROR
- this.isCausedByServer = true
- return this
+ super(cleanMessage, hafasCode, props);
+ this.code = SERVER_ERROR;
+ this.isCausedByServer = true;
+ return this;
}
}
@@ -285,8 +285,8 @@ const byErrorCode = Object.assign(Object.create(null), {
props: {
shouldRetry: true,
},
- }
-})
+ },
+});
export {
ACCESS_DENIED,
@@ -299,4 +299,4 @@ export {
HafasNotFoundError,
HafasServerError,
byErrorCode,
-}
+};
diff --git a/lib/find-in-tree.js b/lib/find-in-tree.js
index fae8b331..b8909734 100644
--- a/lib/find-in-tree.js
+++ b/lib/find-in-tree.js
@@ -1,23 +1,23 @@
-import objectScan from 'object-scan'
+import objectScan from 'object-scan';
const createFindInTree = (needles) => {
const scanner = objectScan(needles, {
- filterFn: ({ value, parents, matchedBy, context }) => {
+ filterFn: ({value, parents, matchedBy, context}) => {
matchedBy.forEach((needle) => {
- context[needle].push([value, parents])
- })
- }
- })
+ context[needle].push([value, parents]);
+ });
+ },
+ });
return (haystack) => {
- const context = Object.create(null)
+ const context = Object.create(null);
needles.forEach((needle) => {
- context[needle] = []
- })
- return scanner(haystack, context)
- }
-}
+ context[needle] = [];
+ });
+ return scanner(haystack, context);
+ };
+};
export {
createFindInTree,
-}
+};
diff --git a/lib/luxon-timezones.js b/lib/luxon-timezones.js
index 39027dcd..0c127b64 100644
--- a/lib/luxon-timezones.js
+++ b/lib/luxon-timezones.js
@@ -1,6 +1,6 @@
// hafas-client profile -> luxon.IANAZone
-const luxonIANAZonesByProfile = new WeakMap()
+const luxonIANAZonesByProfile = new WeakMap();
export {
luxonIANAZonesByProfile,
-}
+};
diff --git a/lib/profile-hooks.js b/lib/profile-hooks.js
index bc5aa981..e06bf3f1 100644
--- a/lib/profile-hooks.js
+++ b/lib/profile-hooks.js
@@ -13,11 +13,11 @@ const parseHook = (oldParse, newParse) => {
return (ctx, ...args) => {
return newParse({
...ctx,
- parsed: oldParse({...ctx, parsed: {}}, ...args)
- }, ...args)
- }
-}
+ parsed: oldParse({...ctx, parsed: {}}, ...args),
+ }, ...args);
+ };
+};
export {
parseHook,
-}
+};
diff --git a/lib/request.js b/lib/request.js
index bc8f25f3..ff65e91e 100644
--- a/lib/request.js
+++ b/lib/request.js
@@ -1,105 +1,118 @@
-import ProxyAgent from 'https-proxy-agent'
-import {isIP} from 'net'
-import {Agent as HttpsAgent} from 'https'
-import roundRobin from '@derhuerst/round-robin-scheduler'
-import {randomBytes} from 'crypto'
-import createHash from 'create-hash'
-import {Buffer} from 'node:buffer'
-import {stringify} from 'qs'
-import {Request, fetch} from 'cross-fetch'
-import {parse as parseContentType} from 'content-type'
-import {HafasError, byErrorCode} from './errors.js'
+import ProxyAgent from 'https-proxy-agent';
+import {isIP} from 'net';
+import {Agent as HttpsAgent} from 'https';
+import roundRobin from '@derhuerst/round-robin-scheduler';
+import {randomBytes} from 'crypto';
+import createHash from 'create-hash';
+import {Buffer} from 'node:buffer';
+import {stringify} from 'qs';
+import {Request, fetch} from 'cross-fetch';
+import {parse as parseContentType} from 'content-type';
+import {HafasError, byErrorCode} from './errors.js';
-const proxyAddress = process.env.HTTPS_PROXY || process.env.HTTP_PROXY || null
-const localAddresses = process.env.LOCAL_ADDRESS || null
+const proxyAddress = process.env.HTTPS_PROXY || process.env.HTTP_PROXY || null;
+const localAddresses = process.env.LOCAL_ADDRESS || null;
if (proxyAddress && localAddresses) {
- console.error('Both env vars HTTPS_PROXY/HTTP_PROXY and LOCAL_ADDRESS are not supported.')
- process.exit(1)
+ console.error('Both env vars HTTPS_PROXY/HTTP_PROXY and LOCAL_ADDRESS are not supported.');
+ process.exit(1);
}
const plainAgent = new HttpsAgent({
keepAlive: true,
-})
-let getAgent = () => plainAgent
+});
+let getAgent = () => plainAgent;
if (proxyAddress) {
const agent = new ProxyAgent(proxyAddress, {
keepAlive: true,
keepAliveMsecs: 10 * 1000, // 10s
- })
- getAgent = () => agent
+ });
+ getAgent = () => agent;
} else if (localAddresses) {
const agents = process.env.LOCAL_ADDRESS.split(',')
- .map((addr) => {
- const family = isIP(addr)
- if (family === 0) throw new Error('invalid local address:' + addr)
- return new HttpsAgent({
- localAddress: addr, family,
- keepAlive: true,
- })
- })
- const pool = roundRobin(agents)
- getAgent = () => pool.get()
+ .map((addr) => {
+ const family = isIP(addr);
+ if (family === 0) {
+ throw new Error('invalid local address:' + addr);
+ }
+ return new HttpsAgent({
+ localAddress: addr, family,
+ keepAlive: true,
+ });
+ });
+ const pool = roundRobin(agents);
+ getAgent = () => pool.get();
}
-const id = randomBytes(3).toString('hex')
+const id = randomBytes(3)
+ .toString('hex');
const randomizeUserAgent = (userAgent) => {
- let ua = userAgent
+ let ua = userAgent;
for (
let i = Math.round(5 + Math.random() * 5);
i < ua.length;
i += Math.round(5 + Math.random() * 5)
) {
- ua = ua.slice(0, i) + id + ua.slice(i)
- i += id.length
+ ua = ua.slice(0, i) + id + ua.slice(i);
+ i += id.length;
}
- return ua
-}
+ return ua;
+};
-const md5 = input => createHash('md5').update(input).digest()
+const md5 = input => createHash('md5')
+ .update(input)
+ .digest();
const checkIfResponseIsOk = (_) => {
const {
body,
errProps: baseErrProps,
- } = _
+ } = _;
const errProps = {
...baseErrProps,
+ };
+ if (body.id) {
+ errProps.hafasResponseId = body.id;
}
- if (body.id) errProps.hafasResponseId = body.id
// Because we want more accurate stack traces, we don't construct the error here,
// but only return the constructor & error message.
const getError = (_) => {
// mutating here is ugly but pragmatic
- if (_.errTxt) errProps.hafasMessage = _.errTxt
- if (_.errTxtOut) errProps.hafasDescription = _.errTxtOut
+ if (_.errTxt) {
+ errProps.hafasMessage = _.errTxt;
+ }
+ if (_.errTxtOut) {
+ errProps.hafasDescription = _.errTxtOut;
+ }
- if (_.err in byErrorCode) return byErrorCode[_.err]
+ if (_.err in byErrorCode) {
+ return byErrorCode[_.err];
+ }
return {
Error: HafasError,
message: body.errTxt || 'unknown error',
props: {},
- }
- }
+ };
+ };
if (body.err && body.err !== 'OK') {
- const {Error: HafasError, message, props} = getError(body)
- throw new HafasError(message, body.err, {...errProps, ...props})
+ const {Error: HafasError, message, props} = getError(body);
+ throw new HafasError(message, body.err, {...errProps, ...props});
}
if (!body.svcResL || !body.svcResL[0]) {
- throw new HafasError('invalid/unsupported response structure', null, errProps)
+ throw new HafasError('invalid/unsupported response structure', null, errProps);
}
if (body.svcResL[0].err !== 'OK') {
- const {Error: HafasError, message, props} = getError(body.svcResL[0])
- throw new HafasError(message, body.svcResL[0].err, {...errProps, ...props})
+ const {Error: HafasError, message, props} = getError(body.svcResL[0]);
+ throw new HafasError(message, body.svcResL[0].err, {...errProps, ...props});
}
-}
+};
const request = async (ctx, userAgent, reqData) => {
- const {profile, opt} = ctx
+ const {profile, opt} = ctx;
const rawReqBody = profile.transformReqBody(ctx, {
// todo: is it `eng` actually?
@@ -111,7 +124,7 @@ const request = async (ctx, userAgent, reqData) => {
ext: profile.ext, // ?
ver: profile.ver, // HAFAS protocol version
auth: profile.auth, // static authentication
- })
+ });
const req = profile.transformReq(ctx, {
agent: getAgent(),
@@ -128,39 +141,40 @@ const request = async (ctx, userAgent, reqData) => {
'connection': 'keep-alive', // prevent excessive re-connecting
},
redirect: 'follow',
- query: {}
- })
+ query: {},
+ });
if (profile.addChecksum || profile.addMicMac) {
if (!Buffer.isBuffer(profile.salt) && 'string' !== typeof profile.salt) {
- throw new TypeError('profile.salt must be a Buffer or a string.')
+ throw new TypeError('profile.salt must be a Buffer or a string.');
}
// Buffer.from(buf, 'hex') just returns buf
- const salt = Buffer.from(profile.salt, 'hex')
+ const salt = Buffer.from(profile.salt, 'hex');
if (profile.addChecksum) {
const checksum = md5(Buffer.concat([
Buffer.from(req.body, 'utf8'),
salt,
- ]))
- req.query.checksum = checksum.toString('hex')
+ ]));
+ req.query.checksum = checksum.toString('hex');
}
if (profile.addMicMac) {
- const mic = md5(Buffer.from(req.body, 'utf8'))
- req.query.mic = mic.toString('hex')
+ const mic = md5(Buffer.from(req.body, 'utf8'));
+ req.query.mic = mic.toString('hex');
- const micAsHex = Buffer.from(mic.toString('hex'), 'utf8')
- const mac = md5(Buffer.concat([micAsHex, salt]))
- req.query.mac = mac.toString('hex')
+ const micAsHex = Buffer.from(mic.toString('hex'), 'utf8');
+ const mac = md5(Buffer.concat([micAsHex, salt]));
+ req.query.mac = mac.toString('hex');
}
}
- const reqId = randomBytes(3).toString('hex')
- const url = profile.endpoint + '?' + stringify(req.query)
- const fetchReq = new Request(url, req)
- profile.logRequest(ctx, fetchReq, reqId)
+ const reqId = randomBytes(3)
+ .toString('hex');
+ const url = profile.endpoint + '?' + stringify(req.query);
+ const fetchReq = new Request(url, req);
+ profile.logRequest(ctx, fetchReq, reqId);
- const res = await fetch(url, req)
+ const res = await fetch(url, req);
const errProps = {
// todo [breaking]: assign as non-enumerable property
@@ -168,40 +182,40 @@ const request = async (ctx, userAgent, reqData) => {
// todo [breaking]: assign as non-enumerable property
response: res,
url,
- }
+ };
if (!res.ok) {
// todo [breaking]: make this a FetchError or a HafasClientError?
- const err = new Error(res.statusText)
- Object.assign(err, errProps)
- throw err
+ const err = new Error(res.statusText);
+ Object.assign(err, errProps);
+ throw err;
}
- let cType = res.headers.get('content-type')
+ let cType = res.headers.get('content-type');
if (cType) {
- const {type} = parseContentType(cType)
+ const {type} = parseContentType(cType);
if (type !== 'application/json') {
- throw new HafasError('invalid/unsupported response content-type: ' + cType, null, errProps)
+ throw new HafasError('invalid/unsupported response content-type: ' + cType, null, errProps);
}
}
- const body = await res.text()
- profile.logResponse(ctx, res, body, reqId)
+ const body = await res.text();
+ profile.logResponse(ctx, res, body, reqId);
- const b = JSON.parse(body)
+ const b = JSON.parse(body);
checkIfResponseIsOk({
body: b,
errProps,
- })
+ });
- const svcRes = b.svcResL[0].res
+ const svcRes = b.svcResL[0].res;
return {
res: svcRes,
common: profile.parseCommon({...ctx, res: svcRes}),
- }
-}
+ };
+};
export {
checkIfResponseIsOk,
request,
-}
+};
diff --git a/lib/slice-leg.js b/lib/slice-leg.js
index 7723bf27..94e3f4f5 100644
--- a/lib/slice-leg.js
+++ b/lib/slice-leg.js
@@ -1,47 +1,63 @@
const findById = (needle) => {
- const needleStopId = needle.id
- const needleStationId = needle.station ? needle.station.id : null
+ const needleStopId = needle.id;
+ const needleStationId = needle.station
+ ? needle.station.id
+ : null;
return (stop) => {
- if (needleStopId === stop.id) return true
- const stationId = stop.station ? stop.station.id : null
- if (needleStationId && stationId && needleStationId === stationId) return true
+ if (needleStopId === stop.id) {
+ return true;
+ }
+ const stationId = stop.station
+ ? stop.station.id
+ : null;
+ if (needleStationId && stationId && needleStationId === stationId) {
+ return true;
+ }
// todo: `needleStationId === stop.id`? `needleStopId === stationId`?
- return false
- }
-}
+ return false;
+ };
+};
const sliceLeg = (leg, from, to) => {
- if (!Array.isArray(leg.stopovers)) throw new Error('leg.stopovers must be an array.')
+ if (!Array.isArray(leg.stopovers)) {
+ throw new Error('leg.stopovers must be an array.');
+ }
- const stops = leg.stopovers.map(st => st.stop)
- const fromI = stops.findIndex(findById(from))
- if (fromI === -1) throw new Error('from not found in stopovers')
- const fromStopover = leg.stopovers[fromI]
+ const stops = leg.stopovers.map(st => st.stop);
+ const fromI = stops.findIndex(findById(from));
+ if (fromI === -1) {
+ throw new Error('from not found in stopovers');
+ }
+ const fromStopover = leg.stopovers[fromI];
- const toI = stops.findIndex(findById(to))
- if (toI === -1) throw new Error('to not found in stopovers')
- const toStopover = leg.stopovers[toI]
+ const toI = stops.findIndex(findById(to));
+ if (toI === -1) {
+ throw new Error('to not found in stopovers');
+ }
+ const toStopover = leg.stopovers[toI];
- if (fromI === 0 && toI === leg.stopovers.length - 1) return leg
- const newLeg = Object.assign({}, leg)
- newLeg.stopovers = leg.stopovers.slice(fromI, toI + 1)
+ if (fromI === 0 && toI === leg.stopovers.length - 1) {
+ return leg;
+ }
+ const newLeg = Object.assign({}, leg);
+ newLeg.stopovers = leg.stopovers.slice(fromI, toI + 1);
- newLeg.origin = fromStopover.stop
- newLeg.departure = fromStopover.departure
- newLeg.departureDelay = fromStopover.departureDelay
- newLeg.scheduledDeparture = fromStopover.scheduledDeparture
- newLeg.departurePlatform = fromStopover.departurePlatform
+ newLeg.origin = fromStopover.stop;
+ newLeg.departure = fromStopover.departure;
+ newLeg.departureDelay = fromStopover.departureDelay;
+ newLeg.scheduledDeparture = fromStopover.scheduledDeparture;
+ newLeg.departurePlatform = fromStopover.departurePlatform;
- newLeg.destination = toStopover.stop
- newLeg.arrival = toStopover.arrival
- newLeg.arrivalDelay = toStopover.arrivalDelay
- newLeg.scheduledArrival = toStopover.scheduledArrival
- newLeg.arrivalPlatform = toStopover.arrivalPlatform
+ newLeg.destination = toStopover.stop;
+ newLeg.arrival = toStopover.arrival;
+ newLeg.arrivalDelay = toStopover.arrivalDelay;
+ newLeg.scheduledArrival = toStopover.scheduledArrival;
+ newLeg.arrivalPlatform = toStopover.arrivalPlatform;
- return newLeg
-}
+ return newLeg;
+};
export {
sliceLeg,
-}
+};
diff --git a/lib/validate-profile.js b/lib/validate-profile.js
index 55fb3513..468d01bb 100644
--- a/lib/validate-profile.js
+++ b/lib/validate-profile.js
@@ -43,53 +43,55 @@ const types = {
formatStation: 'function',
formatTime: 'function',
formatLocation: 'function',
- formatRectangle: 'function'
-}
+ formatRectangle: 'function',
+};
const validateProfile = (profile) => {
for (let key of Object.keys(types)) {
- const type = types[key]
+ const type = types[key];
if (type === 'array') {
if (!Array.isArray(profile[key])) {
- throw new TypeError(`profile.${key} must be an array.`)
+ throw new TypeError(`profile.${key} must be an array.`);
}
} else if (type !== typeof profile[key]) {
- throw new TypeError(`profile.${key} must be a ${type}.`)
+ throw new TypeError(`profile.${key} must be a ${type}.`);
}
if (type === 'object' && profile[key] === null) {
- throw new TypeError(`profile.${key} must not be null.`)
+ throw new TypeError(`profile.${key} must not be null.`);
}
}
if (!Array.isArray(profile.products)) {
- throw new TypeError('profile.products must be an array.')
+ throw new TypeError('profile.products must be an array.');
+ }
+ if (profile.products.length === 0) {
+ throw new Error('profile.products is empty.');
}
- if (profile.products.length === 0) throw new Error('profile.products is empty.')
for (let product of profile.products) {
if ('string' !== typeof product.id) {
- throw new TypeError('profile.products[].id must be a string.')
+ throw new TypeError('profile.products[].id must be a string.');
}
if ('boolean' !== typeof product.default) {
- throw new TypeError('profile.products[].default must be a boolean.')
+ throw new TypeError('profile.products[].default must be a boolean.');
}
if (!Array.isArray(product.bitmasks)) {
- throw new TypeError(product.id + '.bitmasks must be an array.')
+ throw new TypeError(product.id + '.bitmasks must be an array.');
}
for (let bitmask of product.bitmasks) {
if ('number' !== typeof bitmask) {
- throw new TypeError(product.id + '.bitmasks[] must be a number.')
+ throw new TypeError(product.id + '.bitmasks[] must be a number.');
}
}
}
if ('trip' in profile && 'boolean' !== typeof profile.trip) {
- throw new Error('profile.trip must be a boolean.')
+ throw new Error('profile.trip must be a boolean.');
}
if ('journeyLeg' in profile) {
- throw new Error('profile.journeyLeg has been removed. Use profile.trip.')
+ throw new Error('profile.journeyLeg has been removed. Use profile.trip.');
}
-}
+};
export {
validateProfile,
-}
+};
diff --git a/p/avv/index.js b/p/avv/index.js
index d79592b3..7abc5f05 100644
--- a/p/avv/index.js
+++ b/p/avv/index.js
@@ -1,9 +1,9 @@
// todo: use import assertions once they're supported by Node.js & ESLint
// https://github.com/tc39/proposal-import-assertions
-import {createRequire} from 'module'
-const require = createRequire(import.meta.url)
+import {createRequire} from 'module';
+const require = createRequire(import.meta.url);
-const baseProfile = require('./base.json')
+const baseProfile = require('./base.json');
const products = [{
id: 'regional-train',
@@ -82,7 +82,7 @@ const products = [{
name: 'Fähre',
short: 'Fähre',
default: true,
-}]
+}];
const profile = {
...baseProfile,
@@ -98,8 +98,8 @@ const profile = {
reachableFrom: true,
remarks: true,
remarksGetPolyline: false,
-}
+};
export {
profile,
-}
+};
diff --git a/p/bart/index.js b/p/bart/index.js
index 191e4f90..6ab930b9 100644
--- a/p/bart/index.js
+++ b/p/bart/index.js
@@ -1,9 +1,9 @@
// todo: use import assertions once they're supported by Node.js & ESLint
// https://github.com/tc39/proposal-import-assertions
-import {createRequire} from 'module'
-const require = createRequire(import.meta.url)
+import {createRequire} from 'module';
+const require = createRequire(import.meta.url);
-const baseProfile = require('./base.json')
+const baseProfile = require('./base.json');
const products = [{
id: 'bart',
@@ -47,7 +47,7 @@ const products = [{
name: 'cable car',
short: 'cable car',
default: true,
-}]
+}];
const profile = {
...baseProfile,
@@ -62,8 +62,8 @@ const profile = {
reachableFrom: true,
refreshJourneyUseOutReconL: true,
-}
+};
export {
profile,
-}
+};
diff --git a/p/bls/index.js b/p/bls/index.js
index ddf63b1b..86651ff5 100644
--- a/p/bls/index.js
+++ b/p/bls/index.js
@@ -1,9 +1,9 @@
// todo: use import assertions once they're supported by Node.js & ESLint
// https://github.com/tc39/proposal-import-assertions
-import {createRequire} from 'module'
-const require = createRequire(import.meta.url)
+import {createRequire} from 'module';
+const require = createRequire(import.meta.url);
-const baseProfile = require('./base.json')
+const baseProfile = require('./base.json');
const products = [{
id: 'ice',
@@ -75,7 +75,7 @@ const products = [{
name: 'Autoverlad',
short: 'Autoverlad',
default: true,
-}]
+}];
const profile = {
...baseProfile,
@@ -89,8 +89,8 @@ const profile = {
radar: true,
refreshJourneyUseOutReconL: true,
reachableFrom: true,
-}
+};
export {
profile,
-}
+};
diff --git a/p/bvg/index.js b/p/bvg/index.js
index 0e92abbf..94b79666 100644
--- a/p/bvg/index.js
+++ b/p/bvg/index.js
@@ -1,97 +1,99 @@
// todo: use import assertions once they're supported by Node.js & ESLint
// https://github.com/tc39/proposal-import-assertions
-import {createRequire} from 'module'
-const require = createRequire(import.meta.url)
+import {createRequire} from 'module';
+const require = createRequire(import.meta.url);
-import {parseHook} from '../../lib/profile-hooks.js'
+import {parseHook} from '../../lib/profile-hooks.js';
-import {parseAndAddLocationDHID} from '../vbb/parse-loc-dhid.js'
+import {parseAndAddLocationDHID} from '../vbb/parse-loc-dhid.js';
-import {parseLocation as _parseLocation} from '../../parse/location.js'
-import {parseArrival as _parseArrival} from '../../parse/arrival.js'
-import {parseDeparture as _parseDeparture} from '../../parse/departure.js'
-import {parseStopover as _parseStopover} from '../../parse/stopover.js'
-import {parseJourneyLeg as _parseJourneyLeg} from '../../parse/journey-leg.js'
+import {parseLocation as _parseLocation} from '../../parse/location.js';
+import {parseArrival as _parseArrival} from '../../parse/arrival.js';
+import {parseDeparture as _parseDeparture} from '../../parse/departure.js';
+import {parseStopover as _parseStopover} from '../../parse/stopover.js';
+import {parseJourneyLeg as _parseJourneyLeg} from '../../parse/journey-leg.js';
-const baseProfile = require('./base.json')
-import {products} from './products.js'
+const baseProfile = require('./base.json');
+import {products} from './products.js';
// todo: there's also a referenced icon `{"res":"occup_fig_{low,mid}"}`
const addOccupancy = (item, occupancyCodes) => {
const remIdx = (item.remarks || [])
- .findIndex(r => r.code && occupancyCodes.has(r.code))
- if (remIdx < 0) return;
- const rem = item.remarks[remIdx]
+ .findIndex(r => r.code && occupancyCodes.has(r.code));
+ if (remIdx < 0) {
+ return;
+ }
+ const rem = item.remarks[remIdx];
- item.occupancy = occupancyCodes.get(rem.code)
+ item.occupancy = occupancyCodes.get(rem.code);
item.remarks = [
...item.remarks.slice(0, remIdx),
...item.remarks.slice(remIdx + 1),
- ]
-}
+ ];
+};
const stopoverOccupancyCodes = new Map([
['text.occup.loc.max.11', 'low'],
['text.occup.loc.max.12', 'medium'],
['text.occup.loc.max.13', 'high'],
-])
+]);
const journeyLegOccupancyCodes = new Map([
['text.occup.jny.max.11', 'low'],
['text.occup.jny.max.12', 'medium'],
['text.occup.jny.max.13', 'high'],
-])
+]);
const parseLocation = ({parsed}, l) => {
- parseAndAddLocationDHID(parsed, l)
- return parsed
-}
+ parseAndAddLocationDHID(parsed, l);
+ return parsed;
+};
// todo: S45, S46?
-const ringbahnClockwise = /^ringbahn s\s?41$/i
-const ringbahnAnticlockwise = /^ringbahn s\s?42$/i
+const ringbahnClockwise = /^ringbahn s\s?41$/i;
+const ringbahnAnticlockwise = /^ringbahn s\s?42$/i;
const parseDepartureRenameRingbahn = ({parsed}, dep) => {
if (parsed.line && parsed.line.product === 'suburban') {
- const d = parsed.direction && parsed.direction.trim()
+ const d = parsed.direction && parsed.direction.trim();
if (ringbahnClockwise.test(d)) {
- parsed.direction = 'Ringbahn S41 ⟳'
+ parsed.direction = 'Ringbahn S41 ⟳';
} else if (ringbahnAnticlockwise.test(d)) {
- parsed.direction = 'Ringbahn S42 ⟲'
+ parsed.direction = 'Ringbahn S42 ⟲';
}
}
- return parsed
-}
+ return parsed;
+};
const parseArrivalRenameRingbahn = ({parsed}, arr) => {
if (parsed.line && parsed.line.product === 'suburban') {
- const p = parsed.provenance && parsed.provenance.trim()
+ const p = parsed.provenance && parsed.provenance.trim();
if (ringbahnClockwise.test(p)) {
- parsed.provenance = 'Ringbahn S41 ⟳'
+ parsed.provenance = 'Ringbahn S41 ⟳';
} else if (ringbahnAnticlockwise.test(p)) {
- parsed.provenance = 'Ringbahn S42 ⟲'
+ parsed.provenance = 'Ringbahn S42 ⟲';
}
}
- return parsed
-}
+ return parsed;
+};
const parseArrDepWithOccupancy = ({parsed}, d) => {
- addOccupancy(parsed, stopoverOccupancyCodes)
- return parsed
-}
+ addOccupancy(parsed, stopoverOccupancyCodes);
+ return parsed;
+};
const parseStopoverWithOccupancy = ({parsed}, st, date) => {
- addOccupancy(parsed, stopoverOccupancyCodes)
- return parsed
-}
+ addOccupancy(parsed, stopoverOccupancyCodes);
+ return parsed;
+};
const parseJourneyLegWithBerlkönig = (ctx, leg, date) => {
if (leg.type === 'KISS') {
- const icon = ctx.common.icons[leg.icoX]
+ const icon = ctx.common.icons[leg.icoX];
if (icon && icon.type === 'prod_berl') {
const res = _parseJourneyLeg(ctx, {
- ...leg, type: 'WALK'
- }, date)
- delete res.walking
+ ...leg, type: 'WALK',
+ }, date);
+ delete res.walking;
- const mcp = leg.dep.mcp || {}
- const mcpData = mcp.mcpData || {}
+ const mcp = leg.dep.mcp || {};
+ const mcpData = mcp.mcpData || {};
// todo: mcp.lid
// todo: mcpData.occupancy, mcpData.type
// todo: journey.trfRes.bkgData
@@ -102,33 +104,35 @@ const parseJourneyLegWithBerlkönig = (ctx, leg, date) => {
name: mcpData.providerName,
public: true,
mode: 'taxi',
- product: 'berlkoenig'
+ product: 'berlkoenig',
// todo: operator
- }
- return res
+ };
+ return res;
}
}
- return _parseJourneyLeg(ctx, leg, date)
-}
+ return _parseJourneyLeg(ctx, leg, date);
+};
const parseJourneyLegWithOccupancy = ({parsed}, leg, date) => {
if (leg.type === 'JNY') {
- addOccupancy(parsed, journeyLegOccupancyCodes)
+ addOccupancy(parsed, journeyLegOccupancyCodes);
}
- return parsed
-}
+ return parsed;
+};
// use the Berlkönig ride sharing service?
// todo: https://github.com/alexander-albers/tripkit/issues/26#issuecomment-825437320
const requestJourneysWithBerlkoenig = ({opt}, query) => {
- if (('numF' in query) && opt.berlkoenig) {
+ if ('numF' in query && opt.berlkoenig) {
// todo: check if this is still true
- throw new Error('The `berlkoenig` and `results` options are mutually exclusive.')
+ throw new Error('The `berlkoenig` and `results` options are mutually exclusive.');
}
- query.jnyFltrL.push({type: 'GROUP', mode: 'INC', value: 'OEV'})
- if (opt.berlkoenig) query.jnyFltrL.push({type: 'GROUP', mode: 'INC', value: 'BERLKOENIG'})
- query.gisFltrL = [{meta: 'foot_speed_normal', type: 'M', mode: 'FB'}]
- return query
-}
+ query.jnyFltrL.push({type: 'GROUP', mode: 'INC', value: 'OEV'});
+ if (opt.berlkoenig) {
+ query.jnyFltrL.push({type: 'GROUP', mode: 'INC', value: 'BERLKOENIG'});
+ }
+ query.gisFltrL = [{meta: 'foot_speed_normal', type: 'M', mode: 'FB'}];
+ return query;
+};
// todo: adapt/extend `vbb-parse-ticket` to support the BVG markup
@@ -160,9 +164,9 @@ const profile = {
trip: true,
radar: true,
refreshJourney: true,
- reachableFrom: true
-}
+ reachableFrom: true,
+};
export {
profile,
-}
+};
diff --git a/p/bvg/products.js b/p/bvg/products.js
index 9ad80d73..7565a019 100644
--- a/p/bvg/products.js
+++ b/p/bvg/products.js
@@ -5,7 +5,7 @@ const products = [
bitmasks: [1],
name: 'S-Bahn',
short: 'S',
- default: true
+ default: true,
},
{
id: 'subway',
@@ -13,7 +13,7 @@ const products = [
bitmasks: [2],
name: 'U-Bahn',
short: 'U',
- default: true
+ default: true,
},
{
id: 'tram',
@@ -21,7 +21,7 @@ const products = [
bitmasks: [4],
name: 'Tram',
short: 'T',
- default: true
+ default: true,
},
{
id: 'bus',
@@ -29,7 +29,7 @@ const products = [
bitmasks: [8],
name: 'Bus',
short: 'B',
- default: true
+ default: true,
},
{
id: 'ferry',
@@ -37,7 +37,7 @@ const products = [
bitmasks: [16],
name: 'Fähre',
short: 'F',
- default: true
+ default: true,
},
{
id: 'express',
@@ -45,7 +45,7 @@ const products = [
bitmasks: [32],
name: 'IC/ICE',
short: 'E',
- default: true
+ default: true,
},
{
id: 'regional',
@@ -53,10 +53,10 @@ const products = [
bitmasks: [64],
name: 'RB/RE',
short: 'R',
- default: true
- }
-]
+ default: true,
+ },
+];
export {
products,
-}
+};
diff --git a/p/cfl/index.js b/p/cfl/index.js
index e8e380b2..81507951 100644
--- a/p/cfl/index.js
+++ b/p/cfl/index.js
@@ -1,10 +1,10 @@
// todo: use import assertions once they're supported by Node.js & ESLint
// https://github.com/tc39/proposal-import-assertions
-import {createRequire} from 'module'
-const require = createRequire(import.meta.url)
+import {createRequire} from 'module';
+const require = createRequire(import.meta.url);
-const baseProfile = require('./base.json')
-import {products} from './products.js'
+const baseProfile = require('./base.json');
+import {products} from './products.js';
const profile = {
...baseProfile,
@@ -19,8 +19,8 @@ const profile = {
radar: true,
reachableFrom: true,
remarksGetPolyline: false,
-}
+};
export {
profile,
-}
+};
diff --git a/p/cfl/products.js b/p/cfl/products.js
index 8b17110b..8ace308c 100644
--- a/p/cfl/products.js
+++ b/p/cfl/products.js
@@ -6,7 +6,7 @@ const products = [
bitmasks: [1, 2],
name: 'TGV, ICE, EuroCity',
short: 'TGV/ICE/EC',
- default: true
+ default: true,
},
{
id: 'local-train',
@@ -14,7 +14,7 @@ const products = [
bitmasks: [8, 16],
name: 'local trains',
short: 'local',
- default: true
+ default: true,
},
{
id: 'tram',
@@ -22,7 +22,7 @@ const products = [
bitmasks: [256],
name: 'tram',
short: 'tram',
- default: true
+ default: true,
},
{
id: 'bus',
@@ -30,7 +30,7 @@ const products = [
bitmasks: [32],
name: 'bus',
short: 'bus',
- default: true
+ default: true,
},
{
id: 'gondola',
@@ -38,10 +38,10 @@ const products = [
bitmasks: [512],
name: 'Fun', // taken from the horaires.cfl.lu website
short: 'Fun', // abbreviation for funicular?
- default: true
- }
-]
+ default: true,
+ },
+];
export {
products,
-}
+};
diff --git a/p/cmta/index.js b/p/cmta/index.js
index 37947829..683a719f 100644
--- a/p/cmta/index.js
+++ b/p/cmta/index.js
@@ -1,10 +1,10 @@
// todo: use import assertions once they're supported by Node.js & ESLint
// https://github.com/tc39/proposal-import-assertions
-import {createRequire} from 'module'
-const require = createRequire(import.meta.url)
+import {createRequire} from 'module';
+const require = createRequire(import.meta.url);
-const baseProfile = require('./base.json')
-import {products} from './products.js'
+const baseProfile = require('./base.json');
+import {products} from './products.js';
const profile = {
...baseProfile,
@@ -19,8 +19,8 @@ const profile = {
refreshJourney: true,
reachableFrom: true,
remarks: true, // `.svcResL[0].res.msgL[]` is missing though 🤔
-}
+};
export {
profile,
-}
+};
diff --git a/p/cmta/products.js b/p/cmta/products.js
index a11e787d..877642b7 100644
--- a/p/cmta/products.js
+++ b/p/cmta/products.js
@@ -5,7 +5,7 @@ const products = [
bitmasks: [32],
name: 'MetroBus',
short: 'B',
- default: true
+ default: true,
},
{
id: 'rapid',
@@ -13,7 +13,7 @@ const products = [
bitmasks: [4096],
name: 'MetroRapid',
short: 'R',
- default: true
+ default: true,
},
{
id: 'rail',
@@ -21,10 +21,10 @@ const products = [
bitmasks: [8],
name: 'MetroRail',
short: 'M',
- default: true
- }
-]
+ default: true,
+ },
+];
export {
products,
-}
+};
diff --git a/p/dart/index.js b/p/dart/index.js
index a99faccf..e8c003aa 100644
--- a/p/dart/index.js
+++ b/p/dart/index.js
@@ -1,9 +1,9 @@
// todo: use import assertions once they're supported by Node.js & ESLint
// https://github.com/tc39/proposal-import-assertions
-import {createRequire} from 'module'
-const require = createRequire(import.meta.url)
+import {createRequire} from 'module';
+const require = createRequire(import.meta.url);
-const baseProfile = require('./base.json')
+const baseProfile = require('./base.json');
const products = [{
id: 'bus',
@@ -12,7 +12,7 @@ const products = [{
name: 'Bus',
short: 'Bus',
default: true,
-}]
+}];
const profile = {
...baseProfile,
@@ -25,8 +25,8 @@ const profile = {
trip: true,
reachableFrom: true,
radar: true,
-}
+};
export {
profile,
-}
+};
diff --git a/p/db-busradar-nrw/index.js b/p/db-busradar-nrw/index.js
index ecf3218e..c029c543 100644
--- a/p/db-busradar-nrw/index.js
+++ b/p/db-busradar-nrw/index.js
@@ -1,9 +1,9 @@
// todo: use import assertions once they're supported by Node.js & ESLint
// https://github.com/tc39/proposal-import-assertions
-import {createRequire} from 'module'
-const require = createRequire(import.meta.url)
+import {createRequire} from 'module';
+const require = createRequire(import.meta.url);
-const baseProfile = require('./base.json')
+const baseProfile = require('./base.json');
// DB Busradar NRW app does not allow selecting specific modes of transport to filter results,
// so the bitmasks had to be determined by querying some stations and looking at the results..
@@ -14,7 +14,7 @@ const products = [
bitmasks: [1],
name: 'InterCityExpress',
short: 'ICE',
- default: true
+ default: true,
},
{
id: 'national',
@@ -22,7 +22,7 @@ const products = [
bitmasks: [2],
name: 'InterCity & EuroCity',
short: 'IC/EC',
- default: true
+ default: true,
},
// todo: not always true when a station has RE stopping at it
// maybe something else?
@@ -32,7 +32,7 @@ const products = [
bitmasks: [4],
name: 'Regionalexpress',
short: 'RE',
- default: true
+ default: true,
},
// todo: also used for replacement service incl. S-Bahn replacement
{
@@ -41,7 +41,7 @@ const products = [
bitmasks: [8],
name: 'Regionalzug',
short: 'RB/RE',
- default: true
+ default: true,
},
{
id: 'suburban',
@@ -49,7 +49,7 @@ const products = [
bitmasks: [16],
name: 'S-Bahn',
short: 'S',
- default: true
+ default: true,
},
{
id: 'bus',
@@ -57,7 +57,7 @@ const products = [
bitmasks: [32],
name: 'Bus',
short: 'Bus',
- default: true
+ default: true,
},
{
id: 'ferry',
@@ -65,7 +65,7 @@ const products = [
bitmasks: [64],
name: 'Ferry',
short: 'F',
- default: true
+ default: true,
},
// todo: are `128` & `256` unused?
{
@@ -74,9 +74,9 @@ const products = [
bitmasks: [512],
name: 'AnrufSammelTaxi',
short: 'AST',
- default: true
- }
-]
+ default: true,
+ },
+];
const profile = {
...baseProfile,
@@ -91,8 +91,8 @@ const profile = {
radar: true,
remarks: true, // `.svcResL[0].res.msgL[]` is missing though 🤔
lines: false, // `.svcResL[0].res.lineL[]` is missing 🤔
-}
+};
export {
profile,
-}
+};
diff --git a/p/db/ageGroup.js b/p/db/ageGroup.js
index 40198ebf..ad79638a 100644
--- a/p/db/ageGroup.js
+++ b/p/db/ageGroup.js
@@ -9,26 +9,31 @@ const ageGroup = {
CHILD: 15,
YOUNG: 27,
ADULT: 65,
- SENIOR: Infinity
- }
-}
+ SENIOR: Infinity,
+ },
+};
const ageGroupFromAge = (age) => {
- const {upperBoundOf} = ageGroup
- if (age < upperBoundOf.BABY)
- return ageGroup.BABY
- if (age < upperBoundOf.CHILD)
- return ageGroup.CHILD
- if (age < upperBoundOf.YOUNG)
- return ageGroup.YOUNG
- if (age < upperBoundOf.ADULT)
- return ageGroup.ADULT
- if (age < upperBoundOf.SENIOR)
- return ageGroup.SENIOR
- throw new TypeError(`Invalid age '${age}'`)
-}
+ const {upperBoundOf} = ageGroup;
+ if (age < upperBoundOf.BABY) {
+ return ageGroup.BABY;
+ }
+ if (age < upperBoundOf.CHILD) {
+ return ageGroup.CHILD;
+ }
+ if (age < upperBoundOf.YOUNG) {
+ return ageGroup.YOUNG;
+ }
+ if (age < upperBoundOf.ADULT) {
+ return ageGroup.ADULT;
+ }
+ if (age < upperBoundOf.SENIOR) {
+ return ageGroup.SENIOR;
+ }
+ throw new TypeError(`Invalid age '${age}'`);
+};
export {
ageGroup,
ageGroupFromAge,
-}
+};
diff --git a/p/db/index.js b/p/db/index.js
index 865854e7..eaba8da5 100644
--- a/p/db/index.js
+++ b/p/db/index.js
@@ -1,70 +1,72 @@
// todo: use import assertions once they're supported by Node.js & ESLint
// https://github.com/tc39/proposal-import-assertions
-import {createRequire} from 'module'
-const require = createRequire(import.meta.url)
+import {createRequire} from 'module';
+const require = createRequire(import.meta.url);
-import trim from 'lodash/trim.js'
-import uniqBy from 'lodash/uniqBy.js'
-import slugg from 'slugg'
-import without from 'lodash/without.js'
-import {parseHook} from '../../lib/profile-hooks.js'
+import trim from 'lodash/trim.js';
+import uniqBy from 'lodash/uniqBy.js';
+import slugg from 'slugg';
+import without from 'lodash/without.js';
+import {parseHook} from '../../lib/profile-hooks.js';
-import {parseJourney as _parseJourney} from '../../parse/journey.js'
-import {parseJourneyLeg as _parseJourneyLeg} from '../../parse/journey-leg.js'
-import {parseLine as _parseLine} from '../../parse/line.js'
-import {parseArrival as _parseArrival} from '../../parse/arrival.js'
-import {parseDeparture as _parseDeparture} from '../../parse/departure.js'
-import {parseHint as _parseHint} from '../../parse/hint.js'
-import {parseLocation as _parseLocation} from '../../parse/location.js'
-import {formatStation as _formatStation} from '../../format/station.js'
-import {bike} from '../../format/filters.js'
+import {parseJourney as _parseJourney} from '../../parse/journey.js';
+import {parseJourneyLeg as _parseJourneyLeg} from '../../parse/journey-leg.js';
+import {parseLine as _parseLine} from '../../parse/line.js';
+import {parseArrival as _parseArrival} from '../../parse/arrival.js';
+import {parseDeparture as _parseDeparture} from '../../parse/departure.js';
+import {parseHint as _parseHint} from '../../parse/hint.js';
+import {parseLocation as _parseLocation} from '../../parse/location.js';
+import {formatStation as _formatStation} from '../../format/station.js';
+import {bike} from '../../format/filters.js';
-const baseProfile = require('./base.json')
-import {products} from './products.js'
-import {formatLoyaltyCard} from './loyalty-cards.js'
-import {ageGroup, ageGroupFromAge} from './ageGroup.js'
-import {routingModes} from './routing-modes.js'
+const baseProfile = require('./base.json');
+import {products} from './products.js';
+import {formatLoyaltyCard} from './loyalty-cards.js';
+import {ageGroup, ageGroupFromAge} from './ageGroup.js';
+import {routingModes} from './routing-modes.js';
const transformReqBody = (ctx, body) => {
- const req = body.svcReqL[0] || {}
+ const req = body.svcReqL[0] || {};
// see https://pastebin.com/qZ9WS3Cx
- const rtMode = ('routingMode' in ctx.opt) ? ctx.opt.routingMode : routingModes.REALTIME
+ const rtMode = 'routingMode' in ctx.opt
+ ? ctx.opt.routingMode
+ : routingModes.REALTIME;
req.cfg = {
...req.cfg,
rtMode,
- }
+ };
- return body
-}
+ return body;
+};
const transformReq = (ctx, req) => {
- const body = JSON.parse(req.body)
+ const body = JSON.parse(req.body);
// stop() a.k.a. LocDetails seems broken with ver >1.16, all other methods work
if (body.svcReqL[0].meth === 'LocDetails') {
req.body = JSON.stringify({
...body,
ver: '1.16',
- })
+ });
}
- return req
-}
+ return req;
+};
const slices = (n, arr) => {
- const initialState = {slices: [], count: Infinity}
+ const initialState = {slices: [], count: Infinity};
return arr.reduce(({slices, count}, item) => {
if (count >= n) {
- slices.push([item])
- count = 1
+ slices.push([item]);
+ count = 1;
} else {
- slices[slices.length - 1].push(item)
- count++
+ slices[slices.length - 1].push(item);
+ count++;
}
- return {slices, count}
- }, initialState).slices
-}
+ return {slices, count};
+ }, initialState).slices;
+};
const parseGrid = (g) => {
// todo: g.type, e.g. `S`
@@ -78,13 +80,12 @@ const parseGrid = (g) => {
// iterative process.
return {
title: g.title,
- rows: slices(g.nCols, g.itemL.map(item => (
- Array.isArray(item.hints) && item.hints[0] ||
- Array.isArray(item.remarkRefs) && item.remarkRefs[0] && item.remarkRefs[0].hint ||
- {}
- ))),
- }
-}
+ rows: slices(g.nCols, g.itemL.map(item => Array.isArray(item.hints) && item.hints[0]
+ || Array.isArray(item.remarkRefs) && item.remarkRefs[0] && item.remarkRefs[0].hint
+ || {},
+ )),
+ };
+};
const ausstattungKeys = Object.assign(Object.create(null), {
'3-s-zentrale': '3SZentrale',
@@ -96,115 +97,142 @@ const ausstattungKeys = Object.assign(Object.create(null), {
'reisebedarf': 'travelShop',
'stufenfreier-zugang': 'stepFreeAccess',
'ein-umsteigehilfe': 'boardingAid',
- 'taxi-am-bahnhof': 'taxis'
-})
+ 'taxi-am-bahnhof': 'taxis',
+});
const parseAusstattungVal = (val) => {
- val = val.toLowerCase()
- return val === 'ja' ? true : (val === 'nein' ? false : val)
-}
+ val = val.toLowerCase();
+ return val === 'ja'
+ ? true
+ : val === 'nein'
+ ? false
+ : val;
+};
const parseAusstattungGrid = (g) => {
// filter duplicate hint rows
- const rows = uniqBy(g.rows, ([key, val]) => key + ':' + val)
+ const rows = uniqBy(g.rows, ([key, val]) => key + ':' + val);
- const res = {}
- Object.defineProperty(res, 'raw', {value: rows})
+ const res = {};
+ Object.defineProperty(res, 'raw', {value: rows});
for (let [key, val] of rows) {
- key = ausstattungKeys[slugg(key)]
- if (key) res[key] = parseAusstattungVal(val)
+ key = ausstattungKeys[slugg(key)];
+ if (key) {
+ res[key] = parseAusstattungVal(val);
+ }
}
- return res
-}
+ return res;
+};
const parseReisezentrumÖffnungszeiten = (g) => {
- const res = {}
- for (const [dayOfWeek, val] of g.rows) res[dayOfWeek] = val
- res.raw = g.rows
- return res
-}
+ const res = {};
+ for (const [dayOfWeek, val] of g.rows) {
+ res[dayOfWeek] = val;
+ }
+ res.raw = g.rows;
+ return res;
+};
const parseLocWithDetails = ({parsed, common}, l) => {
- if (!parsed) return parsed
- if (parsed.type !== 'stop' && parsed.type !== 'station') return parsed
+ if (!parsed) {
+ return parsed;
+ }
+ if (parsed.type !== 'stop' && parsed.type !== 'station') {
+ return parsed;
+ }
if (Array.isArray(l.gridL)) {
const resolveCells = grid => ({
...grid,
rows: grid.rows.map(row => row.map(cell => cell && cell.text)),
- })
+ });
let grids = l.gridL
- .map(grid => parseGrid(grid, common))
- .map(resolveCells)
+ .map(grid => parseGrid(grid, common))
+ .map(resolveCells);
- const ausstattung = grids.find(g => slugg(g.title) === 'ausstattung')
+ const ausstattung = grids.find(g => slugg(g.title) === 'ausstattung');
if (ausstattung) {
- parsed.facilities = parseAusstattungGrid(ausstattung)
+ parsed.facilities = parseAusstattungGrid(ausstattung);
}
- const öffnungszeiten = grids.find(g => slugg(g.title) === 'offnungszeiten-reisezentrum')
+ const öffnungszeiten = grids.find(g => slugg(g.title) === 'offnungszeiten-reisezentrum');
if (öffnungszeiten) {
- parsed.reisezentrumOpeningHours = parseReisezentrumÖffnungszeiten(öffnungszeiten)
+ parsed.reisezentrumOpeningHours = parseReisezentrumÖffnungszeiten(öffnungszeiten);
}
- grids = without(grids, ausstattung, öffnungszeiten)
- if (grids.length > 0) parsed.grids = grids
+ grids = without(grids, ausstattung, öffnungszeiten);
+ if (grids.length > 0) {
+ parsed.grids = grids;
+ }
}
- return parsed
-}
+ return parsed;
+};
// https://www.bahn.de/p/view/service/buchung/auslastungsinformation.shtml
-const loadFactors = []
-loadFactors[1] = 'low-to-medium'
-loadFactors[2] = 'high'
-loadFactors[3] = 'very-high'
-loadFactors[4] = 'exceptionally-high'
+const loadFactors = [];
+loadFactors[1] = 'low-to-medium';
+loadFactors[2] = 'high';
+loadFactors[3] = 'very-high';
+loadFactors[4] = 'exceptionally-high';
const parseLoadFactor = (opt, tcocL, tcocX) => {
- const cls = opt.firstClass ? 'FIRST' : 'SECOND'
- const load = tcocX.map(i => tcocL[i]).find(lf => lf.c === cls)
- return load && loadFactors[load.r] || null
-}
+ const cls = opt.firstClass
+ ? 'FIRST'
+ : 'SECOND';
+ const load = tcocX.map(i => tcocL[i])
+ .find(lf => lf.c === cls);
+ return load && loadFactors[load.r] || null;
+};
const parseArrOrDepWithLoadFactor = ({parsed, res, opt}, d) => {
if (d.stbStop.dTrnCmpSX && Array.isArray(d.stbStop.dTrnCmpSX.tcocX)) {
- const load = parseLoadFactor(opt, res.common.tcocL || [], d.stbStop.dTrnCmpSX.tcocX)
- if (load) parsed.loadFactor = load
+ const load = parseLoadFactor(opt, res.common.tcocL || [], d.stbStop.dTrnCmpSX.tcocX);
+ if (load) {
+ parsed.loadFactor = load;
+ }
}
- return parsed
-}
+ return parsed;
+};
const transformJourneysQuery = ({opt}, query) => {
- const filters = query.jnyFltrL
- if (opt.bike) filters.push(bike)
-
- if (('age' in opt) && ('ageGroup' in opt)) {
- throw new TypeError(`\
-opt.age and opt.ageGroup are mutually exclusive.
-Pass in just opt.age, and the age group will calculated automatically.`)
+ const filters = query.jnyFltrL;
+ if (opt.bike) {
+ filters.push(bike);
}
- const tvlrAgeGroup = ('age' in opt) ? ageGroupFromAge(opt.age) : opt.ageGroup
+ if ('age' in opt && 'ageGroup' in opt) {
+ throw new TypeError(`\
+opt.age and opt.ageGroup are mutually exclusive.
+Pass in just opt.age, and the age group will calculated automatically.`);
+ }
+
+ const tvlrAgeGroup = 'age' in opt
+ ? ageGroupFromAge(opt.age)
+ : opt.ageGroup;
query.trfReq = {
// todo: what are these?
// "directESuiteCall": true,
// "rType": "DB-PE",
- jnyCl: opt.firstClass === true ? 1 : 2,
+ jnyCl: opt.firstClass === true
+ ? 1
+ : 2,
// todo [breaking]: support multiple travelers
tvlrProf: [{
type: tvlrAgeGroup || ageGroup.ADULT,
- ...(('age' in opt) ? {age: opt.age} : {}),
+ ...'age' in opt
+ ? {age: opt.age}
+ : {},
redtnCard: opt.loyaltyCard
? formatLoyaltyCard(opt.loyaltyCard)
- : null
+ : null,
}],
- cType: 'PK'
- }
+ cType: 'PK',
+ };
- return query
-}
+ return query;
+};
// todo: fix this
// line: {
@@ -219,19 +247,19 @@ Pass in just opt.age, and the age group will calculated automatically.`)
// }
const parseLineWithAdditionalName = ({parsed}, l) => {
if (l.nameS && ['bus', 'tram', 'ferry'].includes(l.product)) {
- parsed.name = l.nameS
+ parsed.name = l.nameS;
}
if (l.addName) {
- parsed.additionalName = parsed.name
- parsed.name = l.addName
+ parsed.additionalName = parsed.name;
+ parsed.name = l.addName;
}
- return parsed
-}
+ return parsed;
+};
// todo: sotRating, conSubscr, isSotCon, showARSLink, sotCtxt
// todo: conSubscr, showARSLink, useableTime
const parseJourneyWithPrice = ({parsed}, raw) => {
- parsed.price = null
+ parsed.price = null;
// todo: find cheapest, find discounts
// todo: write a parser like vbb-parse-ticket
// {
@@ -274,33 +302,35 @@ const parseJourneyWithPrice = ({parsed}, raw) => {
// }
// ]
if (
- raw.trfRes &&
- Array.isArray(raw.trfRes.fareSetL) &&
- raw.trfRes.fareSetL[0] &&
- Array.isArray(raw.trfRes.fareSetL[0].fareL) &&
- raw.trfRes.fareSetL[0].fareL[0]
+ raw.trfRes
+ && Array.isArray(raw.trfRes.fareSetL)
+ && raw.trfRes.fareSetL[0]
+ && Array.isArray(raw.trfRes.fareSetL[0].fareL)
+ && raw.trfRes.fareSetL[0].fareL[0]
) {
- const tariff = raw.trfRes.fareSetL[0].fareL[0]
+ const tariff = raw.trfRes.fareSetL[0].fareL[0];
if (tariff.price && tariff.price.amount >= 0) { // wat
parsed.price = {
amount: tariff.price.amount / 100,
currency: 'EUR',
- hint: null
- }
+ hint: null,
+ };
}
}
- return parsed
-}
+ return parsed;
+};
const parseJourneyLegWithLoadFactor = ({parsed, res, opt}, raw) => {
- const tcocX = raw.jny && raw.jny.dTrnCmpSX && raw.jny.dTrnCmpSX.tcocX
+ const tcocX = raw.jny && raw.jny.dTrnCmpSX && raw.jny.dTrnCmpSX.tcocX;
if (Array.isArray(tcocX) && Array.isArray(res.common.tcocL)) {
- const load = parseLoadFactor(opt, res.common.tcocL, tcocX)
- if (load) parsed.loadFactor = load
+ const load = parseLoadFactor(opt, res.common.tcocL, tcocX);
+ if (load) {
+ parsed.loadFactor = load;
+ }
}
- return parsed
-}
+ return parsed;
+};
// todo:
// [ { type: 'hint',
@@ -310,189 +340,189 @@ const hintsByCode = Object.assign(Object.create(null), {
fb: {
type: 'hint',
code: 'bicycle-conveyance',
- summary: 'bicycles conveyed'
+ summary: 'bicycles conveyed',
},
fr: {
type: 'hint',
code: 'bicycle-conveyance-reservation',
- summary: 'bicycles conveyed, subject to reservation'
+ summary: 'bicycles conveyed, subject to reservation',
},
nf: {
type: 'hint',
code: 'no-bicycle-conveyance',
- summary: 'bicycles not conveyed'
+ summary: 'bicycles not conveyed',
},
k2: {
type: 'hint',
code: '2nd-class-only',
- summary: '2. class only'
+ summary: '2. class only',
},
eh: {
type: 'hint',
code: 'boarding-ramp',
- summary: 'vehicle-mounted boarding ramp available'
+ summary: 'vehicle-mounted boarding ramp available',
},
ro: {
type: 'hint',
code: 'wheelchairs-space',
- summary: 'space for wheelchairs'
+ summary: 'space for wheelchairs',
},
oa: {
type: 'hint',
code: 'wheelchairs-space-reservation',
- summary: 'space for wheelchairs, subject to reservation'
+ summary: 'space for wheelchairs, subject to reservation',
},
wv: {
type: 'hint',
code: 'wifi',
- summary: 'WiFi available'
+ summary: 'WiFi available',
},
wi: {
type: 'hint',
code: 'wifi',
- summary: 'WiFi available'
+ summary: 'WiFi available',
},
sn: {
type: 'hint',
code: 'snacks',
- summary: 'snacks available for purchase'
+ summary: 'snacks available for purchase',
},
mb: {
type: 'hint',
code: 'snacks',
- summary: 'snacks available for purchase'
+ summary: 'snacks available for purchase',
},
mp: {
type: 'hint',
code: 'snacks',
- summary: 'snacks available for purchase at the seat'
+ summary: 'snacks available for purchase at the seat',
},
bf: {
type: 'hint',
code: 'barrier-free',
- summary: 'barrier-free'
+ summary: 'barrier-free',
},
rg: {
type: 'hint',
code: 'barrier-free-vehicle',
- summary: 'barrier-free vehicle'
+ summary: 'barrier-free vehicle',
},
bt: {
type: 'hint',
code: 'on-board-bistro',
- summary: 'Bordbistro available'
+ summary: 'Bordbistro available',
},
br: {
type: 'hint',
code: 'on-board-restaurant',
- summary: 'Bordrestaurant available'
+ summary: 'Bordrestaurant available',
},
ki: {
type: 'hint',
code: 'childrens-area',
- summary: `children's area available`
+ summary: 'children\'s area available',
},
kk: {
type: 'hint',
code: 'parents-childrens-compartment',
- summary: `parent-and-children compartment available`
+ summary: 'parent-and-children compartment available',
},
kr: {
type: 'hint',
code: 'kids-service',
- summary: 'DB Kids Service available'
+ summary: 'DB Kids Service available',
},
ls: {
type: 'hint',
code: 'power-sockets',
- summary: 'power sockets available'
+ summary: 'power sockets available',
},
ev: {
type: 'hint',
code: 'replacement-service',
- summary: 'replacement service'
+ summary: 'replacement service',
},
kl: {
type: 'hint',
code: 'air-conditioned',
- summary: 'air-conditioned vehicle'
+ summary: 'air-conditioned vehicle',
},
r0: {
type: 'hint',
code: 'upward-escalator',
- summary: 'upward escalator'
+ summary: 'upward escalator',
},
au: {
type: 'hint',
code: 'elevator',
- summary: 'elevator available'
+ summary: 'elevator available',
},
ck: {
type: 'hint',
code: 'komfort-checkin',
- summary: 'Komfort-Checkin available'
+ summary: 'Komfort-Checkin available',
},
it: {
type: 'hint',
code: 'ice-sprinter',
- summary: 'ICE Sprinter service'
+ summary: 'ICE Sprinter service',
},
rp: {
type: 'hint',
code: 'compulsory-reservation',
- summary: 'compulsory seat reservation'
+ summary: 'compulsory seat reservation',
},
rm: {
type: 'hint',
code: 'optional-reservation',
- summary: 'optional seat reservation'
+ summary: 'optional seat reservation',
},
scl: {
type: 'hint',
code: 'all-2nd-class-seats-reserved',
- summary: 'all 2nd class seats reserved'
+ summary: 'all 2nd class seats reserved',
},
acl: {
type: 'hint',
code: 'all-seats-reserved',
- summary: 'all seats reserved'
+ summary: 'all seats reserved',
},
sk: {
type: 'hint',
code: 'oversize-luggage-forbidden',
- summary: 'oversize luggage not allowed'
+ summary: 'oversize luggage not allowed',
},
hu: {
type: 'hint',
code: 'animals-forbidden',
- summary: 'animals not allowed, except guide dogs'
+ summary: 'animals not allowed, except guide dogs',
},
ik: {
type: 'hint',
code: 'baby-cot-required',
- summary: 'baby cot/child seat required'
+ summary: 'baby cot/child seat required',
},
ee: {
type: 'hint',
code: 'on-board-entertainment',
- summary: 'on-board entertainment available'
+ summary: 'on-board entertainment available',
},
toilet: {
type: 'hint',
code: 'toilet',
- summary: 'toilet available'
+ summary: 'toilet available',
},
oc: {
type: 'hint',
code: 'wheelchair-accessible-toilet',
- summary: 'wheelchair-accessible toilet available'
+ summary: 'wheelchair-accessible toilet available',
},
iz: {
type: 'hint',
code: 'intercity-2',
- summary: 'Intercity 2'
- }
-})
+ summary: 'Intercity 2',
+ },
+});
const codesByText = Object.assign(Object.create(null), {
'journey cancelled': 'journey-cancelled', // todo: German variant
@@ -501,34 +531,39 @@ const codesByText = Object.assign(Object.create(null), {
'signalstörung': 'signal-failure',
'additional stop': 'additional-stopover', // todo: German variant
'platform change': 'changed platform', // todo: use dash, German variant
-})
+});
const parseHintByCode = ({parsed}, raw) => {
// plain-text hints used e.g. for stop metadata
if (raw.type === 'K') {
- return {type: 'hint', text: raw.txtN}
+ return {type: 'hint', text: raw.txtN};
}
if (raw.type === 'A') {
- const hint = hintsByCode[raw.code && raw.code.trim().toLowerCase()]
+ const hint = hintsByCode[raw.code && raw.code.trim()
+ .toLowerCase()];
if (hint) {
- return Object.assign({text: raw.txtN}, hint)
+ return Object.assign({text: raw.txtN}, hint);
}
}
if (parsed && raw.txtN) {
- const text = trim(raw.txtN.toLowerCase(), ' ()')
- if (codesByText[text]) parsed.code = codesByText[text]
+ const text = trim(raw.txtN.toLowerCase(), ' ()');
+ if (codesByText[text]) {
+ parsed.code = codesByText[text];
+ }
}
- return parsed
-}
+ return parsed;
+};
-const isIBNR = /^\d{6,}$/
+const isIBNR = /^\d{6,}$/;
const formatStation = (id) => {
- if (!isIBNR.test(id)) throw new Error('station ID must be an IBNR.')
- return _formatStation(id)
-}
+ if (!isIBNR.test(id)) {
+ throw new Error('station ID must be an IBNR.');
+ }
+ return _formatStation(id);
+};
// todo: find option for absolute number of results
@@ -560,8 +595,8 @@ const profile = {
radar: true,
reachableFrom: true,
lines: false, // `.svcResL[0].res.lineL[]` is missing 🤔
-}
+};
export {
profile,
-}
+};
diff --git a/p/db/loyalty-cards.js b/p/db/loyalty-cards.js
index 3445c2f6..a727bb87 100644
--- a/p/db/loyalty-cards.js
+++ b/p/db/loyalty-cards.js
@@ -6,24 +6,46 @@ const c = {
HALBTAXABO: Symbol('HalbtaxAbo'),
VOORDEELURENABO: Symbol('Voordeelurenabo'),
SHCARD: Symbol('SH-Card'),
- GENERALABONNEMENT: Symbol('General-Abonnement')
-}
+ GENERALABONNEMENT: Symbol('General-Abonnement'),
+};
// see https://gist.github.com/juliuste/202bb04f450a79f8fa12a2ec3abcd72d
const formatLoyaltyCard = (data) => {
if (data.type === c.BAHNCARD) {
- if (data.discount === 25) return data.class === 1 ? 1 : 2
- if (data.discount === 50) return data.class === 1 ? 3 : 4
+ if (data.discount === 25) {
+ return data.class === 1
+ ? 1
+ : 2;
+ }
+ if (data.discount === 50) {
+ return data.class === 1
+ ? 3
+ : 4;
+ }
}
- if (data.type === c.VORTEILSCARD) return 9
- if (data.type === c.HALBTAXABO) return data.railplus ? 10 : 11
- if (data.type === c.VOORDEELURENABO) return data.railplus ? 12 : 13
- if (data.type === c.SHCARD) return 14
- if (data.type === c.GENERALABONNEMENT) return 15
- return 0
-}
+ if (data.type === c.VORTEILSCARD) {
+ return 9;
+ }
+ if (data.type === c.HALBTAXABO) {
+ return data.railplus
+ ? 10
+ : 11;
+ }
+ if (data.type === c.VOORDEELURENABO) {
+ return data.railplus
+ ? 12
+ : 13;
+ }
+ if (data.type === c.SHCARD) {
+ return 14;
+ }
+ if (data.type === c.GENERALABONNEMENT) {
+ return 15;
+ }
+ return 0;
+};
export {
c as data,
formatLoyaltyCard,
-}
+};
diff --git a/p/db/products.js b/p/db/products.js
index 219bad46..4e5f44d1 100644
--- a/p/db/products.js
+++ b/p/db/products.js
@@ -6,7 +6,7 @@ const products = [
bitmasks: [1],
name: 'InterCityExpress',
short: 'ICE',
- default: true
+ default: true,
},
{
id: 'national',
@@ -14,7 +14,7 @@ const products = [
bitmasks: [2],
name: 'InterCity & EuroCity',
short: 'IC/EC',
- default: true
+ default: true,
},
{
id: 'regionalExpress',
@@ -22,7 +22,7 @@ const products = [
bitmasks: [4],
name: 'RegionalExpress & InterRegio',
short: 'RE/IR',
- default: true
+ default: true,
},
{
id: 'regional',
@@ -30,7 +30,7 @@ const products = [
bitmasks: [8],
name: 'Regio',
short: 'RB',
- default: true
+ default: true,
},
{
id: 'suburban',
@@ -38,7 +38,7 @@ const products = [
bitmasks: [16],
name: 'S-Bahn',
short: 'S',
- default: true
+ default: true,
},
{
id: 'bus',
@@ -46,7 +46,7 @@ const products = [
bitmasks: [32],
name: 'Bus',
short: 'B',
- default: true
+ default: true,
},
{
id: 'ferry',
@@ -54,7 +54,7 @@ const products = [
bitmasks: [64],
name: 'Ferry',
short: 'F',
- default: true
+ default: true,
},
{
id: 'subway',
@@ -62,7 +62,7 @@ const products = [
bitmasks: [128],
name: 'U-Bahn',
short: 'U',
- default: true
+ default: true,
},
{
id: 'tram',
@@ -70,7 +70,7 @@ const products = [
bitmasks: [256],
name: 'Tram',
short: 'T',
- default: true
+ default: true,
},
{
id: 'taxi',
@@ -78,10 +78,10 @@ const products = [
bitmasks: [512],
name: 'Group Taxi',
short: 'Taxi',
- default: true
- }
-]
+ default: true,
+ },
+];
export {
products,
-}
+};
diff --git a/p/db/routing-modes.js b/p/db/routing-modes.js
index 5bafa4f3..b356ffeb 100644
--- a/p/db/routing-modes.js
+++ b/p/db/routing-modes.js
@@ -6,8 +6,8 @@ const routingModes = {
REALTIME: 'REALTIME',
SERVER_DEFAULT: 'SERVER_DEFAULT',
HYBRID: 'HYBRID',
-}
+};
export {
routingModes,
-}
+};
diff --git a/p/insa/index.js b/p/insa/index.js
index 882e6c6d..a95b6528 100644
--- a/p/insa/index.js
+++ b/p/insa/index.js
@@ -1,10 +1,10 @@
// todo: use import assertions once they're supported by Node.js & ESLint
// https://github.com/tc39/proposal-import-assertions
-import {createRequire} from 'module'
-const require = createRequire(import.meta.url)
+import {createRequire} from 'module';
+const require = createRequire(import.meta.url);
-const baseProfile = require('./base.json')
-import {products} from './products.js'
+const baseProfile = require('./base.json');
+import {products} from './products.js';
const profile = {
...baseProfile,
@@ -17,8 +17,8 @@ const profile = {
radar: true,
refreshJourneyUseOutReconL: true,
reachableFrom: true,
-}
+};
export {
profile,
-}
+};
diff --git a/p/insa/products.js b/p/insa/products.js
index 37edb087..9e972aa7 100644
--- a/p/insa/products.js
+++ b/p/insa/products.js
@@ -5,7 +5,7 @@ const products = [
bitmasks: [1],
name: 'InterCityExpress',
short: 'ICE',
- default: true
+ default: true,
},
{
id: 'national',
@@ -13,7 +13,7 @@ const products = [
bitmasks: [2],
name: 'InterCity & EuroCity',
short: 'IC/EC',
- default: true
+ default: true,
},
{
id: 'regional',
@@ -21,7 +21,7 @@ const products = [
bitmasks: [8],
name: 'RegionalExpress & RegionalBahn',
short: 'RE/RB',
- default: true
+ default: true,
},
{
id: 'suburban',
@@ -29,7 +29,7 @@ const products = [
bitmasks: [16],
name: 'S-Bahn',
short: 'S',
- default: true
+ default: true,
},
{
id: 'tram',
@@ -37,7 +37,7 @@ const products = [
bitmasks: [32],
name: 'Tram',
short: 'T',
- default: true
+ default: true,
},
{
id: 'bus',
@@ -45,7 +45,7 @@ const products = [
bitmasks: [64, 128],
name: 'Bus',
short: 'B',
- default: true
+ default: true,
},
{
id: 'tourismTrain',
@@ -53,10 +53,10 @@ const products = [
bitmasks: [256],
name: 'Tourism Train',
short: 'TT',
- default: true
- }
-]
+ default: true,
+ },
+];
export {
products,
-}
+};
diff --git a/p/invg/index.js b/p/invg/index.js
index aa5c3f45..f71b9caf 100644
--- a/p/invg/index.js
+++ b/p/invg/index.js
@@ -1,10 +1,10 @@
// todo: use import assertions once they're supported by Node.js & ESLint
// https://github.com/tc39/proposal-import-assertions
-import {createRequire} from 'module'
-const require = createRequire(import.meta.url)
+import {createRequire} from 'module';
+const require = createRequire(import.meta.url);
-const baseProfile = require('./base.json')
-import {products} from './products.js'
+const baseProfile = require('./base.json');
+import {products} from './products.js';
const profile = {
...baseProfile,
@@ -17,8 +17,8 @@ const profile = {
trip: true,
radar: true,
refreshJourney: true,
-}
+};
export {
profile,
-}
+};
diff --git a/p/invg/products.js b/p/invg/products.js
index ba954914..9672d67c 100644
--- a/p/invg/products.js
+++ b/p/invg/products.js
@@ -6,7 +6,7 @@ const products = [
bitmasks: [1, 16],
name: 'Bus',
short: 'Bus',
- default: true // the other `bus` has `false`
+ default: true, // the other `bus` has `false`
},
{
id: 'express-train',
@@ -14,7 +14,7 @@ const products = [
bitmasks: [2],
name: 'High-speed train',
short: 'Train',
- default: false
+ default: false,
},
{
id: 'regional-train',
@@ -22,7 +22,7 @@ const products = [
bitmasks: [4],
name: 'Regional train',
short: 'Train',
- default: false
+ default: false,
},
{
id: 'local-train',
@@ -30,7 +30,7 @@ const products = [
bitmasks: [8],
name: 'Nahverkehrszug',
short: 'Zug',
- default: true
+ default: true,
},
{
id: 'ferry',
@@ -38,7 +38,7 @@ const products = [
bitmasks: [32],
name: 'Ferry',
short: 'Ferry',
- default: false
+ default: false,
},
{
id: 'subway',
@@ -46,7 +46,7 @@ const products = [
bitmasks: [64],
name: 'Subway',
short: 'Subway',
- default: false
+ default: false,
},
{
id: 'tram',
@@ -54,7 +54,7 @@ const products = [
bitmasks: [128],
name: 'Tram',
short: 'Tram',
- default: false
+ default: false,
},
{
id: 'on-demand',
@@ -62,10 +62,10 @@ const products = [
bitmasks: [256],
name: 'On-demand traffic',
short: 'on demand',
- default: false
- }
-]
+ default: false,
+ },
+];
export {
products,
-}
+};
diff --git a/p/irish-rail/index.js b/p/irish-rail/index.js
index e41ade1f..3aa7bf19 100644
--- a/p/irish-rail/index.js
+++ b/p/irish-rail/index.js
@@ -1,10 +1,10 @@
// todo: use import assertions once they're supported by Node.js & ESLint
// https://github.com/tc39/proposal-import-assertions
-import {createRequire} from 'module'
-const require = createRequire(import.meta.url)
+import {createRequire} from 'module';
+const require = createRequire(import.meta.url);
-const baseProfile = require('./base.json')
-import {products} from './products.js'
+const baseProfile = require('./base.json');
+import {products} from './products.js';
const profile = {
...baseProfile,
@@ -19,8 +19,8 @@ const profile = {
refreshJourney: false, // fails with `CGI_READ_FAILED`
trip: true,
radar: true,
-}
+};
export {
profile,
-}
+};
diff --git a/p/irish-rail/products.js b/p/irish-rail/products.js
index 30f41335..334ba86d 100644
--- a/p/irish-rail/products.js
+++ b/p/irish-rail/products.js
@@ -5,7 +5,7 @@ const products = [
bitmasks: [2],
name: 'InterCity',
short: 'IC',
- default: true
+ default: true,
},
// todo: 4
{
@@ -14,7 +14,7 @@ const products = [
bitmasks: [8],
name: 'Commuter',
short: 'Commuter',
- default: true
+ default: true,
},
{
id: 'suburban',
@@ -22,7 +22,7 @@ const products = [
bitmasks: [16],
name: 'Dublin Area Rapid Transit',
short: 'DART',
- default: true
+ default: true,
},
// todo: 32
{
@@ -31,10 +31,10 @@ const products = [
bitmasks: [64],
name: 'LUAS Tram',
short: 'LUAS',
- default: true
- }
-]
+ default: true,
+ },
+];
export {
products,
-}
+};
diff --git a/p/ivb/index.js b/p/ivb/index.js
index 337a70dc..4d5fb5ba 100644
--- a/p/ivb/index.js
+++ b/p/ivb/index.js
@@ -1,11 +1,11 @@
// todo: use import assertions once they're supported by Node.js & ESLint
// https://github.com/tc39/proposal-import-assertions
-import {createRequire} from 'module'
-const require = createRequire(import.meta.url)
+import {createRequire} from 'module';
+const require = createRequire(import.meta.url);
-import {readFileSync} from 'fs'
-import {Agent} from 'https'
-const baseProfile = require('./base.json')
+import {readFileSync} from 'fs';
+import {Agent} from 'https';
+const baseProfile = require('./base.json');
const products = [{
id: 'train-and-s-bahn',
@@ -77,14 +77,14 @@ const products = [{
name: 'Anrufsammeltaxi',
short: 'AST',
default: true,
-}]
+}];
// `fahrplan.ivb.at:443` doesn't provide the necessary CA certificate chain for
// Node.js to trust the certificate, so we manually add it.
// todo: fix this properly, e.g. by letting them know
-const ca = readFileSync(new URL('./digicert-tls-rsa-sha256-2020-ca1.crt.pem', import.meta.url).pathname)
-const agent = new Agent({ca})
-const transformReq = (ctx, req) => ({...req, agent})
+const ca = readFileSync(new URL('./digicert-tls-rsa-sha256-2020-ca1.crt.pem', import.meta.url).pathname);
+const agent = new Agent({ca});
+const transformReq = (ctx, req) => ({...req, agent});
const profile = {
...baseProfile,
@@ -99,8 +99,8 @@ const profile = {
refreshJourneyUseOutReconL: true,
trip: true,
reachableFrom: true,
-}
+};
export {
profile,
-}
+};
diff --git a/p/kvb/index.js b/p/kvb/index.js
index f2103c85..45ef053b 100644
--- a/p/kvb/index.js
+++ b/p/kvb/index.js
@@ -1,11 +1,11 @@
// todo: use import assertions once they're supported by Node.js & ESLint
// https://github.com/tc39/proposal-import-assertions
-import {createRequire} from 'module'
-const require = createRequire(import.meta.url)
+import {createRequire} from 'module';
+const require = createRequire(import.meta.url);
-import {readFileSync} from 'fs'
-import {Agent} from 'https'
-const baseProfile = require('./base.json')
+import {readFileSync} from 'fs';
+import {Agent} from 'https';
+const baseProfile = require('./base.json');
const products = [{
id: 'stadtbahn',
@@ -49,14 +49,14 @@ const products = [{
name: 'Fernverkehr',
short: 'Fernverkehr',
default: true,
-}]
+}];
// `auskunft.kvb.koeln:443` doesn't provide the necessary CA certificate chain for
// Node.js to trust the certificate, so we manually add it.
// todo: fix this properly, e.g. by letting them know
-const ca = readFileSync(new URL('./thawte-rsa-ca-2018.pem', import.meta.url).pathname)
-const agent = new Agent({ca})
-const transformReq = (ctx, req) => ({...req, agent})
+const ca = readFileSync(new URL('./thawte-rsa-ca-2018.pem', import.meta.url).pathname);
+const agent = new Agent({ca});
+const transformReq = (ctx, req) => ({...req, agent});
const profile = {
...baseProfile,
@@ -69,8 +69,8 @@ const profile = {
refreshJourneyUseOutReconL: true,
trip: true,
reachableFrom: true,
-}
+};
export {
profile,
-}
+};
diff --git a/p/mobil-nrw/index.js b/p/mobil-nrw/index.js
index 8cf5fdb8..1877ccdc 100644
--- a/p/mobil-nrw/index.js
+++ b/p/mobil-nrw/index.js
@@ -1,10 +1,10 @@
// todo: use import assertions once they're supported by Node.js & ESLint
// https://github.com/tc39/proposal-import-assertions
-import {createRequire} from 'module'
-const require = createRequire(import.meta.url)
+import {createRequire} from 'module';
+const require = createRequire(import.meta.url);
-const baseProfile = require('./base.json')
-import {products} from './products.js'
+const baseProfile = require('./base.json');
+import {products} from './products.js';
const profile = {
...baseProfile,
@@ -18,8 +18,8 @@ const profile = {
reachableFrom: true,
refreshJourneyUseOutReconL: true,
remarks: true,
-}
+};
export {
profile,
-}
+};
diff --git a/p/mobil-nrw/products.js b/p/mobil-nrw/products.js
index 6f409190..f7afed38 100644
--- a/p/mobil-nrw/products.js
+++ b/p/mobil-nrw/products.js
@@ -72,9 +72,9 @@ const products = [
name: 'EC/IC',
short: 'EC/IC',
default: true,
- }
-]
+ },
+];
export {
products,
-}
+};
diff --git a/p/mobiliteit-lu/index.js b/p/mobiliteit-lu/index.js
index ea1847ca..24f61ec6 100644
--- a/p/mobiliteit-lu/index.js
+++ b/p/mobiliteit-lu/index.js
@@ -1,10 +1,10 @@
// todo: use import assertions once they're supported by Node.js & ESLint
// https://github.com/tc39/proposal-import-assertions
-import {createRequire} from 'module'
-const require = createRequire(import.meta.url)
+import {createRequire} from 'module';
+const require = createRequire(import.meta.url);
-const baseProfile = require('./base.json')
-import {products} from './products.js'
+const baseProfile = require('./base.json');
+import {products} from './products.js';
const profile = {
...baseProfile,
@@ -18,8 +18,8 @@ const profile = {
reachableFrom: true,
refreshJourneyUseOutReconL: true,
-}
+};
export {
profile,
-}
+};
diff --git a/p/mobiliteit-lu/products.js b/p/mobiliteit-lu/products.js
index 2602bce6..d1b1955f 100644
--- a/p/mobiliteit-lu/products.js
+++ b/p/mobiliteit-lu/products.js
@@ -5,7 +5,7 @@ const products = [
bitmasks: [1],
name: 'local train (TGV/ICE)',
short: 'TGV/ICE',
- default: true
+ default: true,
},
{
id: 'national-train',
@@ -13,7 +13,7 @@ const products = [
bitmasks: [2, 4],
name: 'national train (IC/RE/IRE)',
short: 'IC/RE/IRE',
- default: true
+ default: true,
},
{
id: 'local-train',
@@ -21,7 +21,7 @@ const products = [
bitmasks: [8],
name: 'local train (RB/TER)',
short: 'RB/TER',
- default: true
+ default: true,
},
{
id: 'bus',
@@ -29,7 +29,7 @@ const products = [
bitmasks: [32],
name: 'Bus',
short: 'Bus',
- default: true
+ default: true,
},
{
id: 'tram',
@@ -37,10 +37,10 @@ const products = [
bitmasks: [256],
name: 'Tram',
short: 'Tram',
- default: true
- }
-]
+ default: true,
+ },
+];
export {
products,
-}
+};
diff --git a/p/nahsh/index.js b/p/nahsh/index.js
index bfd528a2..2939b9aa 100644
--- a/p/nahsh/index.js
+++ b/p/nahsh/index.js
@@ -1,73 +1,77 @@
// todo: use import assertions once they're supported by Node.js & ESLint
// https://github.com/tc39/proposal-import-assertions
-import {createRequire} from 'module'
-const require = createRequire(import.meta.url)
+import {createRequire} from 'module';
+const require = createRequire(import.meta.url);
-import {parseHook} from '../../lib/profile-hooks.js'
+import {parseHook} from '../../lib/profile-hooks.js';
-import {parseLocation as _parseLocation} from '../../parse/location.js'
-import {parseJourney as _parseJourney} from '../../parse/journey.js'
-import {parseMovement as _parseMovement} from '../../parse/movement.js'
-const baseProfile = require('./base.json')
-import {products} from './products.js'
+import {parseLocation as _parseLocation} from '../../parse/location.js';
+import {parseJourney as _parseJourney} from '../../parse/journey.js';
+import {parseMovement as _parseMovement} from '../../parse/movement.js';
+const baseProfile = require('./base.json');
+import {products} from './products.js';
// todo: journey prices
const fixLocation = ({parsed}, l) => {
// weird fix for empty lines, e.g. IC/EC at Flensburg Hbf
if (parsed.lines) {
- parsed.lines = parsed.lines.filter(x => x.id && x.name)
+ parsed.lines = parsed.lines.filter(x => x.id && x.name);
}
// remove leading zeroes, todo
if (parsed.id && parsed.id.length > 0) {
- parsed.id = parsed.id.replace(/^0+/, '')
+ parsed.id = parsed.id.replace(/^0+/, '');
}
- return parsed
-}
+ return parsed;
+};
const parseJourneyWithTickets = ({parsed}, j) => {
if (
- j.trfRes &&
- Array.isArray(j.trfRes.fareSetL) &&
- j.trfRes.fareSetL.length > 0
+ j.trfRes
+ && Array.isArray(j.trfRes.fareSetL)
+ && j.trfRes.fareSetL.length > 0
) {
- parsed.tickets = []
+ parsed.tickets = [];
for (let t of j.trfRes.fareSetL) {
- const tariff = t.desc
- if (!tariff || !Array.isArray(t.fareL)) continue
+ const tariff = t.desc;
+ if (!tariff || !Array.isArray(t.fareL)) {
+ continue;
+ }
for (let v of t.fareL) {
- const variant = v.name
- if(!variant) continue
+ const variant = v.name;
+ if (!variant) {
+ continue;
+ }
const ticket = {
name: [tariff, variant].join(' - '),
tariff,
- variant
- }
+ variant,
+ };
if (v.prc && Number.isInteger(v.prc) && v.cur) {
- ticket.amount = v.prc/100
- ticket.currency = v.cur
+ ticket.amount = v.prc / 100;
+ ticket.currency = v.cur;
} else {
- ticket.amount = null
- ticket.hint = 'No pricing information available.'
+ ticket.amount = null;
+ ticket.hint = 'No pricing information available.';
}
- parsed.tickets.push(ticket)
+ parsed.tickets.push(ticket);
}
}
}
- return parsed
-}
+ return parsed;
+};
const fixMovement = ({parsed}, m) => {
// filter out empty nextStopovers entries
parsed.nextStopovers = parsed.nextStopovers.filter((f) => {
- return f.stop !== null || f.arrival !== null || f.departure !== null
- })
- return parsed
-}
+ return f.stop !== null || f.arrival !== null || f.departure !== null;
+ });
+ return parsed;
+};
const profile = {
...baseProfile,
@@ -84,8 +88,8 @@ const profile = {
trip: true,
radar: true,
reachableFrom: true,
-}
+};
export {
profile,
-}
+};
diff --git a/p/nahsh/products.js b/p/nahsh/products.js
index 07d5e36c..ddfa7ddb 100644
--- a/p/nahsh/products.js
+++ b/p/nahsh/products.js
@@ -5,7 +5,7 @@ const products = [
bitmasks: [1],
name: 'High-speed rail',
short: 'ICE/HSR',
- default: true
+ default: true,
},
{
id: 'national',
@@ -13,7 +13,7 @@ const products = [
bitmasks: [2],
name: 'InterCity & EuroCity',
short: 'IC/EC',
- default: true
+ default: true,
},
{ // todo: also includes EN?
id: 'interregional',
@@ -21,7 +21,7 @@ const products = [
bitmasks: [4],
name: 'Interregional',
short: 'IR',
- default: true
+ default: true,
},
{
id: 'regional',
@@ -29,7 +29,7 @@ const products = [
bitmasks: [8],
name: 'Regional & RegionalExpress',
short: 'RB/RE',
- default: true
+ default: true,
},
{
id: 'suburban',
@@ -37,7 +37,7 @@ const products = [
bitmasks: [16],
name: 'S-Bahn',
short: 'S',
- default: true
+ default: true,
},
{
id: 'bus',
@@ -45,7 +45,7 @@ const products = [
bitmasks: [32],
name: 'Bus',
short: 'B',
- default: true
+ default: true,
},
{
id: 'ferry',
@@ -53,7 +53,7 @@ const products = [
bitmasks: [64],
name: 'Ferry',
short: 'F',
- default: true
+ default: true,
},
{
id: 'subway',
@@ -61,7 +61,7 @@ const products = [
bitmasks: [128],
name: 'U-Bahn',
short: 'U',
- default: true
+ default: true,
},
{
id: 'tram',
@@ -69,7 +69,7 @@ const products = [
bitmasks: [256],
name: 'Tram',
short: 'T',
- default: true
+ default: true,
},
{
id: 'onCall',
@@ -77,10 +77,10 @@ const products = [
bitmasks: [512],
name: 'On-call transit',
short: 'on-call',
- default: true
- }
-]
+ default: true,
+ },
+];
export {
products,
-}
+};
diff --git a/p/nvv/index.js b/p/nvv/index.js
index ea253934..53538dcd 100644
--- a/p/nvv/index.js
+++ b/p/nvv/index.js
@@ -1,10 +1,10 @@
// todo: use import assertions once they're supported by Node.js & ESLint
// https://github.com/tc39/proposal-import-assertions
-import {createRequire} from 'module'
-const require = createRequire(import.meta.url)
+import {createRequire} from 'module';
+const require = createRequire(import.meta.url);
-const baseProfile = require('./base.json')
-import {products} from './products.js'
+const baseProfile = require('./base.json');
+import {products} from './products.js';
const profile = {
...baseProfile,
@@ -17,8 +17,8 @@ const profile = {
trip: true,
radar: true,
reachableFrom: true,
-}
+};
export {
profile,
-}
+};
diff --git a/p/nvv/products.js b/p/nvv/products.js
index 0b7137d6..14b6b0a6 100644
--- a/p/nvv/products.js
+++ b/p/nvv/products.js
@@ -6,7 +6,7 @@ const products = [
bitmasks: [1],
name: 'InterCityExpress',
short: 'ICE',
- default: true
+ default: true,
},
{
id: 'national',
@@ -14,7 +14,7 @@ const products = [
bitmasks: [2],
name: 'EuroCity/InterCity',
short: 'EC/IC',
- default: true
+ default: true,
},
{
id: 'regional',
@@ -22,7 +22,7 @@ const products = [
bitmasks: [4],
name: 'Regionalzug',
short: 'RE/RB',
- default: true
+ default: true,
},
{
id: 'regiotram',
@@ -30,7 +30,7 @@ const products = [
bitmasks: [1024, 16, 8], // it is `1048` actually
name: 'RegioTram',
short: 'RegioTram',
- default: true
+ default: true,
},
{
id: 'tram',
@@ -38,7 +38,7 @@ const products = [
bitmasks: [4, 32],
name: 'Tram',
short: 'Tram',
- default: true
+ default: true,
},
{
id: 'bus',
@@ -46,7 +46,7 @@ const products = [
bitmasks: [128, 64], // it is `192` actually
name: 'Bus',
short: 'Bus',
- default: true
+ default: true,
},
{
id: 'on-call',
@@ -54,10 +54,10 @@ const products = [
bitmasks: [512],
name: 'AnrufSammelTaxi',
short: 'Sammeltaxi',
- default: true
- }
-]
+ default: true,
+ },
+];
export {
products,
-}
+};
diff --git a/p/oebb/index.js b/p/oebb/index.js
index 9736ada1..1c2b52c0 100644
--- a/p/oebb/index.js
+++ b/p/oebb/index.js
@@ -1,50 +1,52 @@
// todo: use import assertions once they're supported by Node.js & ESLint
// https://github.com/tc39/proposal-import-assertions
-import {createRequire} from 'module'
-const require = createRequire(import.meta.url)
+import {createRequire} from 'module';
+const require = createRequire(import.meta.url);
// todo: https://gist.github.com/anonymous/a5fc856bc80ae7364721943243f934f4#file-haf_config_base-properties-L5
// todo: https://gist.github.com/anonymous/a5fc856bc80ae7364721943243f934f4#file-haf_config_base-properties-L47-L234
-import {parseHook} from '../../lib/profile-hooks.js'
+import {parseHook} from '../../lib/profile-hooks.js';
-import {parseLocation as _parseLocation} from '../../parse/location.js'
-import {parseMovement as _parseMovement} from '../../parse/movement.js'
-const baseProfile = require('./base.json')
-import {products} from './products.js'
+import {parseLocation as _parseLocation} from '../../parse/location.js';
+import {parseMovement as _parseMovement} from '../../parse/movement.js';
+const baseProfile = require('./base.json');
+import {products} from './products.js';
// ÖBB has some 'stations' **in austria** with no departures/products,
// like station entrances, that are actually POIs.
const fixWeirdPOIs = ({parsed}) => {
if (
- (parsed.type === 'station' || parsed.type === 'stop') &&
- !parsed.products &&
- parsed.name &&
- parsed.id && parsed.id.length !== 7
+ (parsed.type === 'station' || parsed.type === 'stop')
+ && !parsed.products
+ && parsed.name
+ && parsed.id && parsed.id.length !== 7
) {
return Object.assign({
type: 'location',
id: parsed.id,
poi: true,
- name: parsed.name
- }, parsed.location)
+ name: parsed.name,
+ }, parsed.location);
}
- return parsed
-}
+ return parsed;
+};
const fixMovement = ({parsed}, m) => {
// filter out POIs
// todo: make use of them, as some of them specify fare zones
parsed.nextStopovers = parsed.nextStopovers.filter(st => {
- let s = st.stop || {}
- if (s.station) s = s.station
- return s.type === 'stop' || s.type === 'station'
- })
+ let s = st.stop || {};
+ if (s.station) {
+ s = s.station;
+ }
+ return s.type === 'stop' || s.type === 'station';
+ });
parsed.frames = parsed.frames.filter((f) => {
- return f.origin.type !== 'location' && f.destination.type !== 'location'
- })
- return parsed
-}
+ return f.origin.type !== 'location' && f.destination.type !== 'location';
+ });
+ return parsed;
+};
const profile = {
...baseProfile,
@@ -62,8 +64,8 @@ const profile = {
radar: true,
reachableFrom: true,
// lines: false, // `.svcResL[0].res.lineL[]` is missing 🤔
-}
+};
export {
profile,
-}
+};
diff --git a/p/oebb/products.js b/p/oebb/products.js
index f2fd6708..0271cd53 100644
--- a/p/oebb/products.js
+++ b/p/oebb/products.js
@@ -5,7 +5,7 @@ const products = [
bitmasks: [1],
name: 'InterCityExpress & RailJet',
short: 'ICE/RJ',
- default: true
+ default: true,
},
{
id: 'national',
@@ -13,7 +13,7 @@ const products = [
bitmasks: [2, 4],
name: 'InterCity & EuroCity',
short: 'IC/EC',
- default: true
+ default: true,
},
{
id: 'interregional',
@@ -21,7 +21,7 @@ const products = [
bitmasks: [8, 4096],
name: 'Durchgangszug & EuroNight',
short: 'D/EN',
- default: true
+ default: true,
},
{
id: 'regional',
@@ -29,7 +29,7 @@ const products = [
bitmasks: [16],
name: 'Regional & RegionalExpress',
short: 'R/REX',
- default: true
+ default: true,
},
{
id: 'suburban',
@@ -37,7 +37,7 @@ const products = [
bitmasks: [32],
name: 'S-Bahn',
short: 'S',
- default: true
+ default: true,
},
{
id: 'bus',
@@ -45,7 +45,7 @@ const products = [
bitmasks: [64],
name: 'Bus',
short: 'B',
- default: true
+ default: true,
},
{
id: 'ferry',
@@ -53,7 +53,7 @@ const products = [
bitmasks: [128],
name: 'Ferry',
short: 'F',
- default: true
+ default: true,
},
{
id: 'subway',
@@ -61,7 +61,7 @@ const products = [
bitmasks: [256],
name: 'U-Bahn',
short: 'U',
- default: true
+ default: true,
},
{
id: 'tram',
@@ -69,7 +69,7 @@ const products = [
bitmasks: [512],
name: 'Tram',
short: 'T',
- default: true
+ default: true,
},
{
id: 'onCall',
@@ -77,10 +77,10 @@ const products = [
bitmasks: [2048],
name: 'on-call transit, lifts, etc',
short: 'on-call/lift',
- default: true
- }
-]
+ default: true,
+ },
+];
export {
products,
-}
+};
diff --git a/p/ooevv/index.js b/p/ooevv/index.js
index dfc8ab32..de1786ef 100644
--- a/p/ooevv/index.js
+++ b/p/ooevv/index.js
@@ -1,9 +1,9 @@
// todo: use import assertions once they're supported by Node.js & ESLint
// https://github.com/tc39/proposal-import-assertions
-import {createRequire} from 'module'
-const require = createRequire(import.meta.url)
+import {createRequire} from 'module';
+const require = createRequire(import.meta.url);
-const baseProfile = require('./base.json')
+const baseProfile = require('./base.json');
const products = [{
id: 'train-and-s-bahn',
@@ -75,7 +75,7 @@ const products = [{
name: 'Anrufsammeltaxi',
short: 'AST',
default: true,
-}]
+}];
const profile = {
...baseProfile,
@@ -96,8 +96,8 @@ const profile = {
refreshJourneyUseOutReconL: true,
trip: true,
reachableFrom: true,
-}
+};
export {
profile,
-}
+};
diff --git a/p/pkp/index.js b/p/pkp/index.js
index fdc31830..5a0c4949 100644
--- a/p/pkp/index.js
+++ b/p/pkp/index.js
@@ -1,20 +1,20 @@
// todo: use import assertions once they're supported by Node.js & ESLint
// https://github.com/tc39/proposal-import-assertions
-import {createRequire} from 'module'
-const require = createRequire(import.meta.url)
+import {createRequire} from 'module';
+const require = createRequire(import.meta.url);
-import {parseHook} from '../../lib/profile-hooks.js'
+import {parseHook} from '../../lib/profile-hooks.js';
-import {parseLocation} from '../../parse/location.js'
-const baseProfile = require('./base.json')
-import {products} from './products.js'
+import {parseLocation} from '../../parse/location.js';
+const baseProfile = require('./base.json');
+import {products} from './products.js';
const trimStopName = ({parsed}, l) => {
if (parsed.type === 'stop' || parsed.type === 'station' && parsed.name) {
- parsed.name = parsed.name.replace(/(^-|-$)/g, '')
+ parsed.name = parsed.name.replace(/(^-|-$)/g, '');
}
- return parsed
-}
+ return parsed;
+};
const profile = {
...baseProfile,
@@ -30,8 +30,8 @@ const profile = {
refreshJourney: false,
reachableFrom: true,
remarks: false, // seems like ver >= 1.20 is required
-}
+};
export {
profile,
-}
+};
diff --git a/p/pkp/products.js b/p/pkp/products.js
index 6b109d02..22ca2b0f 100644
--- a/p/pkp/products.js
+++ b/p/pkp/products.js
@@ -5,7 +5,7 @@ const products = [
bitmasks: [1, 2],
name: 'ExpressInterCity & ExpressInterCity Premium & InterCityExpress',
short: 'EIC/EIP/ICE',
- default: true
+ default: true,
},
{
id: 'long-distance-train',
@@ -13,7 +13,7 @@ const products = [
bitmasks: [4],
name: 'InterCity & Twoje Linie Kolejowe & EuroCity & EuroNight',
short: 'IC/TLK/EC/EN',
- default: true
+ default: true,
},
{
id: 'regional-train',
@@ -21,7 +21,7 @@ const products = [
bitmasks: [8],
name: 'Regional',
short: 'R',
- default: true
+ default: true,
},
{
id: 'bus',
@@ -29,10 +29,10 @@ const products = [
bitmasks: [32],
name: 'Bus',
short: 'B',
- default: true
- }
-]
+ default: true,
+ },
+];
export {
products,
-}
+};
diff --git a/p/rejseplanen/index.js b/p/rejseplanen/index.js
index 4f46dc2c..4cad30b9 100644
--- a/p/rejseplanen/index.js
+++ b/p/rejseplanen/index.js
@@ -1,10 +1,10 @@
// todo: use import assertions once they're supported by Node.js & ESLint
// https://github.com/tc39/proposal-import-assertions
-import {createRequire} from 'module'
-const require = createRequire(import.meta.url)
+import {createRequire} from 'module';
+const require = createRequire(import.meta.url);
-const baseProfile = require('./base.json')
-import {products} from './products.js'
+const baseProfile = require('./base.json');
+import {products} from './products.js';
const profile = {
...baseProfile,
@@ -16,8 +16,8 @@ const profile = {
refreshJourneyUseOutReconL: true,
trip: true,
radar: true,
-}
+};
export {
profile,
-}
+};
diff --git a/p/rejseplanen/products.js b/p/rejseplanen/products.js
index 8c7ba9cc..297785c4 100644
--- a/p/rejseplanen/products.js
+++ b/p/rejseplanen/products.js
@@ -38,9 +38,9 @@ const products = [
name: 'S-Tog A/B/Bx/C/E/F/H',
short: 'S',
default: true,
- }
-]
+ },
+];
export {
products,
-}
+};
diff --git a/p/rmv/index.js b/p/rmv/index.js
index c61455b4..ddbeb5b0 100644
--- a/p/rmv/index.js
+++ b/p/rmv/index.js
@@ -1,10 +1,10 @@
// todo: use import assertions once they're supported by Node.js & ESLint
// https://github.com/tc39/proposal-import-assertions
-import {createRequire} from 'module'
-const require = createRequire(import.meta.url)
+import {createRequire} from 'module';
+const require = createRequire(import.meta.url);
-const baseProfile = require('./base.json')
-import {products} from './products.js'
+const baseProfile = require('./base.json');
+import {products} from './products.js';
const profile = {
...baseProfile,
@@ -18,8 +18,8 @@ const profile = {
radar: true,
refreshJourney: true,
reachableFrom: true,
-}
+};
export {
profile,
-}
+};
diff --git a/p/rmv/products.js b/p/rmv/products.js
index f9adbab2..8121bf47 100644
--- a/p/rmv/products.js
+++ b/p/rmv/products.js
@@ -5,7 +5,7 @@ const products = [
bitmasks: [1],
name: 'InterCityExpress/Fernzug',
short: 'ICE',
- default: true
+ default: true,
},
{
id: 'long-distance-train',
@@ -13,7 +13,7 @@ const products = [
bitmasks: [2],
name: 'EuroCity/InterCity/EuroNight/InterRegio',
short: 'EC/IC/EN/IR',
- default: true
+ default: true,
},
{
id: 'regiona-train',
@@ -21,7 +21,7 @@ const products = [
bitmasks: [4],
name: 'RegionalExpress/Regionalbahn',
short: 'RE/RB',
- default: true
+ default: true,
},
{
id: 's-bahn',
@@ -29,7 +29,7 @@ const products = [
bitmasks: [8],
name: 'S-Bahn',
short: 'S',
- default: true
+ default: true,
},
{
id: 'u-bahn',
@@ -37,7 +37,7 @@ const products = [
bitmasks: [16],
name: 'U-Bahn',
short: 'U',
- default: true
+ default: true,
},
{
id: 'tram',
@@ -45,7 +45,7 @@ const products = [
bitmasks: [32],
name: 'Straßenbahn',
short: 'Tram',
- default: true
+ default: true,
},
{
id: 'bus',
@@ -53,7 +53,7 @@ const products = [
bitmasks: [64, 128],
name: 'Bus',
short: 'Bus',
- default: true
+ default: true,
},
{
id: 'watercraft',
@@ -61,7 +61,7 @@ const products = [
bitmasks: [256],
name: 'Schiff',
short: 'Schiff',
- default: true
+ default: true,
},
{
id: 'ast',
@@ -69,7 +69,7 @@ const products = [
bitmasks: [512],
name: 'Anruf-Sammel-Taxi',
short: 'AST',
- default: true
+ default: true,
},
{
id: 'cable-car',
@@ -77,11 +77,11 @@ const products = [
bitmasks: [1024],
name: 'Seilbahn',
short: 'Seilbahn',
- default: true
- }
+ default: true,
+ },
// todo: remaining bitmask `1015`
-]
+];
export {
products,
-}
+};
diff --git a/p/rsag/index.js b/p/rsag/index.js
index f3eba7ad..8b787d05 100644
--- a/p/rsag/index.js
+++ b/p/rsag/index.js
@@ -1,10 +1,10 @@
// todo: use import assertions once they're supported by Node.js & ESLint
// https://github.com/tc39/proposal-import-assertions
-import {createRequire} from 'module'
-const require = createRequire(import.meta.url)
+import {createRequire} from 'module';
+const require = createRequire(import.meta.url);
-const baseProfile = require('./base.json')
-import {products} from './products.js'
+const baseProfile = require('./base.json');
+import {products} from './products.js';
const profile = {
...baseProfile,
@@ -17,8 +17,8 @@ const profile = {
radar: true,
reachableFrom: true,
refreshJourneyUseOutReconL: true,
-}
+};
export {
profile,
-}
+};
diff --git a/p/rsag/products.js b/p/rsag/products.js
index ba9d431d..fa764d11 100644
--- a/p/rsag/products.js
+++ b/p/rsag/products.js
@@ -5,7 +5,7 @@ const products = [
bitmasks: [1],
name: 'InterCityExpress',
short: 'ICE',
- default: true
+ default: true,
},
{
id: 'ic-ec',
@@ -13,7 +13,7 @@ const products = [
bitmasks: [2],
name: 'InterCity & EuroCity',
short: 'IC/EC',
- default: true
+ default: true,
},
{
id: 'long-distance-train',
@@ -21,7 +21,7 @@ const products = [
bitmasks: [4],
name: 'InterRegio/high-speed train',
short: 'IR/other',
- default: true
+ default: true,
},
{
id: 'regional-train', // todo: rename
@@ -29,7 +29,7 @@ const products = [
bitmasks: [8],
name: 'regional train',
short: 'RE/RB',
- default: true
+ default: true,
},
{
id: 's-bahn',
@@ -37,7 +37,7 @@ const products = [
bitmasks: [16],
name: 'S-Bahn',
short: 'S',
- default: true
+ default: true,
},
{
id: 'bus',
@@ -45,7 +45,7 @@ const products = [
bitmasks: [32],
name: 'Bus',
short: 'B',
- default: true
+ default: true,
},
{
id: 'ferry',
@@ -53,7 +53,7 @@ const products = [
bitmasks: [64],
name: 'Schiff',
short: 'F',
- default: true
+ default: true,
},
{
id: 'u-bahn',
@@ -61,7 +61,7 @@ const products = [
bitmasks: [128],
name: 'U-Bahn',
short: 'U',
- default: true
+ default: true,
},
{
id: 'tram',
@@ -69,7 +69,7 @@ const products = [
bitmasks: [256],
name: 'Tram',
short: 'T',
- default: true
+ default: true,
},
{
id: 'on-call',
@@ -77,10 +77,10 @@ const products = [
bitmasks: [512],
name: 'Taxi/on-call vehicle',
short: 'AST',
- default: true
- }
-]
+ default: true,
+ },
+];
export {
products,
-}
+};
diff --git a/p/saarfahrplan/index.js b/p/saarfahrplan/index.js
index 39fdc09f..02b1093f 100644
--- a/p/saarfahrplan/index.js
+++ b/p/saarfahrplan/index.js
@@ -1,19 +1,19 @@
// todo: use import assertions once they're supported by Node.js & ESLint
// https://github.com/tc39/proposal-import-assertions
-import {createRequire} from 'module'
-const require = createRequire(import.meta.url)
+import {createRequire} from 'module';
+const require = createRequire(import.meta.url);
-import {parseHook} from '../../lib/profile-hooks.js'
+import {parseHook} from '../../lib/profile-hooks.js';
-import {parseMovement as _parseMovement} from '../../parse/movement.js'
-const baseProfile = require('./base.json')
-import {products} from './products.js'
+import {parseMovement as _parseMovement} from '../../parse/movement.js';
+const baseProfile = require('./base.json');
+import {products} from './products.js';
const fixMovement = ({parsed}, m) => {
// filter out empty stopovers
- parsed.nextStopovers = parsed.nextStopovers.filter(st => !!st.stop)
- return parsed
-}
+ parsed.nextStopovers = parsed.nextStopovers.filter(st => Boolean(st.stop));
+ return parsed;
+};
const profile = {
...baseProfile,
@@ -29,9 +29,9 @@ const profile = {
refreshJourneyUseOutReconL: true,
trip: true,
radar: true,
- reachableFrom: true
-}
+ reachableFrom: true,
+};
export {
profile,
-}
+};
diff --git a/p/saarfahrplan/products.js b/p/saarfahrplan/products.js
index d1bd2238..4dc0e6dc 100644
--- a/p/saarfahrplan/products.js
+++ b/p/saarfahrplan/products.js
@@ -5,7 +5,7 @@ const products = [
bitmasks: [8192],
name: 'Hochgeschwindigkeitszug',
short: 'ICE',
- default: true
+ default: true,
},
{
id: 'national',
@@ -13,7 +13,7 @@ const products = [
bitmasks: [4096],
name: 'InterCity & EuroCity',
short: 'IC/EC',
- default: true
+ default: true,
},
{
id: 'interregional',
@@ -21,7 +21,7 @@ const products = [
bitmasks: [2048],
name: 'InterRegio',
short: 'IR',
- default: true
+ default: true,
},
{
id: 'regional',
@@ -29,7 +29,7 @@ const products = [
bitmasks: [1024],
name: 'Regionalzug',
short: 'RB ?', // todo
- default: true
+ default: true,
},
{
id: 'suburban',
@@ -37,7 +37,7 @@ const products = [
bitmasks: [512],
name: 'S-Bahn',
short: 'S-Bahn',
- default: true
+ default: true,
},
{
id: 'subway',
@@ -45,7 +45,7 @@ const products = [
bitmasks: [256],
name: 'U-Bahn',
short: 'U',
- default: true
+ default: true,
},
{
id: 'saarbahn',
@@ -53,7 +53,7 @@ const products = [
bitmasks: [128],
name: 'Saarbahn',
short: 'S',
- default: true
+ default: true,
},
{
id: 'bus',
@@ -61,7 +61,7 @@ const products = [
bitmasks: [64],
name: 'Bus',
short: 'Bus',
- default: true
+ default: true,
},
{
id: 'watercraft',
@@ -69,7 +69,7 @@ const products = [
bitmasks: [32], // todo: correct?
name: 'Schiff',
short: 'Schiff',
- default: true
+ default: true,
},
{
id: 'onCall',
@@ -77,7 +77,7 @@ const products = [
bitmasks: [16],
name: 'Anruf-Sammel-Taxi',
short: 'AST',
- default: true
+ default: true,
},
{
id: 'school-bus',
@@ -85,11 +85,11 @@ const products = [
bitmasks: [8],
name: 'Schulbus',
short: 'Schulbus',
- default: true
- }
+ default: true,
+ },
// todo: `1`, `2`, `4` bitmasks?
-]
+];
export {
products,
-}
+};
diff --git a/p/salzburg/index.js b/p/salzburg/index.js
index 9d949143..fdc48663 100644
--- a/p/salzburg/index.js
+++ b/p/salzburg/index.js
@@ -1,9 +1,9 @@
// todo: use import assertions once they're supported by Node.js & ESLint
// https://github.com/tc39/proposal-import-assertions
-import {createRequire} from 'module'
-const require = createRequire(import.meta.url)
+import {createRequire} from 'module';
+const require = createRequire(import.meta.url);
-const baseProfile = require('./base.json')
+const baseProfile = require('./base.json');
const products = [{
id: 'train-and-s-bahn',
@@ -75,7 +75,7 @@ const products = [{
name: 'Anrufsammeltaxi',
short: 'AST',
default: true,
-}]
+}];
const profile = {
...baseProfile,
@@ -89,8 +89,8 @@ const profile = {
refreshJourneyUseOutReconL: true,
trip: true,
reachableFrom: true,
-}
+};
export {
profile,
-}
+};
diff --git a/p/sbahn-muenchen/index.js b/p/sbahn-muenchen/index.js
index fdbc8ee3..cdbd8c1c 100644
--- a/p/sbahn-muenchen/index.js
+++ b/p/sbahn-muenchen/index.js
@@ -1,10 +1,10 @@
// todo: use import assertions once they're supported by Node.js & ESLint
// https://github.com/tc39/proposal-import-assertions
-import {createRequire} from 'module'
-const require = createRequire(import.meta.url)
+import {createRequire} from 'module';
+const require = createRequire(import.meta.url);
-const baseProfile = require('./base.json')
-import {products} from './products.js'
+const baseProfile = require('./base.json');
+import {products} from './products.js';
const profile = {
...baseProfile,
@@ -19,9 +19,9 @@ const profile = {
trip: true,
radar: true,
refreshJourney: true,
- reachableFrom: true
-}
+ reachableFrom: true,
+};
export {
profile,
-}
+};
diff --git a/p/sbahn-muenchen/products.js b/p/sbahn-muenchen/products.js
index 48501a3b..7e21b485 100644
--- a/p/sbahn-muenchen/products.js
+++ b/p/sbahn-muenchen/products.js
@@ -5,7 +5,7 @@ const products = [
bitmasks: [1],
name: 'InterCityExpress',
short: 'ICE',
- default: true
+ default: true,
},
{
id: 'ic-ec',
@@ -13,7 +13,7 @@ const products = [
bitmasks: [2],
name: 'InterCity/EuroCity',
short: 'IC/EC',
- default: true
+ default: true,
},
{
id: 'ir-d',
@@ -21,7 +21,7 @@ const products = [
bitmasks: [4],
name: 'Interregio/Schnellzug',
short: 'IRE',
- default: true
+ default: true,
},
{
id: 'region',
@@ -29,7 +29,7 @@ const products = [
bitmasks: [8],
name: 'Regio- und Nahverkehr',
short: 'RE/RB',
- default: true
+ default: true,
},
{
id: 'sbahn',
@@ -37,7 +37,7 @@ const products = [
bitmasks: [16],
name: 'S-Bahn',
short: 'S',
- default: true
+ default: true,
},
{
id: 'bus',
@@ -45,7 +45,7 @@ const products = [
bitmasks: [32],
name: 'Bus',
short: 'Bus',
- default: true
+ default: true,
},
// todo: 64
{
@@ -54,7 +54,7 @@ const products = [
bitmasks: [128],
name: 'U-Bahn',
short: 'U',
- default: true
+ default: true,
},
{
id: 'tram',
@@ -62,7 +62,7 @@ const products = [
bitmasks: [256],
name: 'Straßenbahn',
short: 'Tram',
- default: true
+ default: true,
},
{
id: 'on-call',
@@ -70,10 +70,10 @@ const products = [
bitmasks: [512],
name: 'Anrufsammeltaxi',
short: 'Sammeltaxi',
- default: true
- }
-]
+ default: true,
+ },
+];
export {
products,
-}
+};
diff --git a/p/sncb/index.js b/p/sncb/index.js
index b94d6e35..1756f538 100644
--- a/p/sncb/index.js
+++ b/p/sncb/index.js
@@ -1,51 +1,57 @@
// todo: use import assertions once they're supported by Node.js & ESLint
// https://github.com/tc39/proposal-import-assertions
-import {createRequire} from 'module'
-const require = createRequire(import.meta.url)
+import {createRequire} from 'module';
+const require = createRequire(import.meta.url);
-import {readFileSync} from 'fs'
-import {Agent} from 'https'
-import {strictEqual as eql} from 'assert'
-import {parseHook} from '../../lib/profile-hooks.js'
-import {parseLine} from '../../parse/line.js'
-const baseProfile = require('./base.json')
-import {products} from './products.js'
+import {readFileSync} from 'fs';
+import {Agent} from 'https';
+import {strictEqual as eql} from 'assert';
+import {parseHook} from '../../lib/profile-hooks.js';
+import {parseLine} from '../../parse/line.js';
+const baseProfile = require('./base.json');
+import {products} from './products.js';
// `www.belgianrail.be:443` doesn't provide the necessary CA certificate
// chain for Node.js to trust the certificate, so we manually add it.
// todo: fix this properly, e.g. by letting them know
-const ca = readFileSync(new URL('./digicert-sha2-secure-server-ca.crt.pem', import.meta.url).pathname)
-const agent = new Agent({ca})
-const transformReq = (ctx, req) => ({...req, agent})
+const ca = readFileSync(new URL('./digicert-sha2-secure-server-ca.crt.pem', import.meta.url).pathname);
+const agent = new Agent({ca});
+const transformReq = (ctx, req) => ({...req, agent});
// todo: this is ugly
const lineNameWithoutFahrtNr = ({parsed}) => {
- const {name, fahrtNr} = parsed
- if (!name || !fahrtNr || !/s\d/i.test(name)) return parsed
- const i = name.indexOf(fahrtNr)
- if (i < 0) return parsed
+ const {name, fahrtNr} = parsed;
+ if (!name || !fahrtNr || !(/s\d/i).test(name)) {
+ return parsed;
+ }
+ const i = name.indexOf(fahrtNr);
+ if (i < 0) {
+ return parsed;
+ }
if (
- /\s/.test(name[i - 1] || '') && // space before
- name.length === i + fahrtNr.length // nothing behind
- ) return {
- ...parsed,
- name: name.slice(0, i - 1) + name.slice(i + fahrtNr.length + 1),
+ (/\s/).test(name[i - 1] || '') // space before
+ && name.length === i + fahrtNr.length // nothing behind
+ ) {
+ return {
+ ...parsed,
+ name: name.slice(0, i - 1) + name.slice(i + fahrtNr.length + 1),
+ };
}
- return parsed
-}
+ return parsed;
+};
eql(lineNameWithoutFahrtNr({
- parsed: {name: 'THA 123', fahrtNr: '123'}
-}).name, 'THA 123')
+ parsed: {name: 'THA 123', fahrtNr: '123'},
+}).name, 'THA 123');
eql(lineNameWithoutFahrtNr({
- parsed: {name: 'S1 123', fahrtNr: '123'}
-}).name, 'S1')
+ parsed: {name: 'S1 123', fahrtNr: '123'},
+}).name, 'S1');
eql(lineNameWithoutFahrtNr({
- parsed: {name: 'S1-123', fahrtNr: '123'}
-}).name, 'S1-123')
+ parsed: {name: 'S1-123', fahrtNr: '123'},
+}).name, 'S1-123');
eql(lineNameWithoutFahrtNr({
- parsed: {name: 'S1 123a', fahrtNr: '123'}
-}).name, 'S1 123a')
+ parsed: {name: 'S1 123a', fahrtNr: '123'},
+}).name, 'S1 123a');
const profile = {
...baseProfile,
@@ -62,8 +68,8 @@ const profile = {
refreshJourney: true,
radar: true,
reachableFrom: true,
-}
+};
export {
profile,
-}
+};
diff --git a/p/sncb/products.js b/p/sncb/products.js
index 40317fdd..0de1f383 100644
--- a/p/sncb/products.js
+++ b/p/sncb/products.js
@@ -6,7 +6,7 @@ const products = [ // todo: 2, 8, 32, 128
bitmasks: [1],
name: 'high-speed train',
short: 'HST',
- default: true
+ default: true,
},
{
id: 'intercity-p',
@@ -14,7 +14,7 @@ const products = [ // todo: 2, 8, 32, 128
bitmasks: [4],
name: 'InterCity/Peak',
short: 'IC/P',
- default: true
+ default: true,
},
{
id: 's-train',
@@ -22,7 +22,7 @@ const products = [ // todo: 2, 8, 32, 128
bitmasks: [16],
name: 'S-train',
short: 'S',
- default: true
+ default: true,
},
{
id: 'local-train',
@@ -30,7 +30,7 @@ const products = [ // todo: 2, 8, 32, 128
bitmasks: [64],
name: 'local train',
short: 'L',
- default: true
+ default: true,
},
{
id: 'metro',
@@ -38,7 +38,7 @@ const products = [ // todo: 2, 8, 32, 128
bitmasks: [256],
name: 'Metro',
short: 'M',
- default: true
+ default: true,
},
{
id: 'bus',
@@ -46,7 +46,7 @@ const products = [ // todo: 2, 8, 32, 128
bitmasks: [512],
name: 'bus',
short: 'bus',
- default: true
+ default: true,
},
{
id: 'tram',
@@ -54,10 +54,10 @@ const products = [ // todo: 2, 8, 32, 128
bitmasks: [1024],
name: 'tram',
short: 'tram',
- default: true
- }
-]
+ default: true,
+ },
+];
export {
products,
-}
+};
diff --git a/p/stv/index.js b/p/stv/index.js
index 4f88b03c..fae4f9bd 100644
--- a/p/stv/index.js
+++ b/p/stv/index.js
@@ -1,9 +1,9 @@
// todo: use import assertions once they're supported by Node.js & ESLint
// https://github.com/tc39/proposal-import-assertions
-import {createRequire} from 'module'
-const require = createRequire(import.meta.url)
+import {createRequire} from 'module';
+const require = createRequire(import.meta.url);
-const baseProfile = require('./base.json')
+const baseProfile = require('./base.json');
const products = [{
id: 'train-and-s-bahn',
@@ -75,7 +75,7 @@ const products = [{
name: 'Anrufsammeltaxi',
short: 'AST',
default: true,
-}]
+}];
const profile = {
...baseProfile,
@@ -87,8 +87,8 @@ const profile = {
refreshJourneyUseOutReconL: true,
trip: true,
reachableFrom: true,
-}
+};
export {
profile,
-}
+};
diff --git a/p/svv/index.js b/p/svv/index.js
index 24d1f187..8f745adb 100644
--- a/p/svv/index.js
+++ b/p/svv/index.js
@@ -1,10 +1,10 @@
// todo: use import assertions once they're supported by Node.js & ESLint
// https://github.com/tc39/proposal-import-assertions
-import {createRequire} from 'module'
-const require = createRequire(import.meta.url)
+import {createRequire} from 'module';
+const require = createRequire(import.meta.url);
-const baseProfile = require('./base.json')
-import {products} from './products.js'
+const baseProfile = require('./base.json');
+import {products} from './products.js';
const profile = {
...baseProfile,
@@ -17,8 +17,8 @@ const profile = {
refreshJourney: true,
reachableFrom: true,
refreshJourneyUseOutReconL: true,
-}
+};
export {
profile,
-}
+};
diff --git a/p/svv/products.js b/p/svv/products.js
index 38588c0b..84f89ca3 100644
--- a/p/svv/products.js
+++ b/p/svv/products.js
@@ -5,7 +5,7 @@ const products = [
bitmasks: [1, 2],
name: 'Bahn & S-Bahn',
short: 'S/Zug',
- default: true
+ default: true,
},
{
id: 'u-bahn',
@@ -13,7 +13,7 @@ const products = [
bitmasks: [4],
name: 'U-Bahn',
short: 'U',
- default: true
+ default: true,
},
{
id: 'strassenbahn',
@@ -21,7 +21,7 @@ const products = [
bitmasks: [16],
name: 'Strassenbahn',
short: 'Str',
- default: true
+ default: true,
},
{
id: 'fernbus',
@@ -29,7 +29,7 @@ const products = [
bitmasks: [32],
name: 'Fernbus',
short: 'Bus',
- default: true
+ default: true,
},
{
id: 'regionalbus',
@@ -37,7 +37,7 @@ const products = [
bitmasks: [64],
name: 'Regionalbus',
short: 'Bus',
- default: true
+ default: true,
},
{
id: 'stadtbus',
@@ -45,7 +45,7 @@ const products = [
bitmasks: [128],
name: 'Stadtbus',
short: 'Bus',
- default: true
+ default: true,
},
{
id: 'seilbahn-zahnradbahn',
@@ -53,7 +53,7 @@ const products = [
bitmasks: [256],
name: 'Seil-/Zahnradbahn',
short: 'Seil-/Zahnradbahn',
- default: true
+ default: true,
},
{
id: 'schiff',
@@ -61,10 +61,10 @@ const products = [
bitmasks: [512],
name: 'Schiff',
short: 'F',
- default: true
+ default: true,
},
-]
+];
export {
products,
-}
+};
diff --git a/p/tpg/index.js b/p/tpg/index.js
index 02f2eb2a..6de5f978 100644
--- a/p/tpg/index.js
+++ b/p/tpg/index.js
@@ -1,9 +1,9 @@
// todo: use import assertions once they're supported by Node.js & ESLint
// https://github.com/tc39/proposal-import-assertions
-import {createRequire} from 'module'
-const require = createRequire(import.meta.url)
+import {createRequire} from 'module';
+const require = createRequire(import.meta.url);
-const baseProfile = require('./base.json')
+const baseProfile = require('./base.json');
const products = [{
id: 'tgv',
@@ -68,7 +68,7 @@ const products = [{
name: 'Tram',
short: 'Tram',
default: true,
-}]
+}];
const profile = {
...baseProfile,
@@ -82,8 +82,8 @@ const profile = {
radar: true,
refreshJourneyUseOutReconL: true,
reachableFrom: true,
-}
+};
export {
profile,
-}
+};
diff --git a/p/vbb/index.js b/p/vbb/index.js
index a1720173..d99cddfc 100644
--- a/p/vbb/index.js
+++ b/p/vbb/index.js
@@ -1,38 +1,40 @@
// todo: use import assertions once they're supported by Node.js & ESLint
// https://github.com/tc39/proposal-import-assertions
-import {createRequire} from 'module'
-const require = createRequire(import.meta.url)
+import {createRequire} from 'module';
+const require = createRequire(import.meta.url);
-import {parseHook} from '../../lib/profile-hooks.js'
+import {parseHook} from '../../lib/profile-hooks.js';
-import {parseAndAddLocationDHID} from './parse-loc-dhid.js'
-import {parseLine as _parseLine} from '../../parse/line.js'
-import {parseLocation as _parseLocation} from '../../parse/location.js'
-import {parseJourney as _parseJourney} from '../../parse/journey.js'
-import {parseDeparture as _parseDeparture} from '../../parse/departure.js'
+import {parseAndAddLocationDHID} from './parse-loc-dhid.js';
+import {parseLine as _parseLine} from '../../parse/line.js';
+import {parseLocation as _parseLocation} from '../../parse/location.js';
+import {parseJourney as _parseJourney} from '../../parse/journey.js';
+import {parseDeparture as _parseDeparture} from '../../parse/departure.js';
-const baseProfile = require('./base.json')
-import {products} from './products.js'
+const baseProfile = require('./base.json');
+import {products} from './products.js';
const parseLineWithShortName = ({parsed}, p) => {
- parsed.name = p.name.replace(/^(bus|tram)\s+/i, '')
- return parsed
-}
+ parsed.name = p.name.replace(/^(bus|tram)\s+/i, '');
+ return parsed;
+};
const parseLocation = ({parsed}, l) => {
- parseAndAddLocationDHID(parsed, l)
- return parsed
-}
+ parseAndAddLocationDHID(parsed, l);
+ return parsed;
+};
// todo: move this to parse/tickets.js?
const parseJourneyWithTickets = ({parsed}, j) => {
if (
- j.trfRes &&
- Array.isArray(j.trfRes.fareSetL)
+ j.trfRes
+ && Array.isArray(j.trfRes.fareSetL)
) {
parsed.tickets = j.trfRes.fareSetL
.map((s) => {
- if (!Array.isArray(s.fareL) || s.fareL.length === 0) return null
+ if (!Array.isArray(s.fareL) || s.fareL.length === 0) {
+ return null;
+ }
return {
name: s.name,
description: s.desc,
@@ -41,30 +43,30 @@ const parseJourneyWithTickets = ({parsed}, j) => {
name: f.name,
price: f.price,
})),
- }
+ };
})
- .filter(set => !!set)
+ .filter(set => Boolean(set));
// todo: j.trfRes.totalPrice
// todo: j.trfRes.msgL
}
- return parsed
-}
+ return parsed;
+};
-const ringbahnClockwise = /^ringbahn s\s?41$/i
-const ringbahnAnticlockwise = /^ringbahn s\s?42$/i
+const ringbahnClockwise = /^ringbahn s\s?41$/i;
+const ringbahnAnticlockwise = /^ringbahn s\s?42$/i;
const parseDepartureRenameRingbahn = ({parsed}) => {
if (parsed.line && parsed.line.product === 'suburban') {
- const d = parsed.direction && parsed.direction.trim()
+ const d = parsed.direction && parsed.direction.trim();
if (ringbahnClockwise.test(d)) {
- parsed.direction = 'Ringbahn S41 ⟳'
+ parsed.direction = 'Ringbahn S41 ⟳';
} else if (ringbahnAnticlockwise.test(d)) {
- parsed.direction = 'Ringbahn S42 ⟲'
+ parsed.direction = 'Ringbahn S42 ⟲';
}
}
- return parsed
-}
+ return parsed;
+};
const profile = {
...baseProfile,
@@ -83,8 +85,8 @@ const profile = {
trip: true,
radar: true,
reachableFrom: true,
-}
+};
export {
profile,
-}
+};
diff --git a/p/vbb/parse-loc-dhid.js b/p/vbb/parse-loc-dhid.js
index a787c166..f7624522 100644
--- a/p/vbb/parse-loc-dhid.js
+++ b/p/vbb/parse-loc-dhid.js
@@ -1,19 +1,23 @@
-const dhidPrefix = 'A×'
+const dhidPrefix = 'A×';
const parseAndAddLocationDHID = (loc, l) => {
- if (!Array.isArray(l.gidL)) return;
+ if (!Array.isArray(l.gidL)) {
+ return;
+ }
- const dhidGid = l.gidL.find(gid => gid.slice(0, dhidPrefix.length) === dhidPrefix)
- if (!dhidGid) return;
- const dhid = dhidGid.slice(dhidPrefix.length)
+ const dhidGid = l.gidL.find(gid => gid.slice(0, dhidPrefix.length) === dhidPrefix);
+ if (!dhidGid) {
+ return;
+ }
+ const dhid = dhidGid.slice(dhidPrefix.length);
// It seems that the DHID of the parent station is being used, not of the stop.
// if (!loc.ids) loc.ids = {}
// loc.ids.dhid = dhid
// todo: use loc.ids.stationDHID instead?
- loc.stationDHID = dhid
-}
+ loc.stationDHID = dhid;
+};
export {
parseAndAddLocationDHID,
-}
+};
diff --git a/p/vbb/products.js b/p/vbb/products.js
index 9ad80d73..7565a019 100644
--- a/p/vbb/products.js
+++ b/p/vbb/products.js
@@ -5,7 +5,7 @@ const products = [
bitmasks: [1],
name: 'S-Bahn',
short: 'S',
- default: true
+ default: true,
},
{
id: 'subway',
@@ -13,7 +13,7 @@ const products = [
bitmasks: [2],
name: 'U-Bahn',
short: 'U',
- default: true
+ default: true,
},
{
id: 'tram',
@@ -21,7 +21,7 @@ const products = [
bitmasks: [4],
name: 'Tram',
short: 'T',
- default: true
+ default: true,
},
{
id: 'bus',
@@ -29,7 +29,7 @@ const products = [
bitmasks: [8],
name: 'Bus',
short: 'B',
- default: true
+ default: true,
},
{
id: 'ferry',
@@ -37,7 +37,7 @@ const products = [
bitmasks: [16],
name: 'Fähre',
short: 'F',
- default: true
+ default: true,
},
{
id: 'express',
@@ -45,7 +45,7 @@ const products = [
bitmasks: [32],
name: 'IC/ICE',
short: 'E',
- default: true
+ default: true,
},
{
id: 'regional',
@@ -53,10 +53,10 @@ const products = [
bitmasks: [64],
name: 'RB/RE',
short: 'R',
- default: true
- }
-]
+ default: true,
+ },
+];
export {
products,
-}
+};
diff --git a/p/vbn/index.js b/p/vbn/index.js
index 5eeb5688..82f2f6ad 100644
--- a/p/vbn/index.js
+++ b/p/vbn/index.js
@@ -1,10 +1,10 @@
// todo: use import assertions once they're supported by Node.js & ESLint
// https://github.com/tc39/proposal-import-assertions
-import {createRequire} from 'module'
-const require = createRequire(import.meta.url)
+import {createRequire} from 'module';
+const require = createRequire(import.meta.url);
-const baseProfile = require('./base.json')
-import {products} from './products.js'
+const baseProfile = require('./base.json');
+import {products} from './products.js';
const profile = {
...baseProfile,
@@ -21,8 +21,8 @@ const profile = {
radar: true,
reachableFrom: true,
refreshJourneyUseOutReconL: true,
-}
+};
export {
profile,
-}
+};
diff --git a/p/vbn/products.js b/p/vbn/products.js
index 1846d564..817e1427 100644
--- a/p/vbn/products.js
+++ b/p/vbn/products.js
@@ -5,7 +5,7 @@ const products = [
bitmasks: [1],
name: 'InterCityExpress',
short: 'ICE',
- default: true
+ default: true,
},
{
id: 'national-train',
@@ -13,7 +13,7 @@ const products = [
bitmasks: [2, 4],
name: 'InterCity, EuroCity, CityNightLine, InterRegio',
short: 'IC/EC/CNL/IR',
- default: true
+ default: true,
},
{
id: 'local-train',
@@ -21,7 +21,7 @@ const products = [
bitmasks: [8],
name: 'Nahverkehr',
short: 'Nahv.',
- default: true
+ default: true,
},
{
id: 'suburban',
@@ -29,7 +29,7 @@ const products = [
bitmasks: [16],
name: 'S-Bahn',
short: 'S',
- default: true
+ default: true,
},
{
id: 'bus',
@@ -37,7 +37,7 @@ const products = [
bitmasks: [32],
name: 'Bus',
short: 'Bus',
- default: true
+ default: true,
},
{
id: 'watercraft',
@@ -45,7 +45,7 @@ const products = [
bitmasks: [64],
name: 'Schiff',
short: 'Schiff',
- default: true
+ default: true,
},
{
id: 'subway',
@@ -53,7 +53,7 @@ const products = [
bitmasks: [128],
name: 'U-Bahn',
short: 'U',
- default: true
+ default: true,
},
{
id: 'tram',
@@ -61,7 +61,7 @@ const products = [
bitmasks: [256],
name: 'Tram',
short: 'Tram',
- default: true
+ default: true,
},
{
id: 'dial-a-ride',
@@ -69,10 +69,10 @@ const products = [
bitmasks: [256],
name: 'Anrufverkehr',
short: 'AST',
- default: true
- }
-]
+ default: true,
+ },
+];
export {
products,
-}
+};
diff --git a/p/vkg/index.js b/p/vkg/index.js
index f59ef35c..1950a8c5 100644
--- a/p/vkg/index.js
+++ b/p/vkg/index.js
@@ -1,9 +1,9 @@
// todo: use import assertions once they're supported by Node.js & ESLint
// https://github.com/tc39/proposal-import-assertions
-import {createRequire} from 'module'
-const require = createRequire(import.meta.url)
+import {createRequire} from 'module';
+const require = createRequire(import.meta.url);
-const baseProfile = require('./base.json')
+const baseProfile = require('./base.json');
const products = [{ // todo: what is `8`?
id: 'trains',
@@ -75,7 +75,7 @@ const products = [{ // todo: what is `8`?
name: 'Anrufsammeltaxi',
short: 'AST',
default: true,
-}]
+}];
const profile = {
...baseProfile,
@@ -88,8 +88,8 @@ const profile = {
refreshJourneyUseOutReconL: true,
trip: true,
reachableFrom: true,
-}
+};
export {
profile,
-}
+};
diff --git a/p/vmt/index.js b/p/vmt/index.js
index 39fccee7..c39635f9 100644
--- a/p/vmt/index.js
+++ b/p/vmt/index.js
@@ -1,10 +1,10 @@
// todo: use import assertions once they're supported by Node.js & ESLint
// https://github.com/tc39/proposal-import-assertions
-import {createRequire} from 'module'
-const require = createRequire(import.meta.url)
+import {createRequire} from 'module';
+const require = createRequire(import.meta.url);
-const baseProfile = require('./base.json')
-import {products} from './products.js'
+const baseProfile = require('./base.json');
+import {products} from './products.js';
const profile = {
...baseProfile,
@@ -21,8 +21,8 @@ const profile = {
trip: true,
reachableFrom: true,
remarks: false, // seems like ver >= 1.20 is required
-}
+};
export {
profile,
-}
+};
diff --git a/p/vmt/products.js b/p/vmt/products.js
index cfe75279..f413a8ca 100644
--- a/p/vmt/products.js
+++ b/p/vmt/products.js
@@ -6,7 +6,7 @@ const products = [
bitmasks: [1, 2, 4],
name: 'long-distance train',
short: 'ICE/IC/EC',
- default: true
+ default: true,
},
{
id: 'regional-train',
@@ -15,7 +15,7 @@ const products = [
bitmasks: [8, 16],
name: 'regional train',
short: 'RE/RB',
- default: true
+ default: true,
},
{
id: 'tram',
@@ -23,7 +23,7 @@ const products = [
bitmasks: [32],
name: 'tram',
short: 'tram',
- default: true
+ default: true,
},
// todo: what are `64` & `128`?
{
@@ -32,10 +32,10 @@ const products = [
bitmasks: [256],
name: 'bus',
short: 'bus',
- default: true
- }
-]
+ default: true,
+ },
+];
export {
products,
-}
+};
diff --git a/p/vor/index.js b/p/vor/index.js
index dfc8ab32..de1786ef 100644
--- a/p/vor/index.js
+++ b/p/vor/index.js
@@ -1,9 +1,9 @@
// todo: use import assertions once they're supported by Node.js & ESLint
// https://github.com/tc39/proposal-import-assertions
-import {createRequire} from 'module'
-const require = createRequire(import.meta.url)
+import {createRequire} from 'module';
+const require = createRequire(import.meta.url);
-const baseProfile = require('./base.json')
+const baseProfile = require('./base.json');
const products = [{
id: 'train-and-s-bahn',
@@ -75,7 +75,7 @@ const products = [{
name: 'Anrufsammeltaxi',
short: 'AST',
default: true,
-}]
+}];
const profile = {
...baseProfile,
@@ -96,8 +96,8 @@ const profile = {
refreshJourneyUseOutReconL: true,
trip: true,
reachableFrom: true,
-}
+};
export {
profile,
-}
+};
diff --git a/p/vos/index.js b/p/vos/index.js
index fbd07ba0..793fee89 100644
--- a/p/vos/index.js
+++ b/p/vos/index.js
@@ -1,9 +1,9 @@
// todo: use import assertions once they're supported by Node.js & ESLint
// https://github.com/tc39/proposal-import-assertions
-import {createRequire} from 'module'
-const require = createRequire(import.meta.url)
+import {createRequire} from 'module';
+const require = createRequire(import.meta.url);
-const baseProfile = require('./base.json')
+const baseProfile = require('./base.json');
const products = [{
id: 'ice',
@@ -75,7 +75,7 @@ const products = [{
name: 'Anrufverkehr',
short: 'AST',
default: true,
-}]
+}];
const profile = {
...baseProfile,
@@ -89,8 +89,8 @@ const profile = {
radar: true,
refreshJourneyUseOutReconL: true,
reachableFrom: true,
-}
+};
export {
profile,
-}
+};
diff --git a/p/vrn/index.js b/p/vrn/index.js
index 4deb4c7c..b960785f 100644
--- a/p/vrn/index.js
+++ b/p/vrn/index.js
@@ -1,10 +1,10 @@
// todo: use import assertions once they're supported by Node.js & ESLint
// https://github.com/tc39/proposal-import-assertions
-import {createRequire} from 'module'
-const require = createRequire(import.meta.url)
+import {createRequire} from 'module';
+const require = createRequire(import.meta.url);
-const baseProfile = require('./base.json')
-import {products} from './products.js'
+const baseProfile = require('./base.json');
+import {products} from './products.js';
const profile = {
...baseProfile,
@@ -18,8 +18,8 @@ const profile = {
reachableFrom: true,
refreshJourney: true,
refreshJourneyUseOutReconL: true,
-}
+};
export {
profile,
-}
+};
diff --git a/p/vrn/products.js b/p/vrn/products.js
index 4fc8ef5e..dcf02808 100644
--- a/p/vrn/products.js
+++ b/p/vrn/products.js
@@ -56,8 +56,8 @@ const products = [
short: 'ICE/IC/EC/EN',
default: false,
},
-]
+];
export {
products,
-}
+};
diff --git a/p/vsn/index.js b/p/vsn/index.js
index efe9e618..5735211b 100644
--- a/p/vsn/index.js
+++ b/p/vsn/index.js
@@ -1,10 +1,10 @@
// todo: use import assertions once they're supported by Node.js & ESLint
// https://github.com/tc39/proposal-import-assertions
-import {createRequire} from 'module'
-const require = createRequire(import.meta.url)
+import {createRequire} from 'module';
+const require = createRequire(import.meta.url);
-const baseProfile = require('./base.json')
-import {products} from './products.js'
+const baseProfile = require('./base.json');
+import {products} from './products.js';
const profile = {
...baseProfile,
@@ -21,8 +21,8 @@ const profile = {
trip: true,
radar: true,
reachableFrom: true,
-}
+};
export {
profile,
-}
+};
diff --git a/p/vsn/products.js b/p/vsn/products.js
index 49efd25e..ae9498f7 100644
--- a/p/vsn/products.js
+++ b/p/vsn/products.js
@@ -5,7 +5,7 @@ const products = [
bitmasks: [1],
name: 'InterCityExpress',
short: 'ICE',
- default: true
+ default: true,
},
{
id: 'national',
@@ -13,7 +13,7 @@ const products = [
bitmasks: [2],
name: 'Fernzug',
short: 'IC/EC/CNL',
- default: true
+ default: true,
},
{
id: 'regionalExpress',
@@ -21,7 +21,7 @@ const products = [
bitmasks: [4],
name: 'RegionalExpress & InterRegio',
short: 'RE/IR',
- default: true
+ default: true,
},
{
id: 'regional',
@@ -29,7 +29,7 @@ const products = [
bitmasks: [8],
name: 'Nahverhehr',
short: 'NV',
- default: true
+ default: true,
},
{
id: 'suburban',
@@ -37,7 +37,7 @@ const products = [
bitmasks: [16],
name: 'S-Bahn',
short: 'S',
- default: true
+ default: true,
},
{
id: 'bus',
@@ -45,7 +45,7 @@ const products = [
bitmasks: [32],
name: 'Bus',
short: 'Bus',
- default: true
+ default: true,
},
{
id: 'ferry',
@@ -53,7 +53,7 @@ const products = [
bitmasks: [64],
name: 'Schiff',
short: 'F',
- default: true
+ default: true,
},
{
id: 'subway',
@@ -61,7 +61,7 @@ const products = [
bitmasks: [128],
name: 'U-Bahn',
short: 'U',
- default: true
+ default: true,
},
{
id: 'tram',
@@ -69,7 +69,7 @@ const products = [
bitmasks: [256],
name: 'Straßen-/Stadtbahn',
short: 'T',
- default: true
+ default: true,
},
{
id: 'anrufSammelTaxi',
@@ -77,10 +77,10 @@ const products = [
bitmasks: [512],
name: 'Anruf-Sammel-Taxi',
short: 'AST',
- default: true
+ default: true,
},
-]
+];
export {
products,
-}
+};
diff --git a/p/vvt/index.js b/p/vvt/index.js
index 368cdbbb..e11c13f9 100644
--- a/p/vvt/index.js
+++ b/p/vvt/index.js
@@ -1,9 +1,9 @@
// todo: use import assertions once they're supported by Node.js & ESLint
// https://github.com/tc39/proposal-import-assertions
-import {createRequire} from 'module'
-const require = createRequire(import.meta.url)
+import {createRequire} from 'module';
+const require = createRequire(import.meta.url);
-const baseProfile = require('./base.json')
+const baseProfile = require('./base.json');
const products = [{ // todo: what is `8`?
id: 'trains',
@@ -75,7 +75,7 @@ const products = [{ // todo: what is `8`?
name: 'Anrufsammeltaxi',
short: 'AST',
default: true,
-}]
+}];
const profile = {
...baseProfile,
@@ -88,8 +88,8 @@ const profile = {
trip: true,
refreshJourneyUseOutReconL: true,
reachableFrom: true,
-}
+};
export {
profile,
-}
+};
diff --git a/p/vvv/index.js b/p/vvv/index.js
index 2a8da912..21235c34 100644
--- a/p/vvv/index.js
+++ b/p/vvv/index.js
@@ -1,9 +1,9 @@
// todo: use import assertions once they're supported by Node.js & ESLint
// https://github.com/tc39/proposal-import-assertions
-import {createRequire} from 'module'
-const require = createRequire(import.meta.url)
+import {createRequire} from 'module';
+const require = createRequire(import.meta.url);
-const baseProfile = require('./base.json')
+const baseProfile = require('./base.json');
const products = [{
id: 'train-and-s-bahn',
@@ -75,7 +75,7 @@ const products = [{
name: 'Anrufsammeltaxi',
short: 'AST',
default: true,
-}]
+}];
const profile = {
...baseProfile,
@@ -94,8 +94,8 @@ const profile = {
refreshJourneyUseOutReconL: true,
trip: true,
reachableFrom: true,
-}
+};
export {
profile,
-}
+};
diff --git a/p/zvv/index.js b/p/zvv/index.js
index a59785a7..75f2789e 100644
--- a/p/zvv/index.js
+++ b/p/zvv/index.js
@@ -1,10 +1,10 @@
// todo: use import assertions once they're supported by Node.js & ESLint
// https://github.com/tc39/proposal-import-assertions
-import {createRequire} from 'module'
-const require = createRequire(import.meta.url)
+import {createRequire} from 'module';
+const require = createRequire(import.meta.url);
-const baseProfile = require('./base.json')
-import {products} from './products.js'
+const baseProfile = require('./base.json');
+import {products} from './products.js';
const profile = {
...baseProfile,
@@ -17,8 +17,8 @@ const profile = {
radar: true,
refreshJourneyUseOutReconL: true,
reachableFrom: true,
-}
+};
export {
profile,
-}
+};
diff --git a/p/zvv/products.js b/p/zvv/products.js
index b16e2b9a..944410ed 100644
--- a/p/zvv/products.js
+++ b/p/zvv/products.js
@@ -55,8 +55,8 @@ const products = [
short: 'Night Train',
default: true,
},
-]
+];
export {
products,
-}
+};
diff --git a/parse/arrival-or-departure.js b/parse/arrival-or-departure.js
index 0da93f2d..b0ea6ef3 100644
--- a/parse/arrival-or-departure.js
+++ b/parse/arrival-or-departure.js
@@ -1,25 +1,27 @@
-import {findRemarks} from './find-remarks.js'
+import {findRemarks} from './find-remarks.js';
-const ARRIVAL = 'a'
-const DEPARTURE = 'd'
+const ARRIVAL = 'a';
+const DEPARTURE = 'd';
// todo: pt.jny.dirFlg – https://github.com/alexander-albers/tripkit/blob/07047c6ddef24339ebd49a86a78158bca8047421/Sources/TripKit/Provider/AbstractHafasClientInterfaceProvider.swift#L347-L353 & https://github.com/alexander-albers/tripkit/commit/07047c6ddef24339ebd49a86a78158bca8047421#commitcomment-68471656
// todo: d.stbStop.dProgType/d.stbStop.aProgType
// todo: d.stbStop.dProdX/aProdX can be different than d.prodX
const createParseArrOrDep = (prefix) => {
- if (prefix !== ARRIVAL && prefix !== DEPARTURE) throw new Error('invalid prefix')
+ if (prefix !== ARRIVAL && prefix !== DEPARTURE) {
+ throw new Error('invalid prefix');
+ }
const parseArrOrDep = (ctx, d) => { // d = raw arrival/departure
- const {profile, opt} = ctx
- const {locL} = ctx.res.common
+ const {profile, opt} = ctx;
+ const {locL} = ctx.res.common;
- const tPlanned = d.stbStop[prefix + 'TimeS']
- const tPrognosed = d.stbStop[prefix + 'TimeR']
- const tzOffset = d.stbStop[prefix + 'TZOffset'] || null
- const cancelled = !!d.stbStop[prefix + 'Cncl']
- const plPlanned = d.stbStop[prefix + 'PlatfS'] || (d.stbStop[prefix + 'PltfS'] && d.stbStop[prefix + 'PltfS'].txt) || null
- const plPrognosed = d.stbStop[prefix + 'PlatfR'] || (d.stbStop[prefix + 'PltfR'] && d.stbStop[prefix + 'PltfR'].txt) || null
+ const tPlanned = d.stbStop[prefix + 'TimeS'];
+ const tPrognosed = d.stbStop[prefix + 'TimeR'];
+ const tzOffset = d.stbStop[prefix + 'TZOffset'] || null;
+ const cancelled = Boolean(d.stbStop[prefix + 'Cncl']);
+ const plPlanned = d.stbStop[prefix + 'PlatfS'] || d.stbStop[prefix + 'PltfS'] && d.stbStop[prefix + 'PltfS'].txt || null;
+ const plPrognosed = d.stbStop[prefix + 'PlatfR'] || d.stbStop[prefix + 'PltfR'] && d.stbStop[prefix + 'PltfR'].txt || null;
const res = {
tripId: d.jid,
@@ -33,15 +35,15 @@ const createParseArrOrDep = (prefix) => {
line: d.line || null,
remarks: [],
origin: null,
- destination: null
- }
+ destination: null,
+ };
if (prefix === DEPARTURE && Array.isArray(d.prodL) && d.prodL[0] && locL[d.prodL[0].tLocX]) {
- res.destination = profile.parseLocation(ctx, locL[d.prodL[0].tLocX])
+ res.destination = profile.parseLocation(ctx, locL[d.prodL[0].tLocX]);
}
if (prefix === ARRIVAL && Array.isArray(d.prodL) && d.prodL[0] && locL[d.prodL[0].fLocX]) {
- res.origin = profile.parseLocation(ctx, locL[d.prodL[0].fLocX])
+ res.origin = profile.parseLocation(ctx, locL[d.prodL[0].fLocX]);
}
if (d.pos) {
@@ -49,38 +51,42 @@ const createParseArrOrDep = (prefix) => {
type: 'location',
latitude: d.pos.y / 1000000,
longitude: d.pos.x / 1000000,
- }
+ };
}
if (cancelled) {
- res.cancelled = true
- Object.defineProperty(res, 'canceled', {value: true})
+ res.cancelled = true;
+ Object.defineProperty(res, 'canceled', {value: true});
}
if (opt.remarks) {
res.remarks = findRemarks([
- ...(d.remL || []),
- ...(d.msgL || []),
- ...(d.stbStop.remL || []),
- ...(d.stbStop.msgL || []),
- ]).map(([remark]) => remark)
+ ...d.remL || [],
+ ...d.msgL || [],
+ ...d.stbStop.remL || [],
+ ...d.stbStop.msgL || [],
+ ])
+ .map(([remark]) => remark);
}
if (opt.stopovers && Array.isArray(d.stopL)) {
// Filter stations the train passes without stopping, as this doesn't comply with FPTF (yet).
const stopovers = d.stopL
- .map(st => profile.parseStopover(ctx, st, d.date))
- .filter(st => !st.passBy)
- if (prefix === ARRIVAL) res.previousStopovers = stopovers
- else if (prefix === DEPARTURE) res.nextStopovers = stopovers
+ .map(st => profile.parseStopover(ctx, st, d.date))
+ .filter(st => !st.passBy);
+ if (prefix === ARRIVAL) {
+ res.previousStopovers = stopovers;
+ } else if (prefix === DEPARTURE) {
+ res.nextStopovers = stopovers;
+ }
}
- return res
- }
+ return res;
+ };
- return parseArrOrDep
-}
+ return parseArrOrDep;
+};
export {
createParseArrOrDep,
-}
+};
diff --git a/parse/arrival.js b/parse/arrival.js
index dfd7e4b4..43016349 100644
--- a/parse/arrival.js
+++ b/parse/arrival.js
@@ -1,8 +1,8 @@
-import {createParseArrOrDep} from './arrival-or-departure.js'
+import {createParseArrOrDep} from './arrival-or-departure.js';
-const ARRIVAL = 'a'
-const parseArrival = createParseArrOrDep(ARRIVAL)
+const ARRIVAL = 'a';
+const parseArrival = createParseArrOrDep(ARRIVAL);
export {
parseArrival,
-}
+};
diff --git a/parse/common.js b/parse/common.js
index f7693cf6..0e86b6de 100644
--- a/parse/common.js
+++ b/parse/common.js
@@ -1,71 +1,93 @@
-import omit from 'lodash/omit.js'
-import {createFindInTree} from '../lib/find-in-tree.js'
+import omit from 'lodash/omit.js';
+import {createFindInTree} from '../lib/find-in-tree.js';
const findInTree = createFindInTree([
- '**.oprX', '**.icoX', '**.prodX', '**.pRefL', '**.locX',
- '**.ani.fLocX', '**.ani.tLocX', '**.fLocX', '**.tLocX',
- '**.remX', '**.himX', '**.polyG.polyXL', '**.rRefL',
- '**.msgL', '**.remL',
-])
+ '**.oprX',
+ '**.icoX',
+ '**.prodX',
+ '**.pRefL',
+ '**.locX',
+ '**.ani.fLocX',
+ '**.ani.tLocX',
+ '**.fLocX',
+ '**.tLocX',
+ '**.remX',
+ '**.himX',
+ '**.polyG.polyXL',
+ '**.rRefL',
+ '**.msgL',
+ '**.remL',
+]);
// there are circular references (e.g. warning -> loc -> warning)
// todo: parse either on-the-fly or in a recursive/iterative process
const parseCommonData = (_ctx) => {
- const {profile, opt, res} = _ctx
- const c = res.common || {}
- const matches = findInTree(res)
+ const {profile, opt, res} = _ctx;
+ const c = res.common || {};
+ const matches = findInTree(res);
- const common = {}
- const ctx = {..._ctx, common}
+ const common = {};
+ const ctx = {..._ctx, common};
- common.operators = []
+ common.operators = [];
if (Array.isArray(c.opL)) {
- common.operators = c.opL.map(op => profile.parseOperator(ctx, op))
+ common.operators = c.opL.map(op => profile.parseOperator(ctx, op));
matches['**.oprX'].forEach(([idx, parents]) => {
- if ('number' === typeof idx) parents[0].operator = common.operators[idx]
- })
+ if ('number' === typeof idx) {
+ parents[0].operator = common.operators[idx];
+ }
+ });
}
- common.icons = []
+ common.icons = [];
if (Array.isArray(c.icoL)) {
- common.icons = c.icoL.map(icon => profile.parseIcon(ctx, icon))
+ common.icons = c.icoL.map(icon => profile.parseIcon(ctx, icon));
matches['**.icoX'].forEach(([idx, parents]) => {
- if ('number' === typeof idx) parents[0].icon = common.icons[idx]
- })
+ if ('number' === typeof idx) {
+ parents[0].icon = common.icons[idx];
+ }
+ });
}
- common.lines = []
+ common.lines = [];
if (Array.isArray(c.prodL)) {
- common.lines = c.prodL.map(l => profile.parseLine(ctx, l))
+ common.lines = c.prodL.map(l => profile.parseLine(ctx, l));
matches['**.prodX'].forEach(([idx, parents]) => {
- if ('number' === typeof idx) parents[0].line = common.lines[idx]
- })
+ if ('number' === typeof idx) {
+ parents[0].line = common.lines[idx];
+ }
+ });
matches['**.pRefL'].forEach(([idxs, parents]) => {
- parents[0].lines = idxs.filter(idx => !!common.lines[idx]).map(idx => common.lines[idx])
- })
+ parents[0].lines = idxs.filter(idx => Boolean(common.lines[idx]))
+ .map(idx => common.lines[idx]);
+ });
// todo
// **.dep.dProdX: departureLine -> common.lines[idx]
// **.arr.aProdX: arrivalLine -> common.lines[idx]
}
- common.hints = []
+ common.hints = [];
if (Array.isArray(c.remL)) {
- common.hints = c.remL.map(hint => profile.parseHint(ctx, hint))
+ common.hints = c.remL.map(hint => profile.parseHint(ctx, hint));
matches['**.remX'].forEach(([idx, parents]) => {
- if ('number' === typeof idx) parents[0].hint = common.hints[idx]
- })
+ if ('number' === typeof idx) {
+ parents[0].hint = common.hints[idx];
+ }
+ });
matches['**.remL'].forEach(([idxs, parents]) => {
- if (!Array.isArray(idxs)) return;
+ if (!Array.isArray(idxs)) {
+ return;
+ }
parents[0].hints = idxs
- .filter(idx => !!common.hints[idx])
- .map(idx => common.hints[idx])
- })
+ .filter(idx => Boolean(common.hints[idx]))
+ .map(idx => common.hints[idx]);
+ });
matches['**.rRefL'].forEach(([idxs, parents]) => {
parents[0].hints = idxs
- .filter(idx => !!common.hints[idx])
- .map(idx => common.hints[idx])
- })
+ .filter(idx => Boolean(common.hints[idx]))
+ .map(idx => common.hints[idx]);
+ });
}
// resolve .msgL[] references
@@ -73,73 +95,83 @@ const parseCommonData = (_ctx) => {
// `common.himL[]` items?
const parseRemarkRef = (ref) => {
if (ref.type === 'REM' && ref.hint) {
- return omit(ref, ['type', 'remX'])
+ return omit(ref, ['type', 'remX']);
}
if (ref.type === 'HIM' && ref.warning) {
- return omit(ref, ['type', 'himX'])
+ return omit(ref, ['type', 'himX']);
}
- return null
- }
+ return null;
+ };
matches['**.msgL'].forEach(([refs, parents]) => {
// todo: store as parents[0].(hints|warnings)
parents[0].remarkRefs = refs
- .map(parseRemarkRef)
- .filter(ref => ref !== null)
- })
+ .map(parseRemarkRef)
+ .filter(ref => ref !== null);
+ });
- common.locations = []
+ common.locations = [];
if (Array.isArray(c.locL)) {
- common.locations = c.locL.map(loc => profile.parseLocation(ctx, loc))
+ common.locations = c.locL.map(loc => profile.parseLocation(ctx, loc));
for (let i = 0; i < common.locations.length; i++) {
- const raw = c.locL[i]
- const loc = common.locations[i]
+ const raw = c.locL[i];
+ const loc = common.locations[i];
if ('number' === typeof raw.mMastLocX) {
- loc.station = Object.assign({}, common.locations[raw.mMastLocX])
- loc.station.type = 'station'
- } else if (raw.isMainMast) loc.type = 'station'
+ loc.station = Object.assign({}, common.locations[raw.mMastLocX]);
+ loc.station.type = 'station';
+ } else if (raw.isMainMast) {
+ loc.type = 'station';
+ }
}
// todo: correct props?
matches['**.locX'].forEach(([idx, parents]) => {
- if ('number' === typeof idx) parents[0].location = common.locations[idx]
- })
+ if ('number' === typeof idx) {
+ parents[0].location = common.locations[idx];
+ }
+ });
matches['**.ani.fLocX'].forEach(([idxs, parents]) => {
- parents[0].fromLocations = idxs.map(idx => common.locations[idx])
- })
+ parents[0].fromLocations = idxs.map(idx => common.locations[idx]);
+ });
matches['**.ani.tLocX'].forEach(([idxs, parents]) => {
- parents[0].toLocations = idxs.map(idx => common.locations[idx])
- })
+ parents[0].toLocations = idxs.map(idx => common.locations[idx]);
+ });
matches['**.fLocX'].forEach(([idx, parents]) => {
- if ('number' === typeof idx) parents[0].fromLocation = common.locations[idx]
- })
+ if ('number' === typeof idx) {
+ parents[0].fromLocation = common.locations[idx];
+ }
+ });
matches['**.tLocX'].forEach(([idx, parents]) => {
- if ('number' === typeof idx) parents[0].toLocation = common.locations[idx]
- })
+ if ('number' === typeof idx) {
+ parents[0].toLocation = common.locations[idx];
+ }
+ });
}
- common.warnings = []
+ common.warnings = [];
if (Array.isArray(c.himL)) {
- common.warnings = c.himL.map(w => profile.parseWarning(ctx, w))
+ common.warnings = c.himL.map(w => profile.parseWarning(ctx, w));
matches['**.himX'].forEach(([idx, parents]) => {
- if ('number' === typeof idx) parents[0].warning = common.warnings[idx]
- })
+ if ('number' === typeof idx) {
+ parents[0].warning = common.warnings[idx];
+ }
+ });
}
- common.polylines = []
+ common.polylines = [];
if ((opt.polylines || opt.polyline) && Array.isArray(c.polyL)) {
- common.polylines = c.polyL.map(p => profile.parsePolyline(ctx, p))
+ common.polylines = c.polyL.map(p => profile.parsePolyline(ctx, p));
// todo: **.ani.poly -> parsePolyline()
matches['**.polyG.polyXL'].forEach(([idxs, parents]) => {
- const idx = idxs.find(idx => !!common.polylines[idx]) // find any given polyline
- parents[1].polyline = common.polylines[idx]
- })
+ const idx = idxs.find(idx => Boolean(common.polylines[idx])); // find any given polyline
+ parents[1].polyline = common.polylines[idx];
+ });
}
- return common
-}
+ return common;
+};
export {
parseCommonData,
-}
+};
diff --git a/parse/date-time.js b/parse/date-time.js
index 623bae1e..55458095 100644
--- a/parse/date-time.js
+++ b/parse/date-time.js
@@ -1,43 +1,49 @@
-import {DateTime, FixedOffsetZone, IANAZone} from 'luxon'
-import {luxonIANAZonesByProfile as timezones} from '../lib/luxon-timezones.js'
+import {DateTime, FixedOffsetZone, IANAZone} from 'luxon';
+import {luxonIANAZonesByProfile as timezones} from '../lib/luxon-timezones.js';
const parseDaysOffset = (_, time) => {
- return time.length > 6 ? parseInt(time.slice(0, -6)) : 0
-}
+ return time.length > 6
+ ? parseInt(time.slice(0, -6))
+ : 0;
+};
const parseDateTime = (ctx, date, time, tzOffset = null, timestamp = false) => {
- const {profile} = ctx
+ const {profile} = ctx;
- const pDate = [date.substr(-8, 4), date.substr(-4, 2), date.substr(-2, 2)]
+ const pDate = [date.substr(-8, 4), date.substr(-4, 2), date.substr(-2, 2)];
if (!pDate[0] || !pDate[1] || !pDate[2]) {
- throw new Error('invalid date format: ' + date)
+ throw new Error('invalid date format: ' + date);
}
- const pTime = [time.substr(-6, 2), time.substr(-4, 2), time.substr(-2, 2)]
+ const pTime = [time.substr(-6, 2), time.substr(-4, 2), time.substr(-2, 2)];
if (!pTime[0] || !pTime[1] || !pTime[2]) {
- throw new Error('invalid time format: ' + time)
+ throw new Error('invalid time format: ' + time);
}
- const daysOffset = parseDaysOffset(ctx, time)
+ const daysOffset = parseDaysOffset(ctx, time);
- let timezone
+ let timezone;
if (tzOffset !== null) {
- timezone = FixedOffsetZone.instance(tzOffset)
+ timezone = FixedOffsetZone.instance(tzOffset);
} else if (timezones.has(profile)) {
- timezone = timezones.get(profile)
+ timezone = timezones.get(profile);
} else {
- timezone = new IANAZone(profile.timezone)
- timezones.set(profile, timezone)
+ timezone = new IANAZone(profile.timezone);
+ timezones.set(profile, timezone);
}
let dt = DateTime.fromISO(pDate.join('-') + 'T' + pTime.join(':'), {
locale: profile.locale,
- zone: timezone
- })
- if (daysOffset > 0) dt = dt.plus({days: daysOffset})
- return timestamp ? dt.toMillis() : dt.toISO({suppressMilliseconds: true})
-}
+ zone: timezone,
+ });
+ if (daysOffset > 0) {
+ dt = dt.plus({days: daysOffset});
+ }
+ return timestamp
+ ? dt.toMillis()
+ : dt.toISO({suppressMilliseconds: true});
+};
export {
parseDateTime,
-}
+};
diff --git a/parse/departure.js b/parse/departure.js
index b8587cab..be6df61b 100644
--- a/parse/departure.js
+++ b/parse/departure.js
@@ -1,8 +1,8 @@
-import {createParseArrOrDep} from './arrival-or-departure.js'
+import {createParseArrOrDep} from './arrival-or-departure.js';
-const DEPARTURE = 'd'
-const parseDeparture = createParseArrOrDep(DEPARTURE)
+const DEPARTURE = 'd';
+const parseDeparture = createParseArrOrDep(DEPARTURE);
export {
parseDeparture,
-}
+};
diff --git a/parse/find-remarks.js b/parse/find-remarks.js
index bde9f64f..33942e57 100644
--- a/parse/find-remarks.js
+++ b/parse/find-remarks.js
@@ -1,4 +1,4 @@
-import flatMap from 'lodash/flatMap.js'
+import flatMap from 'lodash/flatMap.js';
// There are two kinds of notes: "remarks" (in `remL`) and HAFAS
// Information Manager (HIM) notes (in `himL`). The former describe
@@ -13,11 +13,11 @@ import flatMap from 'lodash/flatMap.js'
const findRemarks = (refs) => {
return flatMap(refs, (ref) => {
return [ref.warning, ref.hint]
- .filter(rem => !!rem)
- .map(rem => [rem, ref])
- })
-}
+ .filter(rem => Boolean(rem))
+ .map(rem => [rem, ref]);
+ });
+};
export {
findRemarks,
-}
+};
diff --git a/parse/hint.js b/parse/hint.js
index a979a800..dcc75a2b 100644
--- a/parse/hint.js
+++ b/parse/hint.js
@@ -1,7 +1,7 @@
const codesByIcon = Object.assign(Object.create(null), {
cancel: 'cancelled',
himWarn: 'disturbance',
-})
+});
const linkTypesByCode = Object.assign(Object.create(null), {
BB: 'stop-website',
@@ -12,7 +12,7 @@ const linkTypesByCode = Object.assign(Object.create(null), {
OZ: 'transit-authority',
// todo: `{type: 'I',code: 'TD',icoX: 1,txtN: '8010224'}`
// todo: `{type: 'I',code: 'TE',icoX: 1,txtN: '8024001'}`
-})
+});
// todo: pass in tag list from hint reference, e.g.:
// "tagL": [
@@ -115,28 +115,30 @@ const parseHint = (ctx, h) => {
if (h.type === 'I' && h.code && h.txtN) {
if (h.code in linkTypesByCode) {
- const text = h.txtN === 'NULL' ? null : h.txtN
- return {type: linkTypesByCode[h.code], text}
+ const text = h.txtN === 'NULL'
+ ? null
+ : h.txtN;
+ return {type: linkTypesByCode[h.code], text};
}
if (h.code === 'TW' && h.txtN[0] === '$') {
- return {type: 'local-fare-zone', text: h.txtN.slice(1)}
+ return {type: 'local-fare-zone', text: h.txtN.slice(1)};
}
if (h.code === 'TW' && h.txtN[0] === '#') {
- return {type: 'foreign-id', text: h.txtN.slice(1)}
+ return {type: 'foreign-id', text: h.txtN.slice(1)};
}
}
- const text = h.txtN && h.txtN.trim() || ''
- const icon = h.icon || null
- const code = h.code || (icon && icon.type && codesByIcon[icon.type]) || null
+ const text = h.txtN && h.txtN.trim() || '';
+ const icon = h.icon || null;
+ const code = h.code || icon && icon.type && codesByIcon[icon.type] || null;
if (h.type === 'M') {
return {
type: 'status',
summary: h.txtS && h.txtS.trim() || '',
code,
- text
- }
+ text,
+ };
}
if (h.type === 'L') {
@@ -144,33 +146,33 @@ const parseHint = (ctx, h) => {
type: 'status',
code: 'alternative-trip',
text,
- tripId: h.jid
- }
+ tripId: h.jid,
+ };
}
if (h.type === 'A' || h.type === 'I') {
return {
type: 'hint',
code,
- text
- }
+ text,
+ };
}
if (
- h.type === 'D' || h.type === 'U' || h.type === 'R' || h.type === 'N' ||
- h.type === 'Y' || h.type === 'Q' || h.type === 'P'
+ h.type === 'D' || h.type === 'U' || h.type === 'R' || h.type === 'N'
+ || h.type === 'Y' || h.type === 'Q' || h.type === 'P'
) {
// todo: how can we identify the individual types?
// todo: does `D` mean "disturbance"?
return {
type: 'status',
code,
- text
- }
+ text,
+ };
}
- return null
-}
+ return null;
+};
export {
parseHint,
-}
+};
diff --git a/parse/icon.js b/parse/icon.js
index fb190f06..16f763ee 100644
--- a/parse/icon.js
+++ b/parse/icon.js
@@ -1,14 +1,20 @@
const parseIcon = (ctx, i) => {
- if (i.res === 'Empty') return null
+ if (i.res === 'Empty') {
+ return null;
+ }
const res = {
type: i.res || null,
- title: i.text || i.txt || i.txtS || null
+ title: i.text || i.txt || i.txtS || null,
+ };
+ if (i.fg) {
+ res.fgColor = i.fg;
}
- if (i.fg) res.fgColor = i.fg
- if (i.bg) res.bgColor = i.bg
- return res
-}
+ if (i.bg) {
+ res.bgColor = i.bg;
+ }
+ return res;
+};
export {
parseIcon,
-}
+};
diff --git a/parse/journey-leg.js b/parse/journey-leg.js
index 9146a82b..8e66d345 100644
--- a/parse/journey-leg.js
+++ b/parse/journey-leg.js
@@ -1,43 +1,52 @@
-import {findRemarks} from './find-remarks.js'
+import {findRemarks} from './find-remarks.js';
-const clone = obj => Object.assign({}, obj)
+const clone = obj => Object.assign({}, obj);
const addRemark = (stopoverOrLeg, remark) => {
- if (!Array.isArray(stopoverOrLeg.remarks)) stopoverOrLeg.remarks = []
- stopoverOrLeg.remarks.push(remark)
-}
+ if (!Array.isArray(stopoverOrLeg.remarks)) {
+ stopoverOrLeg.remarks = [];
+ }
+ stopoverOrLeg.remarks.push(remark);
+};
const applyRemarks = (leg, refs) => {
for (let [remark, ref] of findRemarks(refs)) {
- const {fromLocation, toLocation} = ref
+ const {fromLocation, toLocation} = ref;
- let wholeLeg = true, fromI = 0, toI = 0
+ let wholeLeg = true, fromI = 0, toI = 0;
if (Array.isArray(leg.stopovers)) {
- toI = leg.stopovers.length - 1
+ toI = leg.stopovers.length - 1;
// this fails if `s.stop` is a new object (not reference-equal)
// todo: do this index- or ID-based
if (fromLocation) {
- fromI = leg.stopovers.findIndex(s => s.stop === fromLocation)
- if (fromI < 0) continue
+ fromI = leg.stopovers.findIndex(s => s.stop === fromLocation);
+ if (fromI < 0) {
+ continue;
+ }
}
if (toLocation) {
- toI = leg.stopovers.findIndex(s => s.stop === toLocation)
- if (toI < 0) continue
+ toI = leg.stopovers.findIndex(s => s.stop === toLocation);
+ if (toI < 0) {
+ continue;
+ }
}
- wholeLeg = fromI === 0 && toI === (leg.stopovers.length - 1)
+ wholeLeg = fromI === 0 && toI === leg.stopovers.length - 1;
}
- if (wholeLeg) addRemark(leg, remark)
- else {
+ if (wholeLeg) {
+ addRemark(leg, remark);
+ } else {
for (let i = fromI; i <= toI; i++) {
- const stopover = leg.stopovers[i]
- if (stopover) addRemark(stopover, remark)
+ const stopover = leg.stopovers[i];
+ if (stopover) {
+ addRemark(stopover, remark);
+ }
}
}
// todo: `ref.tagL`
}
-}
+};
// todo: pt.status, pt.isPartCncl
// todo: pt.chRatingRT, pt.chgDurR, pt.minChg
@@ -50,141 +59,167 @@ const applyRemarks = (leg, refs) => {
// todo: what is pt.jny.lPassSt?
const parseJourneyLeg = (ctx, pt, date) => { // pt = raw leg
- const {profile, opt} = ctx
+ const {profile, opt} = ctx;
const res = {
origin: clone(pt.dep.location) || null,
- destination: clone(pt.arr.location)
- }
+ destination: clone(pt.arr.location),
+ };
// HAFAS seems to have a bug where a journey's first leg has a `dTZOffset` of `0`.
// https://github.com/public-transport/hafas-client/issues/237
if (pt.type === 'WALK' && pt.dep.dTZOffset != pt.arr.aTZOffset) {
- if (pt.dep.dTZOffset == 0) pt.dep.dTZOffset = pt.arr.aTZOffset
- if (pt.arr.aTZOffset == 0) pt.arr.aTZOffset = pt.dep.dTZOffset
+ if (pt.dep.dTZOffset == 0) {
+ pt.dep.dTZOffset = pt.arr.aTZOffset;
+ }
+ if (pt.arr.aTZOffset == 0) {
+ pt.arr.aTZOffset = pt.dep.dTZOffset;
+ }
}
- const dep = profile.parseWhen(ctx, date, pt.dep.dTimeS, pt.dep.dTimeR, pt.dep.dTZOffset, pt.dep.dCncl)
- res.departure = dep.when
- res.plannedDeparture = dep.plannedWhen
+ const dep = profile.parseWhen(ctx, date, pt.dep.dTimeS, pt.dep.dTimeR, pt.dep.dTZOffset, pt.dep.dCncl);
+ res.departure = dep.when;
+ res.plannedDeparture = dep.plannedWhen;
// todo: pt.dep.dProgType
- res.departureDelay = dep.delay
- if (dep.prognosedWhen) res.prognosedDeparture = dep.prognosedWhen
+ res.departureDelay = dep.delay;
+ if (dep.prognosedWhen) {
+ res.prognosedDeparture = dep.prognosedWhen;
+ }
- const arr = profile.parseWhen(ctx, date, pt.arr.aTimeS, pt.arr.aTimeR, pt.arr.aTZOffset, pt.arr.aCncl)
- res.arrival = arr.when
- res.plannedArrival = arr.plannedWhen
+ const arr = profile.parseWhen(ctx, date, pt.arr.aTimeS, pt.arr.aTimeR, pt.arr.aTZOffset, pt.arr.aCncl);
+ res.arrival = arr.when;
+ res.plannedArrival = arr.plannedWhen;
// todo: pt.arr.aProgType
- res.arrivalDelay = arr.delay
- if (arr.prognosedWhen) res.prognosedArrival = arr.prognosedWhen
+ res.arrivalDelay = arr.delay;
+ if (arr.prognosedWhen) {
+ res.prognosedArrival = arr.prognosedWhen;
+ }
- if (pt.jny && ('isRchbl' in pt.jny)) {
- res.reachable = !!pt.jny.isRchbl
+ if (pt.jny && 'isRchbl' in pt.jny) {
+ res.reachable = Boolean(pt.jny.isRchbl);
}
if (pt.jny && pt.jny.polyline) {
- res.polyline = pt.jny.polyline || null
+ res.polyline = pt.jny.polyline || null;
} else if (pt.jny && pt.jny.poly) {
- res.polyline = profile.parsePolyline(ctx, pt.jny.poly)
+ res.polyline = profile.parsePolyline(ctx, pt.jny.poly);
}
if (pt.type === 'WALK' || pt.type === 'TRSF' || pt.type === 'DEVI' || pt.type === 'CHKI') {
- res.public = true
- res.walking = true
- res.distance = pt.gis && pt.gis.dist || null
- if (pt.type === 'TRSF') res.transfer = true
+ res.public = true;
+ res.walking = true;
+ res.distance = pt.gis && pt.gis.dist || null;
+ if (pt.type === 'TRSF') {
+ res.transfer = true;
+ }
if (pt.type === 'DEVI') {
// todo: pt.resState, pt.resRecommendation
- res.transfer = true
+ res.transfer = true;
+ }
+ if (pt.type === 'CHKI') {
+ res.checkin = true;
}
- if (pt.type === 'CHKI') res.checkin = true
// https://gist.github.com/derhuerst/426d4b95aeae701843b1e9c23105b8d4#file-tripsearch-2018-12-05-http-L4207-L4229
if (opt.remarks && pt.gis && Array.isArray(pt.gis.msgL)) {
- applyRemarks(res, pt.gis.msgL)
+ applyRemarks(res, pt.gis.msgL);
}
} else if (pt.type === 'JNY') {
// todo: pull `public` value from `profile.products`
- res.tripId = pt.jny.jid
- res.line = pt.jny.line || null
+ res.tripId = pt.jny.jid;
+ res.line = pt.jny.line || null;
// todo [breaking]: don't call parseStationName() here, add parseDirection() hook
// todo: support pt.jny.dirL[]
- res.direction = pt.jny.dirTxt && profile.parseStationName(ctx, pt.jny.dirTxt) || null
+ res.direction = pt.jny.dirTxt && profile.parseStationName(ctx, pt.jny.dirTxt) || null;
if (pt.jny.pos) {
res.currentLocation = {
type: 'location',
latitude: pt.jny.pos.y / 1000000,
longitude: pt.jny.pos.x / 1000000,
- }
+ };
}
- const arrPl = profile.parsePlatform(ctx, pt.arr.aPlatfS || (pt.arr.aPltfS !== undefined ? pt.arr.aPltfS.txt : null), pt.arr.aPlatfR || (pt.arr.aPltfR !== undefined ? pt.arr.aPltfR.txt : null), pt.arr.aCncl)
- res.arrivalPlatform = arrPl.platform
- res.plannedArrivalPlatform = arrPl.plannedPlatform
- if (arrPl.prognosedPlatform) res.prognosedArrivalPlatform = arrPl.prognosedPlatform
- res.arrivalPrognosisType = profile.parsePrognosisType(ctx, pt.arr.aProgType) || null
+ const arrPl = profile.parsePlatform(ctx, pt.arr.aPlatfS || (pt.arr.aPltfS !== undefined
+ ? pt.arr.aPltfS.txt
+ : null), pt.arr.aPlatfR || (pt.arr.aPltfR !== undefined
+ ? pt.arr.aPltfR.txt
+ : null), pt.arr.aCncl);
+ res.arrivalPlatform = arrPl.platform;
+ res.plannedArrivalPlatform = arrPl.plannedPlatform;
+ if (arrPl.prognosedPlatform) {
+ res.prognosedArrivalPlatform = arrPl.prognosedPlatform;
+ }
+ res.arrivalPrognosisType = profile.parsePrognosisType(ctx, pt.arr.aProgType) || null;
- const depPl = profile.parsePlatform(ctx, pt.dep.dPlatfS || (pt.dep.dPltfS !== undefined ? pt.dep.dPltfS.txt : null), pt.dep.dPlatfR || (pt.dep.dPltfR !== undefined ? pt.dep.dPltfR.txt : null), pt.dep.dCncl)
- res.departurePlatform = depPl.platform
- res.plannedDeparturePlatform = depPl.plannedPlatform
- if (depPl.prognosedPlatform) res.prognosedDeparturePlatform = depPl.prognosedPlatform
- res.departurePrognosisType = profile.parsePrognosisType(ctx, pt.dep.dProgType) || null
+ const depPl = profile.parsePlatform(ctx, pt.dep.dPlatfS || (pt.dep.dPltfS !== undefined
+ ? pt.dep.dPltfS.txt
+ : null), pt.dep.dPlatfR || (pt.dep.dPltfR !== undefined
+ ? pt.dep.dPltfR.txt
+ : null), pt.dep.dCncl);
+ res.departurePlatform = depPl.platform;
+ res.plannedDeparturePlatform = depPl.plannedPlatform;
+ if (depPl.prognosedPlatform) {
+ res.prognosedDeparturePlatform = depPl.prognosedPlatform;
+ }
+ res.departurePrognosisType = profile.parsePrognosisType(ctx, pt.dep.dProgType) || null;
if (opt.stopovers && pt.jny.stopL) {
- const stopL = pt.jny.stopL
- res.stopovers = stopL.map(s => profile.parseStopover(ctx, s, date))
+ const stopL = pt.jny.stopL;
+ res.stopovers = stopL.map(s => profile.parseStopover(ctx, s, date));
if (opt.remarks && Array.isArray(pt.jny.msgL)) {
- applyRemarks(res, pt.jny.msgL)
+ applyRemarks(res, pt.jny.msgL);
// todo: parse & use `code: EXTERNAL_ID` remarks?
}
// filter stations the train passes without stopping, as this doesn't comply with fptf (yet)
- res.stopovers = res.stopovers.filter((x) => !x.passBy)
+ res.stopovers = res.stopovers.filter((x) => !x.passBy);
} else if (opt.remarks && Array.isArray(pt.jny.msgL)) {
applyRemarks(res, pt.jny.msgL);
}
- const freq = pt.jny.freq || {}
+ const freq = pt.jny.freq || {};
// todo: expose `res.cycle` even if only one field exists (breaking)
// todo [breaking]: rename to something more intuitive, e.g. res.headways.{min,max,nrOfTrips}
if (freq.minC && freq.maxC) {
res.cycle = {
min: freq.minC * 60,
- max: freq.maxC * 60
- }
+ max: freq.maxC * 60,
+ };
// nr of connections in this frequency, from now on
- if (freq.numC) res.cycle.nr = freq.numC
+ if (freq.numC) {
+ res.cycle.nr = freq.numC;
+ }
}
if (freq.jnyL) {
const parseAlternative = (a) => {
// todo: parse this just like a `leg` (breaking)
// todo: parse `a.stopL`, `a.ctxRecon`, `a.msgL`
- const st0 = Array.isArray(a.stopL) && a.stopL[0] || {}
+ const st0 = Array.isArray(a.stopL) && a.stopL[0] || {};
const when = st0
? profile.parseWhen(ctx, date, st0.dTimeS, st0.dTimeR, st0.dTZOffset, st0.dCncl)
- : null
+ : null;
return {
tripId: a.jid,
line: a.line || null,
direction: a.dirTxt || null,
...when,
- }
- }
- res.alternatives = freq.jnyL.map(parseAlternative)
+ };
+ };
+ res.alternatives = freq.jnyL.map(parseAlternative);
}
}
if (pt.arr.aCncl || pt.dep.dCncl) {
- res.cancelled = true
- Object.defineProperty(res, 'canceled', {value: true})
+ res.cancelled = true;
+ Object.defineProperty(res, 'canceled', {value: true});
}
- return res
-}
+ return res;
+};
export {
parseJourneyLeg,
-}
+};
diff --git a/parse/journey.js b/parse/journey.js
index d672c903..b39fc7ee 100644
--- a/parse/journey.js
+++ b/parse/journey.js
@@ -1,4 +1,4 @@
-import {findRemarks} from './find-remarks.js'
+import {findRemarks} from './find-remarks.js';
// todo: c.conSubscr (e.g. `F`)
// todo: c.trfRes x vbb-parse-ticket
@@ -13,16 +13,16 @@ import {findRemarks} from './find-remarks.js'
// todo: c.intvlSubscr (e.g. `F`)
const parseJourney = (ctx, j) => { // j = raw jouney
- const {profile, opt} = ctx
+ const {profile, opt} = ctx;
- const legs = []
+ const legs = [];
for (const l of j.secL) {
- let date = j.date
+ let date = j.date;
// Next-day DEVI legs in an overnight journey lack both
// - the "01" prefix in {dep.d,arr.a}Time{S,R} and
// - the jny.trainStartDate field.
// However, we can use the previous leg's effective date.
- const prevLeg = legs[legs.length - 1] || null
+ const prevLeg = legs[legs.length - 1] || null;
if (l.type === 'DEVI' && prevLeg?.arrival) {
// todo: parse effective date from jny.ctxRecon/gis.ctx instead?
// todo: prefer plannedArrival?
@@ -30,40 +30,47 @@ const parseJourney = (ctx, j) => { // j = raw jouney
prevLeg.arrival.slice(0, 4), // year
prevLeg.arrival.slice(5, 7), // month
prevLeg.arrival.slice(8, 10), // day
- ].join('')
+ ].join('');
}
- const leg = profile.parseJourneyLeg(ctx, l, date)
- legs.push(leg)
+ const leg = profile.parseJourneyLeg(ctx, l, date);
+ legs.push(leg);
}
const res = {
type: 'journey',
legs,
- refreshToken: (j.recon && j.recon.ctx) || j.ctxRecon || null
- }
+ refreshToken: j.recon && j.recon.ctx || j.ctxRecon || null,
+ };
- const freq = j.freq || {}
+ const freq = j.freq || {};
if (freq.minC || freq.maxC) {
- res.cycle = {}
- if (freq.minC) res.cycle.min = freq.minC * 60
- if (freq.maxC) res.cycle.max = freq.maxC * 60
+ res.cycle = {};
+ if (freq.minC) {
+ res.cycle.min = freq.minC * 60;
+ }
+ if (freq.maxC) {
+ res.cycle.max = freq.maxC * 60;
+ }
// nr of connections in this frequency, from now on
- if (freq.numC) res.cycle.nr = freq.numC
+ if (freq.numC) {
+ res.cycle.nr = freq.numC;
+ }
}
if (opt.remarks && Array.isArray(j.msgL)) {
- res.remarks = findRemarks(j.msgL).map(([remark]) => remark)
+ res.remarks = findRemarks(j.msgL)
+ .map(([remark]) => remark);
}
if (opt.scheduledDays && j.sDays) {
// todo [breaking]: rename to scheduledDates
- res.scheduledDays = profile.parseScheduledDays(ctx, j.sDays)
+ res.scheduledDays = profile.parseScheduledDays(ctx, j.sDays);
}
- return res
-}
+ return res;
+};
export {
parseJourney,
-}
+};
diff --git a/parse/line.js b/parse/line.js
index c45bc911..995a15f1 100644
--- a/parse/line.js
+++ b/parse/line.js
@@ -1,54 +1,57 @@
-import slugg from 'slugg'
+import slugg from 'slugg';
const parseLine = ({profile}, p) => {
- if (!p) return null // todo: handle this upstream
- const name = p.line || p.addName || p.name || null // wtf
+ if (!p) {
+ return null;
+ } // todo: handle this upstream
+ const name = p.line || p.addName || p.name || null; // wtf
const res = {
type: 'line',
// This is terrible, but FPTF demands an ID. Let's pray for HAFAS.
- id: (
+ id:
p.prodCtx && p.prodCtx.lineId && slugg(p.prodCtx.lineId.trim())
|| name && slugg(name.trim())
- || null
- ),
+ || null,
// todo: what is p.prodCtx.matchId? use as `id`? expose it.
fahrtNr: p.prodCtx && p.prodCtx.num || null,
name,
- public: true
- }
+ public: true,
+ };
// todo: what is p.number?
// todo: what is p.prodCtx.catCode?
if (p.prodCtx && 'string' === typeof p.prodCtx.admin) {
- res.adminCode = p.prodCtx.admin
+ res.adminCode = p.prodCtx.admin;
}
if (p.prodCtx && 'string' === typeof p.prodCtx.catOut) {
const productName = p.prodCtx.catOut.trim();
- if (productName != "") {
+ if (productName != '') {
res.productName = productName;
}
}
if ('cls' in p) {
// todo: use profile.products.find() for this
- const byBitmask = []
+ const byBitmask = [];
for (let product of profile.products) {
for (let bitmask of product.bitmasks) {
- byBitmask[bitmask] = product
+ byBitmask[bitmask] = product;
}
}
// todo: what if `p.cls` is the sum of two bitmasks?
- const product = byBitmask[parseInt(p.cls)]
- res.mode = product && product.mode || null
- res.product = product && product.id || null
+ const product = byBitmask[parseInt(p.cls)];
+ res.mode = product && product.mode || null;
+ res.product = product && product.id || null;
}
- if (p.operator) res.operator = p.operator // todo: move up
- return res
-}
+ if (p.operator) {
+ res.operator = p.operator;
+ } // todo: move up
+ return res;
+};
export {
parseLine,
-}
+};
diff --git a/parse/location.js b/parse/location.js
index db4a3567..c62599da 100644
--- a/parse/location.js
+++ b/parse/location.js
@@ -1,11 +1,11 @@
-import {parse} from 'qs'
-import get from 'lodash/get.js'
+import {parse} from 'qs';
+import get from 'lodash/get.js';
-const POI = 'P'
-const STATION = 'S'
-const ADDRESS = 'A'
+const POI = 'P';
+const STATION = 'S';
+const ADDRESS = 'A';
-const leadingZeros = /^0+/
+const leadingZeros = /^0+/;
// todo: what is l.wt? is it "weight"?
// - `6733` for 8013074 with p/vmt
@@ -15,122 +15,154 @@ const leadingZeros = /^0+/
// todo: `i` param in `lid` (e.g. `A=1@O=Zöberitz@X=12033455@Y=51504612@U=80@L=8013414@i=A×de:15088:8013414@`)
const parseLocation = (ctx, l) => {
- const {profile, opt} = ctx
+ const {profile, opt} = ctx;
- const lid = parse(l.lid, {delimiter: '@'})
+ const lid = parse(l.lid, {delimiter: '@'});
const res = {
type: 'location',
- id: (l.extId || lid.L || '').replace(leadingZeros, '') || null
- }
+ id: (l.extId || lid.L || '').replace(leadingZeros, '') || null,
+ };
if (l.crd) {
- res.latitude = l.crd.y / 1000000
- res.longitude = l.crd.x / 1000000
- } else if (('X' in lid) && ('Y' in lid)) {
- res.latitude = lid.Y / 1000000
- res.longitude = lid.X / 1000000
+ res.latitude = l.crd.y / 1000000;
+ res.longitude = l.crd.x / 1000000;
+ } else if ('X' in lid && 'Y' in lid) {
+ res.latitude = lid.Y / 1000000;
+ res.longitude = lid.X / 1000000;
}
if (l.type === STATION) {
// todo: https://github.com/public-transport/hafas-client/issues/151
- const locL = get(ctx.res, ['common', 'locL'], [])
+ const locL = get(ctx.res, ['common', 'locL'], []);
- const mMastLocX = 'mMastLocX' in l ? l.mMastLocX : NaN
+ const mMastLocX = 'mMastLocX' in l
+ ? l.mMastLocX
+ : NaN;
const subStops = (l.stopLocL || [])
- .filter(locX => locX !== mMastLocX)
- .map(locX => locL[locX])
- .filter(s => !!s)
- .map(s => profile.parseLocation(ctx, s))
- .filter(stop => !!stop)
+ .filter(locX => locX !== mMastLocX)
+ .map(locX => locL[locX])
+ .filter(s => Boolean(s))
+ .map(s => profile.parseLocation(ctx, s))
+ .filter(stop => Boolean(stop));
const stop = {
- type: l.isMainMast || subStops.length > 0 ? 'station' : 'stop',
+ type: l.isMainMast || subStops.length > 0
+ ? 'station'
+ : 'stop',
id: res.id,
- name: l.name || lid.O ? profile.parseStationName(ctx, l.name || lid.O) : null,
- location: 'number' === typeof res.latitude ? res : null // todo: remove `.id`
+ name: l.name || lid.O
+ ? profile.parseStationName(ctx, l.name || lid.O)
+ : null,
+ location: 'number' === typeof res.latitude
+ ? res
+ : null, // todo: remove `.id`
+ };
+ if (opt.subStops && subStops.length > 0) {
+ stop.stops = subStops;
}
- if (opt.subStops && subStops.length > 0) stop.stops = subStops
- if ('pCls' in l) stop.products = profile.parseProductsBitmask(ctx, l.pCls)
- if ('meta' in l) stop.isMeta = !!l.meta
+ if ('pCls' in l) {
+ stop.products = profile.parseProductsBitmask(ctx, l.pCls);
+ }
+ if ('meta' in l) {
+ stop.isMeta = Boolean(l.meta);
+ }
- const mMastLoc = locL[mMastLocX]
+ const mMastLoc = locL[mMastLocX];
if (mMastLoc) {
stop.station = {
...profile.parseLocation(ctx, mMastLoc),
type: 'station', // todo: this should be handled differently
- }
+ };
}
if (opt.entrances) {
const entrances = (l.entryLocL || [])
- .map(locX => locL[locX])
- .filter(l => !!l)
- .map(l => profile.parseLocation(ctx, l))
- .filter(loc => !!loc)
- .map(loc => loc.location)
- if (entrances.length > 0) stop.entrances = entrances
+ .map(locX => locL[locX])
+ .filter(l => Boolean(l))
+ .map(l => profile.parseLocation(ctx, l))
+ .filter(loc => Boolean(loc))
+ .map(loc => loc.location);
+ if (entrances.length > 0) {
+ stop.entrances = entrances;
+ }
}
if (opt.linesOfStops && Array.isArray(l.lines)) {
- stop.lines = l.lines
+ stop.lines = l.lines;
}
const locHints = (l.remarkRefs || [])
- .filter(ref => !!ref.hint && Array.isArray(ref.tagL))
- .filter(({tagL}) => (
- tagL.includes('RES_LOC') ||
- tagL.find(t => t.slice(0, 8) === 'RES_LOC_') // e.g. `RES_LOC_H3`
- ))
- .map(ref => ref.hint)
+ .filter(ref => Boolean(ref.hint) && Array.isArray(ref.tagL))
+ .filter(({tagL}) => tagL.includes('RES_LOC')
+ || tagL.find(t => t.slice(0, 8) === 'RES_LOC_'), // e.g. `RES_LOC_H3`
+ )
+ .map(ref => ref.hint);
const hints = [
- ...(l.hints || []),
+ ...l.hints || [],
...locHints,
- ]
- const byType = type => hints.find(h => h.type === type)
+ ];
+ const byType = type => hints.find(h => h.type === type);
- const transitAuthority = (byType('transit-authority') || {}).text
- if (transitAuthority) stop.transitAuthority = transitAuthority
+ const transitAuthority = (byType('transit-authority') || {}).text;
+ if (transitAuthority) {
+ stop.transitAuthority = transitAuthority;
+ }
- const dhid = (byType('stop-dhid') || {}).text
+ const dhid = (byType('stop-dhid') || {}).text;
if (dhid) {
- if (!stop.ids) stop.ids = {}
- stop.ids.dhid = dhid
+ if (!stop.ids) {
+ stop.ids = {};
+ }
+ stop.ids.dhid = dhid;
}
const otherIds = hints
- .filter(h => h.type === 'foreign-id')
- .filter(h => 'string' === typeof h.text && h.text.includes(':'))
- .map(({text}) => {
- const i = text.indexOf(':')
- return [text.slice(0, i), text.slice(i + 1)]
- })
- .filter(([src]) => src !== 'NULL')
+ .filter(h => h.type === 'foreign-id')
+ .filter(h => 'string' === typeof h.text && h.text.includes(':'))
+ .map(({text}) => {
+ const i = text.indexOf(':');
+ return [text.slice(0, i), text.slice(i + 1)];
+ })
+ .filter(([src]) => src !== 'NULL');
if (otherIds.length > 0) {
- if (!stop.ids) stop.ids = {}
- for (const [src, id] of otherIds) stop.ids[src] = id
+ if (!stop.ids) {
+ stop.ids = {};
+ }
+ for (const [src, id] of otherIds) {
+ stop.ids[src] = id;
+ }
}
- return stop
+ return stop;
}
- if (l.type === ADDRESS) res.address = l.name
- else res.name = l.name
- if (l.type === POI) res.poi = true
+ if (l.type === ADDRESS) {
+ res.address = l.name;
+ } else {
+ res.name = l.name;
+ }
+ if (l.type === POI) {
+ res.poi = true;
+ }
- return res
-}
+ return res;
+};
// We use a "visited list" to prevent endless recursion.
// todo: can we use a WeakMap here?
-const seen = Symbol('parseLocation seen items')
+const seen = Symbol('parseLocation seen items');
const parseLocationWithoutCycles = (ctx, l, ...args) => {
- if (ctx[seen] && ctx[seen].includes(l)) return null
+ if (ctx[seen] && ctx[seen].includes(l)) {
+ return null;
+ }
- const newSeen = ctx[seen] ? [...ctx[seen], l] : [l]
- return parseLocation({...ctx, [seen]: newSeen}, l, ...args)
-}
+ const newSeen = ctx[seen]
+ ? [...ctx[seen], l]
+ : [l];
+ return parseLocation({...ctx, [seen]: newSeen}, l, ...args);
+};
export {
parseLocationWithoutCycles as parseLocation,
-}
+};
diff --git a/parse/movement.js b/parse/movement.js
index ac616f8c..ba9691c6 100644
--- a/parse/movement.js
+++ b/parse/movement.js
@@ -5,25 +5,28 @@
// todo: what is m.ani.dirGeo[n]? maybe the speed?
// todo: what is m.ani.proc[n]? wut?
const parseMovement = (ctx, m) => { // m = raw movement
- const {profile, opt} = ctx
+ const {profile, opt} = ctx;
const res = {
- direction: m.dirTxt ? profile.parseStationName(ctx, m.dirTxt) : null,
+ direction: m.dirTxt
+ ? profile.parseStationName(ctx, m.dirTxt)
+ : null,
tripId: m.jid || null,
line: m.line || null,
- location: m.pos ? {
- type: 'location',
- latitude: m.pos.y / 1000000,
- longitude: m.pos.x / 1000000
- } : null,
+ location: m.pos
+ ? {
+ type: 'location',
+ latitude: m.pos.y / 1000000,
+ longitude: m.pos.x / 1000000,
+ }
+ : null,
// todo: stopL[0] is the first of the trip! -> filter out
- nextStopovers: (
+ nextStopovers:
m.stopL
- .filter(s => !!s.location)
- .map(s => profile.parseStopover(ctx, s, m.date))
- ),
- frames: []
- }
+ .filter(s => Boolean(s.location))
+ .map(s => profile.parseStopover(ctx, s, m.date)),
+ frames: [],
+ };
if (m.ani) {
// todo: ani.dirGeo, ani.fLocX, ani.proc, ani.procAbs, ani.state, ani.stcOutputX
@@ -33,23 +36,23 @@ const parseMovement = (ctx, m) => { // m = raw movement
res.frames.push({
origin: m.ani.fromLocations[i] || null,
destination: m.ani.toLocations[i] || null,
- t: m.ani.mSec[i]
- })
+ t: m.ani.mSec[i],
+ });
}
}
if (opt.polylines) {
if (m.ani.poly) {
- res.polyline = profile.parsePolyline(ctx, m.ani.poly)
+ res.polyline = profile.parsePolyline(ctx, m.ani.poly);
} else if (m.ani.polyline) {
- res.polyline = m.ani.polyline
+ res.polyline = m.ani.polyline;
}
}
}
- return res
-}
+ return res;
+};
export {
parseMovement,
-}
+};
diff --git a/parse/nearby.js b/parse/nearby.js
index 26756600..68bbafef 100644
--- a/parse/nearby.js
+++ b/parse/nearby.js
@@ -5,11 +5,11 @@
// todo: what is s.dur?
const parseNearby = (ctx, n) => { // n = raw nearby location
- const res = ctx.profile.parseLocation(ctx, n)
- res.distance = n.dist
- return res
-}
+ const res = ctx.profile.parseLocation(ctx, n);
+ res.distance = n.dist;
+ return res;
+};
export {
parseNearby,
-}
+};
diff --git a/parse/operator.js b/parse/operator.js
index 07ac2e65..8e7a9918 100644
--- a/parse/operator.js
+++ b/parse/operator.js
@@ -1,15 +1,17 @@
-import slugg from 'slugg'
+import slugg from 'slugg';
const parseOperator = (ctx, a) => {
- const name = a.name && a.name.trim()
- if (!name) return null
+ const name = a.name && a.name.trim();
+ if (!name) {
+ return null;
+ }
return {
type: 'operator',
id: slugg(a.name), // todo: find a more reliable way
- name
- }
-}
+ name,
+ };
+};
export {
parseOperator,
-}
+};
diff --git a/parse/platform.js b/parse/platform.js
index 3fef0dea..fe2b9633 100644
--- a/parse/platform.js
+++ b/parse/platform.js
@@ -1,20 +1,20 @@
const parsePlatform = (ctx, platfS, platfR, cncl = false) => {
- let planned = platfS || null
- let prognosed = platfR || null
+ let planned = platfS || null;
+ let prognosed = platfR || null;
if (cncl) {
return {
platform: null,
plannedPlatform: planned,
- prognosedPlatform: prognosed
- }
+ prognosedPlatform: prognosed,
+ };
}
return {
platform: prognosed || planned,
- plannedPlatform: planned
- }
-}
+ plannedPlatform: planned,
+ };
+};
export {
parsePlatform,
-}
+};
diff --git a/parse/polyline.js b/parse/polyline.js
index 55164c78..8582ab3b 100644
--- a/parse/polyline.js
+++ b/parse/polyline.js
@@ -1,51 +1,60 @@
-import _googlePolyline from 'google-polyline'
-import distance from 'gps-distance'
+import _googlePolyline from 'google-polyline';
+import distance from 'gps-distance';
-const {decode} = _googlePolyline
+const {decode} = _googlePolyline;
// todo: what is p.delta?
// todo: what is p.type?
// todo: what is p.crdEncS?
// todo: what is p.crdEncF?
const parsePolyline = (ctx, p) => { // p = raw polyline
- const points = decode(p.crdEncYX)
- if (points.length === 0) return null
+ const points = decode(p.crdEncYX);
+ if (points.length === 0) {
+ return null;
+ }
const res = points.map(([lat, lon]) => ({
type: 'Feature',
properties: {},
geometry: {
type: 'Point',
- coordinates: [lon, lat]
- }
- }))
+ coordinates: [lon, lat],
+ },
+ }));
if (Array.isArray(p.ppLocRefL)) {
for (let ref of p.ppLocRefL) {
- const p = res[ref.ppIdx]
- if (p && ref.location) p.properties = ref.location
+ const p = res[ref.ppIdx];
+ if (p && ref.location) {
+ p.properties = ref.location;
+ }
}
// Often there is one more point right next to each point at a station.
// We filter them here if they are < 5m from each other.
for (let i = 1; i < res.length; i++) {
- const p1 = res[i - 1].geometry.coordinates
- const p2 = res[i].geometry.coordinates
- const d = distance(p1[1], p1[0], p2[1], p2[0])
- if (d >= .005) continue
- const l1 = Object.keys(res[i - 1].properties).length
- const l2 = Object.keys(res[i].properties).length
- if (l1 === 0 && l2 > 0) res.splice(i - 1, 1)
- else if (l2 === 0 && l1 > 0) res.splice(i, 1)
+ const p1 = res[i - 1].geometry.coordinates;
+ const p2 = res[i].geometry.coordinates;
+ const d = distance(p1[1], p1[0], p2[1], p2[0]);
+ if (d >= 0.005) {
+ continue;
+ }
+ const l1 = Object.keys(res[i - 1].properties).length;
+ const l2 = Object.keys(res[i].properties).length;
+ if (l1 === 0 && l2 > 0) {
+ res.splice(i - 1, 1);
+ } else if (l2 === 0 && l1 > 0) {
+ res.splice(i, 1);
+ }
}
}
return {
type: 'FeatureCollection',
- features: res
- }
-}
+ features: res,
+ };
+};
export {
parsePolyline,
-}
+};
diff --git a/parse/products-bitmask.js b/parse/products-bitmask.js
index f9f335ba..550407ac 100644
--- a/parse/products-bitmask.js
+++ b/parse/products-bitmask.js
@@ -1,17 +1,26 @@
const parseBitmask = ({profile}, bitmask) => {
- const res = {}
- for (let product of profile.products) res[product.id] = false
-
- const bits = bitmask.toString(2).split('').map(i => parseInt(i)).reverse()
- for (let i = 0; i < bits.length; i++) {
- if (!bits[i]) continue // ignore `0`
-
- const product = profile.products.find(p => p.bitmasks.includes(Math.pow(2, i)))
- if (product) res[product.id] = true
+ const res = {};
+ for (let product of profile.products) {
+ res[product.id] = false;
}
- return res
-}
+
+ const bits = bitmask.toString(2)
+ .split('')
+ .map(i => parseInt(i))
+ .reverse();
+ for (let i = 0; i < bits.length; i++) {
+ if (!bits[i]) {
+ continue;
+ } // ignore `0`
+
+ const product = profile.products.find(p => p.bitmasks.includes(Math.pow(2, i)));
+ if (product) {
+ res[product.id] = true;
+ }
+ }
+ return res;
+};
export {
parseBitmask,
-}
+};
diff --git a/parse/prognosis-type.js b/parse/prognosis-type.js
index 057f044e..dbb462a8 100644
--- a/parse/prognosis-type.js
+++ b/parse/prognosis-type.js
@@ -1,11 +1,11 @@
const parsePrognosisType = (_, progType) => {
return {
- 'PROGNOSED': 'prognosed',
- 'CALCULATED': 'calculated',
+ PROGNOSED: 'prognosed',
+ CALCULATED: 'calculated',
// todo: are there more?
- }[progType] || null
-}
+ }[progType] || null;
+};
export {
parsePrognosisType,
-}
+};
diff --git a/parse/scheduled-days.js b/parse/scheduled-days.js
index 20266f4f..474c59de 100644
--- a/parse/scheduled-days.js
+++ b/parse/scheduled-days.js
@@ -1,4 +1,4 @@
-import {DateTime} from 'luxon'
+import {DateTime} from 'luxon';
// todo: DRY with parse/date-time.js
const parseDate = (date) => {
@@ -6,40 +6,42 @@ const parseDate = (date) => {
year: parseInt(date.substr(-8, 4)),
month: parseInt(date.substr(-4, 2)),
day: parseInt(date.substr(-2, 2)),
- }
+ };
if (!Number.isInteger(res.year) || !Number.isInteger(res.month) || !Number.isInteger(res.day)) {
- throw new Error('invalid date format: ' + date)
+ throw new Error('invalid date format: ' + date);
}
- return res
-}
+ return res;
+};
const parseScheduledDays = (ctx, sDays) => {
- const {profile} = ctx
+ const {profile} = ctx;
// sDaysB is a bitmap mapping all days from fpB (first date of schedule) to fpE (last date in schedule).
- const {fpB, fpE} = ctx.res
- if (!sDays.sDaysB || !fpB || !fpE) return null
+ const {fpB, fpE} = ctx.res;
+ if (!sDays.sDaysB || !fpB || !fpE) {
+ return null;
+ }
- const sDaysB = Buffer.from(sDays.sDaysB, 'hex')
- const res = Object.create(null)
+ const sDaysB = Buffer.from(sDays.sDaysB, 'hex');
+ const res = Object.create(null);
- const _fpB = parseDate(fpB)
+ const _fpB = parseDate(fpB);
let d = DateTime.fromObject({
year: _fpB.year, month: _fpB.month, day: _fpB.day,
- hour: 0, minute: 0, second: 0, millisecond: 0
+ hour: 0, minute: 0, second: 0, millisecond: 0,
}, {
zone: profile.timezone,
locale: profile.locale,
- })
+ });
for (let b = 0; b < sDaysB.length; b++) {
for (let i = 0; i < 8; i++) {
- res[d.toISODate()] = (sDaysB[b] & Math.pow(2, 7 - i)) > 0
- d = d.plus({days: 1})
+ res[d.toISODate()] = (sDaysB[b] & Math.pow(2, 7 - i)) > 0;
+ d = d.plus({days: 1});
}
}
- return res
-}
+ return res;
+};
export {
parseScheduledDays,
-}
+};
diff --git a/parse/stopover.js b/parse/stopover.js
index ba5e2cce..392f8f3b 100644
--- a/parse/stopover.js
+++ b/parse/stopover.js
@@ -1,12 +1,12 @@
-import {findRemarks} from './find-remarks.js'
+import {findRemarks} from './find-remarks.js';
const parseStopover = (ctx, st, date) => { // st = raw stopover
- const {profile, opt} = ctx
+ const {profile, opt} = ctx;
- const arr = profile.parseWhen(ctx, date, st.aTimeS, st.aTimeR, st.aTZOffset, st.aCncl)
- const arrPl = profile.parsePlatform(ctx, st.aPlatfS || (st.aPltfS && st.aPltfS.txt) || null, st.aPlatfR || (st.aPltfR && st.aPltfR.txt) || null, st.aCncl)
- const dep = profile.parseWhen(ctx, date, st.dTimeS, st.dTimeR, st.dTZOffset, st.dCncl)
- const depPl = profile.parsePlatform(ctx, st.dPlatfS || (st.dPltfS && st.dPltfS.txt) || null, st.dPlatfR || (st.dPltfR && st.dPltfR.txt) || null, st.dCncl)
+ const arr = profile.parseWhen(ctx, date, st.aTimeS, st.aTimeR, st.aTZOffset, st.aCncl);
+ const arrPl = profile.parsePlatform(ctx, st.aPlatfS || st.aPltfS && st.aPltfS.txt || null, st.aPlatfR || st.aPltfR && st.aPltfR.txt || null, st.aCncl);
+ const dep = profile.parseWhen(ctx, date, st.dTimeS, st.dTimeR, st.dTZOffset, st.dCncl);
+ const depPl = profile.parsePlatform(ctx, st.dPlatfS || st.dPltfS && st.dPltfS.txt || null, st.dPlatfR || st.dPltfR && st.dPltfR.txt || null, st.dCncl);
const res = {
stop: st.location || null,
@@ -21,33 +21,44 @@ const parseStopover = (ctx, st, date) => { // st = raw stopover
departureDelay: dep.delay,
departurePlatform: depPl.platform,
departurePrognosisType: profile.parsePrognosisType(ctx, st.dProgType),
- plannedDeparturePlatform: depPl.plannedPlatform
- }
+ plannedDeparturePlatform: depPl.plannedPlatform,
+ };
- if (arr.prognosedWhen) res.prognosedArrival = arr.prognosedWhen
- if (arrPl.prognosedPlatform) res.prognosedArrivalPlatform = arrPl.prognosedPlatform
- if (dep.prognosedWhen) res.prognosedDeparture = dep.prognosedWhen
- if (depPl.prognosedPlatform) res.prognosedDeparturePlatform = depPl.prognosedPlatform
+ if (arr.prognosedWhen) {
+ res.prognosedArrival = arr.prognosedWhen;
+ }
+ if (arrPl.prognosedPlatform) {
+ res.prognosedArrivalPlatform = arrPl.prognosedPlatform;
+ }
+ if (dep.prognosedWhen) {
+ res.prognosedDeparture = dep.prognosedWhen;
+ }
+ if (depPl.prognosedPlatform) {
+ res.prognosedDeparturePlatform = depPl.prognosedPlatform;
+ }
// mark stations the train passes without stopping
- if(st.dInS === false && st.aOutS === false) res.passBy = true
+ if (st.dInS === false && st.aOutS === false) {
+ res.passBy = true;
+ }
if (st.aCncl || st.dCncl) {
- res.cancelled = true
- Object.defineProperty(res, 'canceled', {value: true})
+ res.cancelled = true;
+ Object.defineProperty(res, 'canceled', {value: true});
}
- if (st.isAdd) {
- res.additional = true
- }
+ if (st.isAdd) {
+ res.additional = true;
+ }
if (opt.remarks && Array.isArray(st.msgL)) {
- res.remarks = findRemarks(st.msgL).map(([remark]) => remark)
+ res.remarks = findRemarks(st.msgL)
+ .map(([remark]) => remark);
}
- return res
-}
+ return res;
+};
export {
parseStopover,
-}
+};
diff --git a/parse/trip.js b/parse/trip.js
index 76bfd000..eef80bf8 100644
--- a/parse/trip.js
+++ b/parse/trip.js
@@ -1,9 +1,9 @@
-import minBy from 'lodash/minBy.js'
-import maxBy from 'lodash/maxBy.js'
-import last from 'lodash/last.js'
+import minBy from 'lodash/minBy.js';
+import maxBy from 'lodash/maxBy.js';
+import last from 'lodash/last.js';
const parseTrip = (ctx, t) => { // t = raw trip
- const {profile, opt} = ctx
+ const {profile, opt} = ctx;
// pretend the trip is a leg in a journey
const fakeLeg = {
@@ -15,35 +15,39 @@ const parseTrip = (ctx, t) => { // t = raw trip
? maxBy(t.stopL, 'idx') || last(t.stopL)
: {},
jny: t,
- }
+ };
// todo: this breaks if the trip starts on a different day
// how does HAFAS do this?
- const today = () => profile.formatDate(profile, Date.now())
- const date = t.date || today()
+ const today = () => profile.formatDate(profile, Date.now());
+ const date = t.date || today();
- const trip = profile.parseJourneyLeg(ctx, fakeLeg, date)
- trip.id = trip.tripId
- delete trip.tripId
- delete trip.reachable
+ const trip = profile.parseJourneyLeg(ctx, fakeLeg, date);
+ trip.id = trip.tripId;
+ delete trip.tripId;
+ delete trip.reachable;
if (opt.scheduledDays) {
- const nrOfStopovers = t.stopL.length
+ const nrOfStopovers = t.stopL.length;
// trips seem to use sDaysL[], journeys use sDays
- const sDaysL = Array.isArray(t.sDaysL) ? t.sDaysL : []
+ const sDaysL = Array.isArray(t.sDaysL)
+ ? t.sDaysL
+ : [];
const matchingSDays = sDaysL.filter((sDays) => {
- return sDays.fLocIdx === 0 && sDays.tLocIdx === (nrOfStopovers - 1)
- })
+ return sDays.fLocIdx === 0 && sDays.tLocIdx === nrOfStopovers - 1;
+ });
// if there are >1 sDays, we don't know how to interpret them
- const sDays = matchingSDays.length === 1 ? matchingSDays[0] : null
+ const sDays = matchingSDays.length === 1
+ ? matchingSDays[0]
+ : null;
// todo [breaking]: rename to scheduledDates
- trip.scheduledDays = profile.parseScheduledDays(ctx, sDays)
+ trip.scheduledDays = profile.parseScheduledDays(ctx, sDays);
}
- return trip
-}
+ return trip;
+};
export {
parseTrip,
-}
+};
diff --git a/parse/warning.js b/parse/warning.js
index d478827e..888abcf2 100644
--- a/parse/warning.js
+++ b/parse/warning.js
@@ -1,36 +1,38 @@
-import brToNewline from '@derhuerst/br2nl'
-import omit from 'lodash/omit.js'
+import brToNewline from '@derhuerst/br2nl';
+import omit from 'lodash/omit.js';
const typesByIcon = Object.assign(Object.create(null), {
- HimWarn: 'status'
-})
+ HimWarn: 'status',
+});
const parseMsgEdge = (ctx) => (e) => {
const res = omit(e, [
'icoX',
- 'fLocX', 'fromLocation',
- 'tLocX', 'toLocation'
- ])
- res.icon = e.icon || null
- res.fromLocation = Array.isArray(e.fromLocations) && e.fromLocations[0] || e.fromLocation || null
- res.toLocation = Array.isArray(e.toLocations) && e.toLocations[0] || e.toLocation || null
- return res
-}
+ 'fLocX',
+ 'fromLocation',
+ 'tLocX',
+ 'toLocation',
+ ]);
+ res.icon = e.icon || null;
+ res.fromLocation = Array.isArray(e.fromLocations) && e.fromLocations[0] || e.fromLocation || null;
+ res.toLocation = Array.isArray(e.toLocations) && e.toLocations[0] || e.toLocation || null;
+ return res;
+};
-const fallbackTime = '000000' // midnight
+const fallbackTime = '000000'; // midnight
const parseMsgEvent = (ctx) => (e) => {
- const {profile} = ctx // todo: test that covers this
+ const {profile} = ctx; // todo: test that covers this
return {
fromLocation: Array.isArray(e.fromLocations) && e.fromLocations[0] || e.fromLocation || null,
toLocation: Array.isArray(e.toLocations) && e.toLocations[0] || e.toLocation || null,
start: profile.parseDateTime(ctx, e.fDate, e.fTime || fallbackTime, null),
end: profile.parseDateTime(ctx, e.tDate, e.tTime || fallbackTime, null),
- sections: e.sectionNums || [] // todo: parse
- }
-}
+ sections: e.sectionNums || [], // todo: parse
+ };
+};
const parseWarning = (ctx, w) => {
- const {profile, res: resp, common} = ctx
+ const {profile, res: resp, common} = ctx;
// todo: https://github.com/marudor/BahnhofsAbfahrten/blob/46a74957d68edc15713112df44e1a25150f5a178/src/types/HAFAS/HimSearch.ts#L31-L53
// todo: act, pub, lead, tckr
@@ -53,57 +55,77 @@ const parseWarning = (ctx, w) => {
// tTime: '120000' }
// todo: w.regionRefL & res.common.himMsgRegionL
- const icon = w.icon || null
- const type = icon && icon.type && typesByIcon[icon.type] || 'warning'
+ const icon = w.icon || null;
+ const type = icon && icon.type && typesByIcon[icon.type] || 'warning';
const res = {
id: w.hid || null,
type,
- summary: w.head ? brToNewline(w.head) : null, // todo: decode HTML entities?
- text: w.text ? brToNewline(w.text) : null, // todo: decode HTML entities?
+ summary: w.head
+ ? brToNewline(w.head)
+ : null, // todo: decode HTML entities?
+ text: w.text
+ ? brToNewline(w.text)
+ : null, // todo: decode HTML entities?
icon, // todo: parse icon
priority: w.prio,
+ };
+ if ('prod' in w) {
+ res.products = profile.parseProductsBitmask(ctx, w.prod);
+ }
+ if ('comp' in w) {
+ res.company = w.comp || null;
}
- if ('prod' in w) res.products = profile.parseProductsBitmask(ctx, w.prod)
- if ('comp' in w) res.company = w.comp || null
// todo: parse to sth meaningful
- if ('cat' in w) res.category = w.cat
+ if ('cat' in w) {
+ res.category = w.cat;
+ }
if (w.catRefL && resp.common && resp.common.himMsgCatL) {
res.categories = w.catRefL
- .map(i => resp.common.himMsgCatL[i])
- .filter(e => !!e)
- .map(cat => cat.id)
+ .map(i => resp.common.himMsgCatL[i])
+ .filter(e => Boolean(e))
+ .map(cat => cat.id);
}
if (w.edgeRefL && resp.common && resp.common.himMsgEdgeL) {
res.edges = w.edgeRefL
- .map(i => resp.common.himMsgEdgeL[i])
- .filter(e => !!e)
- .map(parseMsgEdge(ctx))
+ .map(i => resp.common.himMsgEdgeL[i])
+ .filter(e => Boolean(e))
+ .map(parseMsgEdge(ctx));
}
if (w.eventRefL && resp.common && resp.common.himMsgEventL) {
res.events = w.eventRefL
- .map(i => resp.common.himMsgEventL[i])
- .filter(e => !!e)
- .map(parseMsgEvent(ctx))
+ .map(i => resp.common.himMsgEventL[i])
+ .filter(e => Boolean(e))
+ .map(parseMsgEvent(ctx));
}
if (w.affProdRefL) {
res.affectedLines = w.affProdRefL
- .map(i => common.lines[i])
- .filter(l => !!l)
+ .map(i => common.lines[i])
+ .filter(l => Boolean(l));
+ }
+ if (w.fromLocations) {
+ res.fromStops = w.fromLocations;
+ }
+ if (w.toLocations) {
+ res.toStops = w.toLocations;
}
- if (w.fromLocations) res.fromStops = w.fromLocations
- if (w.toLocations) res.toStops = w.toLocations
- if (w.sDate && w.sTime) res.validFrom = profile.parseDateTime(ctx, w.sDate, w.sTime, null)
- if (w.eDate && w.eTime) res.validUntil = profile.parseDateTime(ctx, w.eDate, w.eTime, null)
- if (w.lModDate && w.lModTime) res.modified = profile.parseDateTime(ctx, w.lModDate, w.lModTime, null)
+ if (w.sDate && w.sTime) {
+ res.validFrom = profile.parseDateTime(ctx, w.sDate, w.sTime, null);
+ }
+ if (w.eDate && w.eTime) {
+ res.validUntil = profile.parseDateTime(ctx, w.eDate, w.eTime, null);
+ }
+ if (w.lModDate && w.lModTime) {
+ res.modified = profile.parseDateTime(ctx, w.lModDate, w.lModTime, null);
+ }
- return res
-}
+ return res;
+};
export {
parseWarning,
-}
+};
diff --git a/parse/when.js b/parse/when.js
index 3d339e9c..f79aaa8c 100644
--- a/parse/when.js
+++ b/parse/when.js
@@ -1,14 +1,18 @@
const parseWhen = (ctx, date, timeS, timeR, tzOffset, cncl = false) => {
- const parse = ctx.profile.parseDateTime
+ const parse = ctx.profile.parseDateTime;
- let planned = timeS ? parse(ctx, date, timeS, tzOffset, false) : null
- let prognosed = timeR ? parse(ctx, date, timeR, tzOffset, false) : null
- let delay = null
+ let planned = timeS
+ ? parse(ctx, date, timeS, tzOffset, false)
+ : null;
+ let prognosed = timeR
+ ? parse(ctx, date, timeR, tzOffset, false)
+ : null;
+ let delay = null;
if (planned && prognosed) {
- const tPlanned = parse(ctx, date, timeS, tzOffset, true)
- const tPrognosed = parse(ctx, date, timeR, tzOffset, true)
- delay = Math.round((tPrognosed - tPlanned) / 1000)
+ const tPlanned = parse(ctx, date, timeS, tzOffset, true);
+ const tPrognosed = parse(ctx, date, timeR, tzOffset, true);
+ delay = Math.round((tPrognosed - tPlanned) / 1000);
}
if (cncl) {
@@ -16,16 +20,16 @@ const parseWhen = (ctx, date, timeS, timeR, tzOffset, cncl = false) => {
when: null,
plannedWhen: planned,
prognosedWhen: prognosed,
- delay
- }
+ delay,
+ };
}
return {
when: prognosed || planned,
plannedWhen: planned,
- delay
- }
-}
+ delay,
+ };
+};
export {
parseWhen,
-}
+};
diff --git a/retry.js b/retry.js
index 3fde5b15..4b9e4dbe 100644
--- a/retry.js
+++ b/retry.js
@@ -1,39 +1,41 @@
-import retry from 'p-retry'
-import {defaultProfile} from './lib/default-profile.js'
+import retry from 'p-retry';
+import {defaultProfile} from './lib/default-profile.js';
const retryDefaults = {
retries: 3,
factor: 3,
- minTimeout: 5 * 1000
-}
+ minTimeout: 5 * 1000,
+};
const withRetrying = (profile, retryOpts = {}) => {
- retryOpts = Object.assign({}, retryDefaults, retryOpts)
+ retryOpts = Object.assign({}, retryDefaults, retryOpts);
// https://github.com/public-transport/hafas-client/issues/76#issuecomment-574408717
- const {request} = {...defaultProfile, ...profile}
+ const {request} = {...defaultProfile, ...profile};
const retryingRequest = (...args) => {
const attempt = () => {
return request(...args)
- .catch((err) => {
- if (err.isHafasError) throw err // continue
- if (err.code === 'ENOTFOUND') { // abort
- const abortErr = new retry.AbortError(err)
- Object.assign(abortErr, err)
- throw abortErr
- }
- throw err // continue
- })
- }
- return retry(attempt, retryOpts)
- }
+ .catch((err) => {
+ if (err.isHafasError) {
+ throw err;
+ } // continue
+ if (err.code === 'ENOTFOUND') { // abort
+ const abortErr = new retry.AbortError(err);
+ Object.assign(abortErr, err);
+ throw abortErr;
+ }
+ throw err; // continue
+ });
+ };
+ return retry(attempt, retryOpts);
+ };
return {
...profile,
- request: retryingRequest
- }
-}
+ request: retryingRequest,
+ };
+};
export {
withRetrying,
-}
+};
diff --git a/test/bvg-arrivals.js b/test/bvg-arrivals.js
index bee83e94..a006689e 100644
--- a/test/bvg-arrivals.js
+++ b/test/bvg-arrivals.js
@@ -1,17 +1,17 @@
// todo: use import assertions once they're supported by Node.js & ESLint
// https://github.com/tc39/proposal-import-assertions
-import {createRequire} from 'module'
-const require = createRequire(import.meta.url)
+import {createRequire} from 'module';
+const require = createRequire(import.meta.url);
-import tap from 'tap'
+import tap from 'tap';
-import {createClient} from '../index.js'
-import {profile as rawProfile} from '../p/bvg/index.js'
-const res = require('./fixtures/bvg-arrivals.json')
-import {bvgArrivals as expected} from './fixtures/bvg-arrivals.js'
+import {createClient} from '../index.js';
+import {profile as rawProfile} from '../p/bvg/index.js';
+const res = require('./fixtures/bvg-arrivals.json');
+import {bvgArrivals as expected} from './fixtures/bvg-arrivals.js';
-const client = createClient(rawProfile, 'public-transport/hafas-client:test')
-const {profile} = client
+const client = createClient(rawProfile, 'public-transport/hafas-client:test');
+const {profile} = client;
const opt = {
direction: null,
@@ -21,14 +21,14 @@ const opt = {
stopovers: true,
includeRelatedStations: true,
when: '2021-10-28T10:35:00+02:00',
- products: {}
-}
+ products: {},
+};
tap.test('parses an arrival correctly (BVG)', (t) => {
- const common = profile.parseCommon({profile, opt, res})
- const ctx = {profile, opt, common, res}
- const arrivals = res.jnyL.map(d => profile.parseArrival(ctx, d))
+ const common = profile.parseCommon({profile, opt, res});
+ const ctx = {profile, opt, common, res};
+ const arrivals = res.jnyL.map(d => profile.parseArrival(ctx, d));
- t.same(arrivals, expected)
- t.end()
-})
+ t.same(arrivals, expected);
+ t.end();
+});
diff --git a/test/bvg-journey.js b/test/bvg-journey.js
index 009b2bcb..0054972b 100644
--- a/test/bvg-journey.js
+++ b/test/bvg-journey.js
@@ -1,17 +1,17 @@
// todo: use import assertions once they're supported by Node.js & ESLint
// https://github.com/tc39/proposal-import-assertions
-import {createRequire} from 'module'
-const require = createRequire(import.meta.url)
+import {createRequire} from 'module';
+const require = createRequire(import.meta.url);
-import tap from 'tap'
+import tap from 'tap';
-import {createClient} from '../index.js'
-import {profile as rawProfile} from '../p/bvg/index.js'
-const res = require('./fixtures/bvg-journey.json')
-import {bvgJourney as expected} from './fixtures/bvg-journey.js'
+import {createClient} from '../index.js';
+import {profile as rawProfile} from '../p/bvg/index.js';
+const res = require('./fixtures/bvg-journey.json');
+import {bvgJourney as expected} from './fixtures/bvg-journey.js';
-const client = createClient(rawProfile, 'public-transport/hafas-client:test')
-const {profile} = client
+const client = createClient(rawProfile, 'public-transport/hafas-client:test');
+const {profile} = client;
const opt = {
results: null,
@@ -28,14 +28,14 @@ const opt = {
startWithWalking: true,
scheduledDays: true,
departure: '2019-08-18T14:03:50+02:00',
- products: {}
-}
+ products: {},
+};
tap.test('parses a journey correctly (BVG)', (t) => {
- const common = profile.parseCommon({profile, opt, res})
- const ctx = {profile, opt, common, res}
- const journey = profile.parseJourney(ctx, res.outConL[0])
+ const common = profile.parseCommon({profile, opt, res});
+ const ctx = {profile, opt, common, res};
+ const journey = profile.parseJourney(ctx, res.outConL[0]);
- t.same(journey, expected)
- t.end()
-})
+ t.same(journey, expected);
+ t.end();
+});
diff --git a/test/bvg-radar.js b/test/bvg-radar.js
index 75f09435..ab02faec 100644
--- a/test/bvg-radar.js
+++ b/test/bvg-radar.js
@@ -1,17 +1,17 @@
// todo: use import assertions once they're supported by Node.js & ESLint
// https://github.com/tc39/proposal-import-assertions
-import {createRequire} from 'module'
-const require = createRequire(import.meta.url)
+import {createRequire} from 'module';
+const require = createRequire(import.meta.url);
-import tap from 'tap'
+import tap from 'tap';
-import {createClient} from '../index.js'
-import {profile as rawProfile} from '../p/bvg/index.js'
-const res = require('./fixtures/bvg-radar.json')
-import {bvgRadar as expected} from './fixtures/bvg-radar.js'
+import {createClient} from '../index.js';
+import {profile as rawProfile} from '../p/bvg/index.js';
+const res = require('./fixtures/bvg-radar.json');
+import {bvgRadar as expected} from './fixtures/bvg-radar.js';
-const client = createClient(rawProfile, 'public-transport/hafas-client:test')
-const {profile} = client
+const client = createClient(rawProfile, 'public-transport/hafas-client:test');
+const {profile} = client;
const opt = {
results: 256,
@@ -19,14 +19,14 @@ const opt = {
frames: 3,
polylines: true,
when: '2019-08-19T21:00:00+02:00',
- products: {}
-}
+ products: {},
+};
tap.test('parses a radar() response correctly (BVG)', (t) => {
- const common = profile.parseCommon({profile, opt, res})
- const ctx = {profile, opt, common, res}
- const movements = res.jnyL.map(m => profile.parseMovement(ctx, m))
+ const common = profile.parseCommon({profile, opt, res});
+ const ctx = {profile, opt, common, res};
+ const movements = res.jnyL.map(m => profile.parseMovement(ctx, m));
- t.same(movements, expected)
- t.end()
-})
+ t.same(movements, expected);
+ t.end();
+});
diff --git a/test/bvg-trip-with-occupancy.js b/test/bvg-trip-with-occupancy.js
index 8e4da50f..dca4b3f0 100644
--- a/test/bvg-trip-with-occupancy.js
+++ b/test/bvg-trip-with-occupancy.js
@@ -1,17 +1,17 @@
// todo: use import assertions once they're supported by Node.js & ESLint
// https://github.com/tc39/proposal-import-assertions
-import {createRequire} from 'module'
-const require = createRequire(import.meta.url)
+import {createRequire} from 'module';
+const require = createRequire(import.meta.url);
-import tap from 'tap'
+import tap from 'tap';
-import {createClient} from '../index.js'
-import {profile as rawProfile} from '../p/bvg/index.js'
-const res = require('./fixtures/bvg-trip-with-occupancy.json')
-import {bvgTripWithOccupancy as expected} from './fixtures/bvg-trip-with-occupancy.js'
+import {createClient} from '../index.js';
+import {profile as rawProfile} from '../p/bvg/index.js';
+const res = require('./fixtures/bvg-trip-with-occupancy.json');
+import {bvgTripWithOccupancy as expected} from './fixtures/bvg-trip-with-occupancy.js';
-const client = createClient(rawProfile, 'public-transport/hafas-client:test')
-const {profile} = client
+const client = createClient(rawProfile, 'public-transport/hafas-client:test');
+const {profile} = client;
const opt = {
stopovers: true,
@@ -21,13 +21,13 @@ const opt = {
remarks: true,
scheduledDays: true,
when: '2021-10-28T09:28:00+02:00',
-}
+};
tap.test('parses an trip with occupancy correctly (BVG)', (t) => {
- const common = profile.parseCommon({profile, opt, res})
- const ctx = {profile, opt, common, res}
- const trip = profile.parseTrip(ctx, res.journey)
+ const common = profile.parseCommon({profile, opt, res});
+ const ctx = {profile, opt, common, res};
+ const trip = profile.parseTrip(ctx, res.journey);
- t.same(trip, expected)
- t.end()
-})
+ t.same(trip, expected);
+ t.end();
+});
diff --git a/test/db-arrivals.js b/test/db-arrivals.js
index a8265255..636aa774 100644
--- a/test/db-arrivals.js
+++ b/test/db-arrivals.js
@@ -1,17 +1,17 @@
// todo: use import assertions once they're supported by Node.js & ESLint
// https://github.com/tc39/proposal-import-assertions
-import {createRequire} from 'module'
-const require = createRequire(import.meta.url)
+import {createRequire} from 'module';
+const require = createRequire(import.meta.url);
-import tap from 'tap'
+import tap from 'tap';
-import {createClient} from '../index.js'
-import {profile as rawProfile} from '../p/db/index.js'
-const res = require('./fixtures/db-arrivals.json')
-import {dbArrivals as expected} from './fixtures/db-arrivals.js'
+import {createClient} from '../index.js';
+import {profile as rawProfile} from '../p/db/index.js';
+const res = require('./fixtures/db-arrivals.json');
+import {dbArrivals as expected} from './fixtures/db-arrivals.js';
-const client = createClient(rawProfile, 'public-transport/hafas-client:test')
-const {profile} = client
+const client = createClient(rawProfile, 'public-transport/hafas-client:test');
+const {profile} = client;
const opt = {
direction: null,
@@ -21,14 +21,14 @@ const opt = {
stopovers: true,
includeRelatedStations: true,
when: '2019-08-19T20:30:00+02:00',
- products: {}
-}
+ products: {},
+};
tap.test('parses an arrival correctly (DB)', (t) => {
- const common = profile.parseCommon({profile, opt, res})
- const ctx = {profile, opt, common, res}
- const arrivals = res.jnyL.map(d => profile.parseArrival(ctx, d))
+ const common = profile.parseCommon({profile, opt, res});
+ const ctx = {profile, opt, common, res};
+ const arrivals = res.jnyL.map(d => profile.parseArrival(ctx, d));
- t.same(arrivals, expected)
- t.end()
-})
+ t.same(arrivals, expected);
+ t.end();
+});
diff --git a/test/db-deps-with-destination.js b/test/db-deps-with-destination.js
index a233dd6e..9cc29391 100644
--- a/test/db-deps-with-destination.js
+++ b/test/db-deps-with-destination.js
@@ -1,16 +1,16 @@
// todo: use import assertions once they're supported by Node.js & ESLint
// https://github.com/tc39/proposal-import-assertions
-import {createRequire} from 'module'
-const require = createRequire(import.meta.url)
+import {createRequire} from 'module';
+const require = createRequire(import.meta.url);
-import tap from 'tap'
+import tap from 'tap';
-import {createClient} from '../index.js'
-import {profile as rawProfile} from '../p/db/index.js'
-const res = require('./fixtures/db-deps-with-destination.json')
+import {createClient} from '../index.js';
+import {profile as rawProfile} from '../p/db/index.js';
+const res = require('./fixtures/db-deps-with-destination.json');
-const client = createClient(rawProfile, 'public-transport/hafas-client:test')
-const {profile} = client
+const client = createClient(rawProfile, 'public-transport/hafas-client:test');
+const {profile} = client;
const opt = {
direction: null,
@@ -21,15 +21,15 @@ const opt = {
includeRelatedStations: true,
when: '2022-10-15T15:45:00+02:00',
products: {},
-}
+};
tap.test('parses departure.destination correctly (DB)', (t) => {
- const common = profile.parseCommon({profile, opt, res})
- const ctx = {profile, opt, common, res}
- const departure = profile.parseDeparture(ctx, res.jnyL[0])
+ const common = profile.parseCommon({profile, opt, res});
+ const ctx = {profile, opt, common, res};
+ const departure = profile.parseDeparture(ctx, res.jnyL[0]);
- t.ok(departure.destination, 'missing departure.destination')
- t.equal(departure.destination.type, 'stop', 'invalid departure.destination.type')
- t.equal(departure.destination.id, '930200', 'invalid departure.destination.id')
- t.end()
-})
+ t.ok(departure.destination, 'missing departure.destination');
+ t.equal(departure.destination.type, 'stop', 'invalid departure.destination.type');
+ t.equal(departure.destination.id, '930200', 'invalid departure.destination.id');
+ t.end();
+});
diff --git a/test/db-journey-2.js b/test/db-journey-2.js
index 34972b03..f5c27475 100644
--- a/test/db-journey-2.js
+++ b/test/db-journey-2.js
@@ -1,17 +1,17 @@
// todo: use import assertions once they're supported by Node.js & ESLint
// https://github.com/tc39/proposal-import-assertions
-import {createRequire} from 'module'
-const require = createRequire(import.meta.url)
+import {createRequire} from 'module';
+const require = createRequire(import.meta.url);
-import tap from 'tap'
+import tap from 'tap';
-import {createClient} from '../index.js'
-import {profile as rawProfile} from '../p/db/index.js'
-const res = require('./fixtures/db-journey-2.json')
-import {dbJourney as expected} from './fixtures/db-journey-2.js'
+import {createClient} from '../index.js';
+import {profile as rawProfile} from '../p/db/index.js';
+const res = require('./fixtures/db-journey-2.json');
+import {dbJourney as expected} from './fixtures/db-journey-2.js';
-const client = createClient(rawProfile, 'public-transport/hafas-client:test')
-const {profile} = client
+const client = createClient(rawProfile, 'public-transport/hafas-client:test');
+const {profile} = client;
const opt = {
results: 4,
@@ -28,14 +28,14 @@ const opt = {
startWithWalking: true,
scheduledDays: false,
departure: '2020-11-16T10:00:00+01:00',
- products: {}
-}
+ products: {},
+};
tap.test('parses a journey remarks without failing', (t) => {
- const common = profile.parseCommon({profile, opt, res})
- const ctx = {profile, opt, common, res}
- const journey = profile.parseJourney(ctx, res.outConL[2])
+ const common = profile.parseCommon({profile, opt, res});
+ const ctx = {profile, opt, common, res};
+ const journey = profile.parseJourney(ctx, res.outConL[2]);
- t.same(journey, expected)
- t.end()
-})
+ t.same(journey, expected);
+ t.end();
+});
diff --git a/test/db-journey-additional-stopover.js b/test/db-journey-additional-stopover.js
index d39b3461..e891eb31 100644
--- a/test/db-journey-additional-stopover.js
+++ b/test/db-journey-additional-stopover.js
@@ -1,35 +1,35 @@
// todo: use import assertions once they're supported by Node.js & ESLint
// https://github.com/tc39/proposal-import-assertions
-import {createRequire} from 'module'
+import {createRequire} from 'module';
-const require = createRequire(import.meta.url)
+const require = createRequire(import.meta.url);
-import tap from 'tap'
+import tap from 'tap';
-import {createClient} from '../index.js'
-import {profile as rawProfile} from '../p/db/index.js'
+import {createClient} from '../index.js';
+import {profile as rawProfile} from '../p/db/index.js';
-const resAdditionalStopover = require('./fixtures/db-journey-additional-stopover.json')
+const resAdditionalStopover = require('./fixtures/db-journey-additional-stopover.json');
-const client = createClient(rawProfile, 'public-transport/hafas-client:test')
-const {profile} = client
+const client = createClient(rawProfile, 'public-transport/hafas-client:test');
+const {profile} = client;
const opt = {
- results: 1,
- stopovers: true
-}
+ results: 1,
+ stopovers: true,
+};
// https://github.com/public-transport/hafas-client/issues/303
tap.test('parses a journey having a leg with an additional stopover', (t) => {
- const common = profile.parseCommon({profile, opt, res: resAdditionalStopover})
- const ctx = {profile, opt, common, res: resAdditionalStopover}
- const journey = profile.parseJourney(ctx, resAdditionalStopover.outConL[0])
- const stopovers = journey.legs[0].stopovers
+ const common = profile.parseCommon({profile, opt, res: resAdditionalStopover});
+ const ctx = {profile, opt, common, res: resAdditionalStopover};
+ const journey = profile.parseJourney(ctx, resAdditionalStopover.outConL[0]);
+ const stopovers = journey.legs[0].stopovers;
- const stopoverRegular = stopovers[6]
- const stopoverAdditional = stopovers[7]
- t.notOk('additional' in stopoverRegular, 'regular stopover has attribute additional')
- t.equal(stopoverAdditional.additional, true, 'additional stopover doesn\'t have attribute additional')
- t.end()
-})
+ const stopoverRegular = stopovers[6];
+ const stopoverAdditional = stopovers[7];
+ t.notOk('additional' in stopoverRegular, 'regular stopover has attribute additional');
+ t.equal(stopoverAdditional.additional, true, 'additional stopover doesn\'t have attribute additional');
+ t.end();
+});
diff --git a/test/db-journey-fpB-fpE-2-years.js b/test/db-journey-fpB-fpE-2-years.js
index 277b000a..a26a8efa 100644
--- a/test/db-journey-fpB-fpE-2-years.js
+++ b/test/db-journey-fpB-fpE-2-years.js
@@ -1,16 +1,16 @@
// todo: use import assertions once they're supported by Node.js & ESLint
// https://github.com/tc39/proposal-import-assertions
-import {createRequire} from 'module'
-const require = createRequire(import.meta.url)
+import {createRequire} from 'module';
+const require = createRequire(import.meta.url);
-import tap from 'tap'
+import tap from 'tap';
-import {createClient} from '../index.js'
-import {profile as rawProfile} from '../p/db/index.js'
-const res = require('./fixtures/db-journey-fpB-fpE-2-years.json')
+import {createClient} from '../index.js';
+import {profile as rawProfile} from '../p/db/index.js';
+const res = require('./fixtures/db-journey-fpB-fpE-2-years.json');
-const client = createClient(rawProfile, 'public-transport/hafas-client:test')
-const {profile} = client
+const client = createClient(rawProfile, 'public-transport/hafas-client:test');
+const {profile} = client;
const opt = {
results: 1,
@@ -28,12 +28,12 @@ const opt = {
entrances: false,
remarks: false,
scheduledDays: true,
-}
+};
tap.test('parses journey.scheduledDays correctly with planning period of >1 year', (t) => {
- const common = profile.parseCommon({profile, opt, res})
- const ctx = {profile, opt, common, res}
- const journey = profile.parseJourney(ctx, res.outConL[0])
+ const common = profile.parseCommon({profile, opt, res});
+ const ctx = {profile, opt, common, res};
+ const journey = profile.parseJourney(ctx, res.outConL[0]);
// "fpB": "20211212",
// "fpE": "20231209",
@@ -771,6 +771,6 @@ tap.test('parses journey.scheduledDays correctly with planning period of >1 year
'2023-12-07': false,
'2023-12-08': false,
'2023-12-09': false,
- })
- t.end()
-})
+ });
+ t.end();
+});
diff --git a/test/db-journey-overnight.js b/test/db-journey-overnight.js
index 14e52c45..c76b0ebf 100644
--- a/test/db-journey-overnight.js
+++ b/test/db-journey-overnight.js
@@ -1,19 +1,19 @@
// todo: use import assertions once they're supported by Node.js & ESLint
// https://github.com/tc39/proposal-import-assertions
-import {createRequire} from 'module'
-const require = createRequire(import.meta.url)
+import {createRequire} from 'module';
+const require = createRequire(import.meta.url);
-import tap from 'tap'
+import tap from 'tap';
-import {createClient} from '../index.js'
-import {profile as rawProfile} from '../p/db/index.js'
-const res0 = require('./fixtures/db-journey-overnight-0.json')
-const expected0 = require('./fixtures/db-journey-overnight-0.expected.json')
-const res1 = require('./fixtures/db-journey-overnight-1.json')
-import {overnightJourney as expected1} from './fixtures/db-journey-overnight-1.expected.js'
+import {createClient} from '../index.js';
+import {profile as rawProfile} from '../p/db/index.js';
+const res0 = require('./fixtures/db-journey-overnight-0.json');
+const expected0 = require('./fixtures/db-journey-overnight-0.expected.json');
+const res1 = require('./fixtures/db-journey-overnight-1.json');
+import {overnightJourney as expected1} from './fixtures/db-journey-overnight-1.expected.js';
-const client = createClient(rawProfile, 'public-transport/hafas-client:test')
-const {profile} = client
+const client = createClient(rawProfile, 'public-transport/hafas-client:test');
+const {profile} = client;
const baseOpt = {
results: null,
@@ -30,7 +30,7 @@ const baseOpt = {
remarks: true,
scheduledDays: false,
products: {},
-}
+};
tap.test('parses a journey across day with correct timestamps', (t) => {
const opt = {
@@ -38,15 +38,15 @@ tap.test('parses a journey across day with correct timestamps', (t) => {
results: 4,
stopovers: true,
departure: '2023-11-13T22:00:00+01:00',
- }
+ };
- const common = profile.parseCommon({profile, opt, res: res0})
- const ctx = {profile, opt, common, res: res0}
- const journey = profile.parseJourney(ctx, res0.outConL[16])
+ const common = profile.parseCommon({profile, opt, res: res0});
+ const ctx = {profile, opt, common, res: res0};
+ const journey = profile.parseJourney(ctx, res0.outConL[16]);
- t.same(journey, expected0)
- t.end()
-})
+ t.same(journey, expected0);
+ t.end();
+});
tap.test('parses a journey across dates with correct timestamps', (t) => {
const opt = {
@@ -54,12 +54,12 @@ tap.test('parses a journey across dates with correct timestamps', (t) => {
results: 1,
stopovers: true,
departure: '2023-11-24T22:00+01:00',
- }
+ };
- const common = profile.parseCommon({profile, opt, res: res1})
- const ctx = {profile, opt, common, res: res1}
- const journey = profile.parseJourney(ctx, res1.outConL[0])
+ const common = profile.parseCommon({profile, opt, res: res1});
+ const ctx = {profile, opt, common, res: res1};
+ const journey = profile.parseJourney(ctx, res1.outConL[0]);
- t.same(journey, expected1)
- t.end()
-})
+ t.same(journey, expected1);
+ t.end();
+});
diff --git a/test/db-journey-polyline.js b/test/db-journey-polyline.js
index db83a2f7..cb101d0c 100644
--- a/test/db-journey-polyline.js
+++ b/test/db-journey-polyline.js
@@ -1,17 +1,17 @@
// todo: use import assertions once they're supported by Node.js & ESLint
// https://github.com/tc39/proposal-import-assertions
-import {createRequire} from 'module'
-const require = createRequire(import.meta.url)
+import {createRequire} from 'module';
+const require = createRequire(import.meta.url);
-import tap from 'tap'
+import tap from 'tap';
-import {createClient} from '../index.js'
-import {profile as rawProfile} from '../p/db/index.js'
-const res = require('./fixtures/db-journey-polyline.json')
-import {dbJourneyPolyline as expected} from './fixtures/db-journey-polyline.js'
+import {createClient} from '../index.js';
+import {profile as rawProfile} from '../p/db/index.js';
+const res = require('./fixtures/db-journey-polyline.json');
+import {dbJourneyPolyline as expected} from './fixtures/db-journey-polyline.js';
-const client = createClient(rawProfile, 'public-transport/hafas-client:test')
-const {profile} = client
+const client = createClient(rawProfile, 'public-transport/hafas-client:test');
+const {profile} = client;
const opt = {
results: null,
@@ -29,13 +29,13 @@ const opt = {
scheduledDays: false,
departure: '2020-07-27T10:00+02:00',
products: {},
-}
+};
tap.test('parses a journey with an embedded polyline correctly', (t) => {
- const common = profile.parseCommon({profile, opt, res})
- const ctx = {profile, opt, common, res}
- const journey = profile.parseJourney(ctx, res.outConL[0])
+ const common = profile.parseCommon({profile, opt, res});
+ const ctx = {profile, opt, common, res};
+ const journey = profile.parseJourney(ctx, res.outConL[0]);
- t.same(journey, expected)
- t.end()
-})
+ t.same(journey, expected);
+ t.end();
+});
diff --git a/test/db-journey-tzoffset-0.js b/test/db-journey-tzoffset-0.js
index 61450106..da6e9773 100644
--- a/test/db-journey-tzoffset-0.js
+++ b/test/db-journey-tzoffset-0.js
@@ -1,17 +1,17 @@
// todo: use import assertions once they're supported by Node.js & ESLint
// https://github.com/tc39/proposal-import-assertions
-import {createRequire} from 'module'
-const require = createRequire(import.meta.url)
+import {createRequire} from 'module';
+const require = createRequire(import.meta.url);
-import tap from 'tap'
+import tap from 'tap';
-import {createClient} from '../index.js'
-import {profile as rawProfile} from '../p/db/index.js'
-const resDTZOffset0 = require('./fixtures/db-journey-dtzoffset-0.json')
-const resATZOffset0 = require('./fixtures/db-journey-atzoffset-0.json')
+import {createClient} from '../index.js';
+import {profile as rawProfile} from '../p/db/index.js';
+const resDTZOffset0 = require('./fixtures/db-journey-dtzoffset-0.json');
+const resATZOffset0 = require('./fixtures/db-journey-atzoffset-0.json');
-const client = createClient(rawProfile, 'public-transport/hafas-client:test')
-const {profile} = client
+const client = createClient(rawProfile, 'public-transport/hafas-client:test');
+const {profile} = client;
const opt = {
stopovers: false,
@@ -20,26 +20,26 @@ const opt = {
subStops: true,
entrances: true,
remarks: true,
-}
+};
// https://github.com/public-transport/hafas-client/issues/237
tap.test('parses a journey whose first leg has a dTZOffset of 0 (#237)', (t) => {
- const common = profile.parseCommon({profile, opt, res: resDTZOffset0})
- const ctx = {profile, opt, common, res: resDTZOffset0}
- const journey = profile.parseJourney(ctx, resDTZOffset0.outConL[0])
+ const common = profile.parseCommon({profile, opt, res: resDTZOffset0});
+ const ctx = {profile, opt, common, res: resDTZOffset0};
+ const journey = profile.parseJourney(ctx, resDTZOffset0.outConL[0]);
- const firstLeg = journey.legs[0]
- t.notOk(/Z$/.test(firstLeg.departure), 'firstLeg.departure has TZ offset "Z"')
- t.end()
-})
+ const firstLeg = journey.legs[0];
+ t.notOk((/Z$/).test(firstLeg.departure), 'firstLeg.departure has TZ offset "Z"');
+ t.end();
+});
tap.test('parses a journey whose first leg has a aTZOffset of 0 (#237)', (t) => {
- const common = profile.parseCommon({profile, opt, res: resATZOffset0})
- const ctx = {profile, opt, common, res: resATZOffset0}
- const journey = profile.parseJourney(ctx, resATZOffset0.outConL[0])
+ const common = profile.parseCommon({profile, opt, res: resATZOffset0});
+ const ctx = {profile, opt, common, res: resATZOffset0};
+ const journey = profile.parseJourney(ctx, resATZOffset0.outConL[0]);
- const lastLeg = journey.legs[0]
- t.notOk(/Z$/.test(lastLeg.departure), 'lastLeg.departure has TZ offset "Z"')
- t.end()
-})
+ const lastLeg = journey.legs[0];
+ t.notOk((/Z$/).test(lastLeg.departure), 'lastLeg.departure has TZ offset "Z"');
+ t.end();
+});
diff --git a/test/db-journey.js b/test/db-journey.js
index 8360d41c..9554c62d 100644
--- a/test/db-journey.js
+++ b/test/db-journey.js
@@ -1,17 +1,17 @@
// todo: use import assertions once they're supported by Node.js & ESLint
// https://github.com/tc39/proposal-import-assertions
-import {createRequire} from 'module'
-const require = createRequire(import.meta.url)
+import {createRequire} from 'module';
+const require = createRequire(import.meta.url);
-import tap from 'tap'
+import tap from 'tap';
-import {createClient} from '../index.js'
-import {profile as rawProfile} from '../p/db/index.js'
-const res = require('./fixtures/db-journey.json')
-import {dbJourney as expected} from './fixtures/db-journey.js'
+import {createClient} from '../index.js';
+import {profile as rawProfile} from '../p/db/index.js';
+const res = require('./fixtures/db-journey.json');
+import {dbJourney as expected} from './fixtures/db-journey.js';
-const client = createClient(rawProfile, 'public-transport/hafas-client:test')
-const {profile} = client
+const client = createClient(rawProfile, 'public-transport/hafas-client:test');
+const {profile} = client;
const opt = {
results: null,
@@ -28,14 +28,14 @@ const opt = {
startWithWalking: true,
scheduledDays: false,
departure: '2020-04-10T20:33+02:00',
- products: {}
-}
+ products: {},
+};
tap.test('parses a journey with a DEVI leg correctly (DB)', (t) => {
- const common = profile.parseCommon({profile, opt, res})
- const ctx = {profile, opt, common, res}
- const journey = profile.parseJourney(ctx, res.outConL[2])
+ const common = profile.parseCommon({profile, opt, res});
+ const ctx = {profile, opt, common, res};
+ const journey = profile.parseJourney(ctx, res.outConL[2]);
- t.same(journey, expected)
- t.end()
-})
+ t.same(journey, expected);
+ t.end();
+});
diff --git a/test/db-netz-remarks.js b/test/db-netz-remarks.js
index d892a927..fdf6cfc9 100644
--- a/test/db-netz-remarks.js
+++ b/test/db-netz-remarks.js
@@ -1,13 +1,13 @@
// todo: use import assertions once they're supported by Node.js & ESLint
// https://github.com/tc39/proposal-import-assertions
-import {createRequire} from 'module'
-const require = createRequire(import.meta.url)
+import {createRequire} from 'module';
+const require = createRequire(import.meta.url);
-import tap from 'tap'
+import tap from 'tap';
-import {parseCommonData as parseCommon} from '../parse/common.js'
-import {defaultProfile} from '../lib/default-profile.js'
-const res = require('./fixtures/db-netz-remarks.json')
+import {parseCommonData as parseCommon} from '../parse/common.js';
+import {defaultProfile} from '../lib/default-profile.js';
+const res = require('./fixtures/db-netz-remarks.json');
const profile = {
...defaultProfile,
@@ -16,33 +16,33 @@ const profile = {
products: [
{id: 'a', bitmasks: [1, 2, 4, 8], name: 'A'},
{id: 'b', bitmasks: [16, 32, 64, 128], name: 'B'},
- {id: 'c', bitmasks: [256, 512], name: 'C'}
- ]
-}
+ {id: 'c', bitmasks: [256, 512], name: 'C'},
+ ],
+};
const opt = {
- remarks: true
-}
+ remarks: true,
+};
tap.test('parseCommon parses a DB Netz response properly', (t) => {
- const {warnings} = profile.parseCommon({profile, opt, res})
- t.pass('parsed without throwing')
- const warning = warnings.find(w => w.id === 'HIM_FREETEXT_447862')
+ const {warnings} = profile.parseCommon({profile, opt, res});
+ t.pass('parsed without throwing');
+ const warning = warnings.find(w => w.id === 'HIM_FREETEXT_447862');
t.same(warning, {
id: 'HIM_FREETEXT_447862',
type: 'warning',
summary: 'Abweichung Fpl f Zmst BKRW - NEB nur nach Gl101',
text: 'Brückenarbeiten NKK// BKAR S-Bahn BrüArb Pankgrafenstraße - BKAR nur Gl101 für die NEB nutzbar / 59047 Po 2.2 in Bln-Karow S-B Bft',
- icon: { type: 'HIM11307', title: null },
+ icon: {type: 'HIM11307', title: null},
priority: 80,
category: 1,
- products: { a: true, b: true, c: true },
+ products: {a: true, b: true, c: true},
edges: [{
dir: 3,
- icoCrd: { x: 13469131, y: 52614672, type: 'WGS84' },
- msgRefL: [ 3, 7, 17, 18, 20, 21 ],
- icon: { type: 'HIM11216', title: null },
+ icoCrd: {x: 13469131, y: 52614672, type: 'WGS84'},
+ msgRefL: [3, 7, 17, 18, 20, 21],
+ icon: {type: 'HIM11216', title: null},
fromLocation: {
type: 'stop',
id: '8011046',
@@ -51,9 +51,9 @@ tap.test('parseCommon parses a DB Netz response properly', (t) => {
type: 'location',
id: '8011046',
latitude: 52.614672,
- longitude: 13.469131
+ longitude: 13.469131,
},
- products: { a: true, b: false, c: true }
+ products: {a: true, b: false, c: true},
},
toLocation: {
type: 'stop',
@@ -63,10 +63,10 @@ tap.test('parseCommon parses a DB Netz response properly', (t) => {
type: 'location',
id: '8011046',
latitude: 52.614672,
- longitude: 13.469131
+ longitude: 13.469131,
},
- products: { a: true, b: false, c: true }
- }
+ products: {a: true, b: false, c: true},
+ },
}],
events: [{
fromLocation: {
@@ -77,9 +77,9 @@ tap.test('parseCommon parses a DB Netz response properly', (t) => {
type: 'location',
id: '8011046',
latitude: 52.614672,
- longitude: 13.469131
+ longitude: 13.469131,
},
- products: { a: true, b: false, c: true }
+ products: {a: true, b: false, c: true},
},
toLocation: {
type: 'stop',
@@ -89,17 +89,17 @@ tap.test('parseCommon parses a DB Netz response properly', (t) => {
type: 'location',
id: '8011046',
latitude: 52.614672,
- longitude: 13.469131
+ longitude: 13.469131,
},
- products: { a: true, b: false, c: true }
+ products: {a: true, b: false, c: true},
},
start: '2020-01-11T00:00:00+01:00',
end: '2020-04-03T23:59:00+02:00',
- sections: [ '6500' ]
+ sections: ['6500'],
}],
validFrom: '2019-12-15T00:00:00+01:00',
validUntil: '2020-05-29T04:00:00+02:00',
- modified: '2019-10-26T04:09:19+02:00'
- })
- t.end()
-})
+ modified: '2019-10-26T04:09:19+02:00',
+ });
+ t.end();
+});
diff --git a/test/db-stop.js b/test/db-stop.js
index ffc8f4a7..ec8aad70 100644
--- a/test/db-stop.js
+++ b/test/db-stop.js
@@ -1,30 +1,30 @@
// todo: use import assertions once they're supported by Node.js & ESLint
// https://github.com/tc39/proposal-import-assertions
-import {createRequire} from 'module'
-const require = createRequire(import.meta.url)
+import {createRequire} from 'module';
+const require = createRequire(import.meta.url);
-import tap from 'tap'
+import tap from 'tap';
-import {createClient} from '../index.js'
-import {profile as rawProfile} from '../p/db/index.js'
-const res = require('./fixtures/db-stop.json')
-import {dbStop as expected} from './fixtures/db-stop.js'
+import {createClient} from '../index.js';
+import {profile as rawProfile} from '../p/db/index.js';
+const res = require('./fixtures/db-stop.json');
+import {dbStop as expected} from './fixtures/db-stop.js';
-const client = createClient(rawProfile, 'public-transport/hafas-client:test')
-const {profile} = client
+const client = createClient(rawProfile, 'public-transport/hafas-client:test');
+const {profile} = client;
const opt = {
linesOfStops: false, // parse & expose lines at the stop/station?
subStops: true,
entrances: true,
remarks: true,
-}
+};
tap.test('parses a stop() response correctly (DB)', (t) => {
- const common = profile.parseCommon({profile, opt, res})
- const ctx = {profile, opt, common, res}
- const stop = profile.parseLocation(ctx, res.locL[0])
+ const common = profile.parseCommon({profile, opt, res});
+ const ctx = {profile, opt, common, res};
+ const stop = profile.parseLocation(ctx, res.locL[0]);
- t.same(stop, expected)
- t.end()
-})
+ t.same(stop, expected);
+ t.end();
+});
diff --git a/test/e2e/bls.js b/test/e2e/bls.js
index 1da50abd..c2fbacd7 100644
--- a/test/e2e/bls.js
+++ b/test/e2e/bls.js
@@ -1,13 +1,13 @@
-import tap from 'tap'
+import tap from 'tap';
-import {createWhen} from './lib/util.js'
-import {createClient} from '../../index.js'
-import {profile as blsProfile} from '../../p/bls/index.js'
-import {createValidateFptfWith as createValidate} from './lib/validate-fptf-with.js'
-import {testJourneysStationToAddress} from './lib/journeys-station-to-address.js'
+import {createWhen} from './lib/util.js';
+import {createClient} from '../../index.js';
+import {profile as blsProfile} from '../../p/bls/index.js';
+import {createValidateFptfWith as createValidate} from './lib/validate-fptf-with.js';
+import {testJourneysStationToAddress} from './lib/journeys-station-to-address.js';
-const T_MOCK = 1671260400 * 1000 // 2022-12-17T08:00:00+01:00
-const when = createWhen(blsProfile.timezone, blsProfile.locale, T_MOCK)
+const T_MOCK = 1671260400 * 1000; // 2022-12-17T08:00:00+01:00
+const when = createWhen(blsProfile.timezone, blsProfile.locale, T_MOCK);
const cfg = {
when,
@@ -17,13 +17,13 @@ const cfg = {
minLongitude: 4.4604,
maxLatitude: 47.2969,
maxLongitude: 7.8607,
-}
+};
-const validate = createValidate(cfg)
+const validate = createValidate(cfg);
-const client = createClient(blsProfile, 'public-transport/hafas-client:test')
+const client = createClient(blsProfile, 'public-transport/hafas-client:test');
-const bernDennigkofengässli = '8590093'
+const bernDennigkofengässli = '8590093';
tap.test('Dennigkofengässli to Schänzlihalde', async (t) => {
const schänzlihalde = {
@@ -32,12 +32,12 @@ tap.test('Dennigkofengässli to Schänzlihalde', async (t) => {
address: 'Bern, Schänzlihalde 17',
latitude: 46.952835,
longitude: 7.447527,
- }
+ };
const res = await client.journeys(bernDennigkofengässli, schänzlihalde, {
results: 3,
departure: when,
- })
+ });
await testJourneysStationToAddress({
test: t,
@@ -45,6 +45,6 @@ tap.test('Dennigkofengässli to Schänzlihalde', async (t) => {
validate,
fromId: bernDennigkofengässli,
to: schänzlihalde,
- })
- t.end()
-})
+ });
+ t.end();
+});
diff --git a/test/e2e/bvg.js b/test/e2e/bvg.js
index e3843653..9bd0de24 100644
--- a/test/e2e/bvg.js
+++ b/test/e2e/bvg.js
@@ -1,83 +1,83 @@
// todo: DRY with vbb tests
-import tap from 'tap'
+import tap from 'tap';
-import isRoughlyEqual from 'is-roughly-equal'
-import {DateTime} from 'luxon'
-import flatMap from 'lodash/flatMap.js'
+import isRoughlyEqual from 'is-roughly-equal';
+import {DateTime} from 'luxon';
+import flatMap from 'lodash/flatMap.js';
-import {createWhen} from './lib/util.js'
-import {createClient} from '../../index.js'
-import {profile as bvgProfile} from '../../p/bvg/index.js'
-import {createValidateFptfWith as createValidate} from './lib/validate-fptf-with.js'
-import {createVbbBvgValidators} from './lib/vbb-bvg-validators.js'
-import {testJourneysStationToStation} from './lib/journeys-station-to-station.js'
-import {testJourneysStationToAddress} from './lib/journeys-station-to-address.js'
-import {testJourneysStationToPoi} from './lib/journeys-station-to-poi.js'
-import {testJourneysWalkingSpeed} from './lib/journeys-walking-speed.js'
-import {testEarlierLaterJourneys} from './lib/earlier-later-journeys.js'
-import {testLegCycleAlternatives} from './lib/leg-cycle-alternatives.js'
-import {testRefreshJourney} from './lib/refresh-journey.js'
-import {journeysFailsWithNoProduct} from './lib/journeys-fails-with-no-product.js'
-import {testDepartures} from './lib/departures.js'
-import {testDeparturesInDirection} from './lib/departures-in-direction.js'
-import {testArrivals} from './lib/arrivals.js'
-import {testJourneysWithDetour} from './lib/journeys-with-detour.js'
-import {testReachableFrom} from './lib/reachable-from.js'
-import {testRemarks} from './lib/remarks.js'
-import {testLines} from './lib/lines.js'
+import {createWhen} from './lib/util.js';
+import {createClient} from '../../index.js';
+import {profile as bvgProfile} from '../../p/bvg/index.js';
+import {createValidateFptfWith as createValidate} from './lib/validate-fptf-with.js';
+import {createVbbBvgValidators} from './lib/vbb-bvg-validators.js';
+import {testJourneysStationToStation} from './lib/journeys-station-to-station.js';
+import {testJourneysStationToAddress} from './lib/journeys-station-to-address.js';
+import {testJourneysStationToPoi} from './lib/journeys-station-to-poi.js';
+import {testJourneysWalkingSpeed} from './lib/journeys-walking-speed.js';
+import {testEarlierLaterJourneys} from './lib/earlier-later-journeys.js';
+import {testLegCycleAlternatives} from './lib/leg-cycle-alternatives.js';
+import {testRefreshJourney} from './lib/refresh-journey.js';
+import {journeysFailsWithNoProduct} from './lib/journeys-fails-with-no-product.js';
+import {testDepartures} from './lib/departures.js';
+import {testDeparturesInDirection} from './lib/departures-in-direction.js';
+import {testArrivals} from './lib/arrivals.js';
+import {testJourneysWithDetour} from './lib/journeys-with-detour.js';
+import {testReachableFrom} from './lib/reachable-from.js';
+import {testRemarks} from './lib/remarks.js';
+import {testLines} from './lib/lines.js';
-const T_MOCK = 1671260400 * 1000 // 2022-12-17T08:00:00+01:00
-const when = createWhen(bvgProfile.timezone, bvgProfile.locale, T_MOCK)
+const T_MOCK = 1671260400 * 1000; // 2022-12-17T08:00:00+01:00
+const when = createWhen(bvgProfile.timezone, bvgProfile.locale, T_MOCK);
const {
cfg,
validateStation,
validateJourneyLeg,
validateDeparture,
- validateMovement
+ validateMovement,
} = createVbbBvgValidators({
when,
-})
+});
const validate = createValidate(cfg, {
station: validateStation,
journeyLeg: validateJourneyLeg,
departure: validateDeparture,
- movement: validateMovement
-})
+ movement: validateMovement,
+});
-const client = createClient(bvgProfile, 'public-transport/hafas-client:test')
+const client = createClient(bvgProfile, 'public-transport/hafas-client:test');
-const amrumerStr = '900009101'
-const spichernstr = '900042101'
-const bismarckstr = '900024201'
-const westhafen = '900001201'
-const wedding = '900009104'
-const württembergallee = '900026153'
-const tiergarten = '900003103'
-const jannowitzbrücke = '900100004'
+const amrumerStr = '900009101';
+const spichernstr = '900042101';
+const bismarckstr = '900024201';
+const westhafen = '900001201';
+const wedding = '900009104';
+const württembergallee = '900026153';
+const tiergarten = '900003103';
+const jannowitzbrücke = '900100004';
-const hour = 60 * 60 * 1000
+const hour = 60 * 60 * 1000;
tap.test('journeys – Spichernstr. to Bismarckstr.', async (t) => {
const res = await client.journeys(spichernstr, bismarckstr, {
results: 4,
departure: when,
- stopovers: true
- })
+ stopovers: true,
+ });
await testJourneysStationToStation({
test: t,
res,
validate,
fromId: spichernstr,
- toId: bismarckstr
- })
+ toId: bismarckstr,
+ });
// todo: find a journey where there ticket info is always available
- t.end()
-})
+ t.end();
+});
tap.test('journeys – only subway', async (t) => {
const res = await client.journeys(spichernstr, bismarckstr, {
@@ -85,34 +85,34 @@ tap.test('journeys – only subway', async (t) => {
departure: when,
products: {
suburban: false,
- subway: true,
- tram: false,
- bus: false,
- ferry: false,
- express: false,
- regional: false
- }
- })
+ subway: true,
+ tram: false,
+ bus: false,
+ ferry: false,
+ express: false,
+ regional: false,
+ },
+ });
- validate(t, res, 'journeysResult', 'res')
+ validate(t, res, 'journeysResult', 'res');
- t.ok(res.journeys.length > 1)
+ t.ok(res.journeys.length > 1);
for (let i = 0; i < res.journeys.length; i++) {
- const journey = res.journeys[i]
+ const journey = res.journeys[i];
for (let j = 0; j < journey.legs.length; j++) {
- const leg = journey.legs[j]
+ const leg = journey.legs[j];
- const name = `res.journeys[${i}].legs[${j}].line`
+ const name = `res.journeys[${i}].legs[${j}].line`;
if (leg.line) {
- t.equal(leg.line.mode, 'train', name + '.mode is invalid')
- t.equal(leg.line.product, 'subway', name + '.product is invalid')
+ t.equal(leg.line.mode, 'train', name + '.mode is invalid');
+ t.equal(leg.line.product, 'subway', name + '.product is invalid');
}
- t.ok(journey.legs.some(l => l.line), name + '.legs has no subway leg')
+ t.ok(journey.legs.some(l => l.line), name + '.legs has no subway leg');
}
}
- t.end()
-})
+ t.end();
+});
tap.test('journeys – fails with no product', async (t) => {
await journeysFailsWithNoProduct({
@@ -122,44 +122,48 @@ tap.test('journeys – fails with no product', async (t) => {
toId: bismarckstr,
when,
products: bvgProfile.products,
- })
- t.end()
-})
+ });
+ t.end();
+});
// BerlKönig for public use is suspended during COVID-19.
tap.skip('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 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
+ longitude: 13.384947,
}, {
type: 'location',
id: '900981505',
poi: true,
name: 'Berlin, Tempelhofer Park Eingang Oderstr.',
latitude: 52.476688,
- longitude: 13.41872
+ longitude: 13.41872,
}, {
berlkoenig: true,
- departure: when
- })
+ 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')
+ .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()
-})
+ t.ok(withBerlkoenig.line);
+ t.equal(withBerlkoenig.line.public, true);
+ t.equal(withBerlkoenig.line.mode, 'taxi');
+ t.equal(withBerlkoenig.line.product, 'berlkoenig');
+ t.end();
+});
// todo: opt.walkingSpeed doesn't seem to work right now
tap.skip('journeys: walkingSpeed', async (t) => {
@@ -167,9 +171,9 @@ tap.skip('journeys: walkingSpeed', async (t) => {
type: 'location',
address: 'Havelchaussee',
latitude: 52.443576,
- longitude: 13.198973
- }
- const wannsee = '900053301'
+ longitude: 13.198973,
+ };
+ const wannsee = '900053301';
await testJourneysWalkingSpeed({
test: t,
@@ -178,9 +182,9 @@ tap.skip('journeys: walkingSpeed', async (t) => {
from: havelchaussee,
to: wannsee,
products: {bus: false},
- minTimeDifference: 5 * 60 * 1000
- })
-})
+ minTimeDifference: 5 * 60 * 1000,
+ });
+});
tap.test('earlier/later journeys', async (t) => {
await testEarlierLaterJourneys({
@@ -189,11 +193,11 @@ tap.test('earlier/later journeys', async (t) => {
validate,
fromId: spichernstr,
toId: bismarckstr,
- when
- })
+ when,
+ });
- t.end()
-})
+ t.end();
+});
if (!process.env.VCR_MODE) {
tap.test('journeys – leg cycle & alternatives', async (t) => {
@@ -201,10 +205,10 @@ if (!process.env.VCR_MODE) {
test: t,
fetchJourneys: client.journeys,
fromId: tiergarten,
- toId: jannowitzbrücke
- })
- t.end()
- })
+ toId: jannowitzbrücke,
+ });
+ t.end();
+ });
}
tap.test('refreshJourney', async (t) => {
@@ -215,47 +219,47 @@ tap.test('refreshJourney', async (t) => {
validate,
fromId: spichernstr,
toId: bismarckstr,
- when
- })
- t.end()
-})
+ when,
+ });
+ t.end();
+});
tap.test('trip details', async (t) => {
const res = await client.journeys(spichernstr, amrumerStr, {
- results: 1, departure: when
- })
+ results: 1, departure: when,
+ });
- const p = res.journeys[0].legs.find(l => !l.walking)
- t.ok(p.tripId, 'precondition failed')
- t.ok(p.line.name, 'precondition failed')
+ const p = res.journeys[0].legs.find(l => !l.walking);
+ t.ok(p.tripId, 'precondition failed');
+ t.ok(p.line.name, 'precondition failed');
- const tripRes = await client.trip(p.tripId, {when})
+ const tripRes = await client.trip(p.tripId, {when});
- validate(t, tripRes, 'tripResult', 'res')
- t.end()
-})
+ validate(t, tripRes, 'tripResult', 'res');
+ t.end();
+});
tap.test('journeys – station to address', async (t) => {
const torfstr = {
type: 'location',
address: '13353 Berlin-Wedding, Torfstr. 17',
latitude: 52.541797,
- longitude: 13.350042
- }
+ longitude: 13.350042,
+ };
const res = await client.journeys(spichernstr, torfstr, {
results: 3,
- departure: when
- })
+ departure: when,
+ });
await testJourneysStationToAddress({
test: t,
res,
validate,
fromId: spichernstr,
- to: torfstr
- })
- t.end()
-})
+ to: torfstr,
+ });
+ t.end();
+});
tap.test('journeys – station to POI', async (t) => {
const atze = {
@@ -264,22 +268,22 @@ tap.test('journeys – station to POI', async (t) => {
poi: true,
name: 'Berlin, Atze Musiktheater für Kinder',
latitude: 52.543333,
- longitude: 13.351686
- }
+ longitude: 13.351686,
+ };
const res = await client.journeys(spichernstr, atze, {
results: 3,
- departure: when
- })
+ departure: when,
+ });
await testJourneysStationToPoi({
test: t,
res,
validate,
fromId: spichernstr,
- to: atze
- })
- t.end()
-})
+ to: atze,
+ });
+ t.end();
+});
tap.test('journeys: via works – with detour', async (t) => {
// Going from Westhafen to Wedding via Württembergalle without detour
@@ -288,33 +292,33 @@ tap.test('journeys: via works – with detour', async (t) => {
via: württembergallee,
results: 1,
departure: when,
- stopovers: true
- })
+ stopovers: true,
+ });
await testJourneysWithDetour({
test: t,
res,
validate,
- detourIds: [württembergallee]
- })
- t.end()
-})
+ detourIds: [württembergallee],
+ });
+ t.end();
+});
// todo: without detour test
tap.test('departures', async (t) => {
const res = await client.departures(spichernstr, {
- duration: 5, when
- })
+ duration: 5, when,
+ });
await testDepartures({
test: t,
res,
validate,
- id: spichernstr
- })
- t.end()
-})
+ id: spichernstr,
+ });
+ t.end();
+});
tap.test('departures with station object', async (t) => {
const res = await client.departures({
@@ -324,13 +328,13 @@ tap.test('departures with station object', async (t) => {
location: {
type: 'location',
latitude: 1.23,
- longitude: 2.34
- }
- }, {when})
+ longitude: 2.34,
+ },
+ }, {when});
- validate(t, res, 'departuresResponse', 'res')
- t.end()
-})
+ validate(t, res, 'departuresResponse', 'res');
+ t.end();
+});
tap.test('departures at Spichernstr. in direction of Westhafen', async (t) => {
await testDeparturesInDirection({
@@ -340,105 +344,105 @@ tap.test('departures at Spichernstr. in direction of Westhafen', async (t) => {
id: spichernstr,
directionIds: [westhafen],
when,
- validate
- })
- t.end()
-})
+ validate,
+ });
+ t.end();
+});
tap.test('departures at 7-digit station', async (t) => {
- const eisenach = '8010097' // see derhuerst/vbb-hafas#22
- await client.departures(eisenach, {when})
- t.pass('did not fail')
- t.end()
-})
+ const eisenach = '8010097'; // see derhuerst/vbb-hafas#22
+ await client.departures(eisenach, {when});
+ t.pass('did not fail');
+ t.end();
+});
tap.test('arrivals', async (t) => {
const res = await client.arrivals(spichernstr, {
- duration: 5, when
- })
+ duration: 5, when,
+ });
await testArrivals({
test: t,
res,
validate,
- id: spichernstr
- })
- t.end()
-})
+ id: spichernstr,
+ });
+ t.end();
+});
tap.test('nearby', async (t) => {
- const berlinerStr = '900044201'
- const landhausstr = '900043252'
+ const berlinerStr = '900044201';
+ const landhausstr = '900043252';
// Berliner Str./Bundesallee
const nearby = await client.nearby({
type: 'location',
latitude: 52.4873452,
- longitude: 13.3310411
+ longitude: 13.3310411,
}, {
// Even though HAFAS reports Landhausstr. to be 179m, we have to pass way more here. 🙄
distance: 600,
- })
+ });
- validate(t, nearby, 'locations', 'nearby')
+ validate(t, nearby, 'locations', 'nearby');
- t.equal(nearby[0].id, berlinerStr)
- t.equal(nearby[0].name, 'U Berliner Str. (Berlin)')
- t.ok(nearby[0].distance > 0)
- t.ok(nearby[0].distance < 100)
+ t.equal(nearby[0].id, berlinerStr);
+ t.equal(nearby[0].name, 'U Berliner Str. (Berlin)');
+ t.ok(nearby[0].distance > 0);
+ t.ok(nearby[0].distance < 100);
- const res = nearby.find(s => s.id === landhausstr)
- t.ok(res, `Landhausstr. ${landhausstr} is not among the nearby stops`)
- t.equal(nearby[1].name, 'Landhausstr. (Berlin)')
- t.ok(nearby[1].distance > 100)
- t.ok(nearby[1].distance < 200)
+ const res = nearby.find(s => s.id === landhausstr);
+ t.ok(res, `Landhausstr. ${landhausstr} is not among the nearby stops`);
+ t.equal(nearby[1].name, 'Landhausstr. (Berlin)');
+ t.ok(nearby[1].distance > 100);
+ t.ok(nearby[1].distance < 200);
- t.end()
-})
+ t.end();
+});
tap.test('locations', async (t) => {
- const locations = await client.locations('Alexanderplatz', {results: 20})
+ const locations = await client.locations('Alexanderplatz', {results: 20});
- validate(t, locations, 'locations', 'locations')
- t.ok(locations.length <= 20)
+ validate(t, locations, 'locations', 'locations');
+ t.ok(locations.length <= 20);
- t.ok(locations.find(s => s.type === 'stop' || s.type === 'station'))
- t.ok(locations.find(s => s.poi)) // POIs
- t.ok(locations.find(s => !s.name && s.address)) // addresses
+ t.ok(locations.find(s => s.type === 'stop' || s.type === 'station'));
+ t.ok(locations.find(s => s.poi)); // POIs
+ t.ok(locations.find(s => !s.name && s.address)); // addresses
- t.end()
-})
+ t.end();
+});
tap.test('stop', async (t) => {
- const s = await client.stop(spichernstr)
+ const s = await client.stop(spichernstr);
- validate(t, s, ['stop', 'station'], 'stop')
- t.equal(s.id, spichernstr)
+ validate(t, s, ['stop', 'station'], 'stop');
+ t.equal(s.id, spichernstr);
- t.end()
-})
+ t.end();
+});
tap.test('radar', async (t) => {
const res = await client.radar({
north: 52.52411,
west: 13.41002,
south: 52.51942,
- east: 13.41709
+ east: 13.41709,
}, {
- duration: 5 * 60, when
- })
+ duration: 5 * 60, when,
+ });
- validate(t, res, 'radarResult', 'res')
- t.end()
-})
+ validate(t, res, 'radarResult', 'res');
+ t.end();
+});
tap.test('reachableFrom', async (t) => {
const torfstr17 = {
type: 'location',
address: '13353 Berlin-Wedding, Torfstr. 17',
latitude: 52.541797,
- longitude: 13.350042
- }
+ longitude: 13.350042,
+ };
await testReachableFrom({
test: t,
@@ -446,10 +450,10 @@ tap.test('reachableFrom', async (t) => {
address: torfstr17,
when,
maxDuration: 15,
- validate
- })
- t.end()
-})
+ validate,
+ });
+ t.end();
+});
tap.test('remarks', async (t) => {
await testRemarks({
@@ -457,9 +461,9 @@ tap.test('remarks', async (t) => {
fetchRemarks: client.remarks,
when,
validate,
- })
- t.end()
-})
+ });
+ t.end();
+});
tap.test('lines', async (t) => {
await testLines({
@@ -467,6 +471,6 @@ tap.test('lines', async (t) => {
fetchLines: client.lines,
validate,
query: 'M10',
- })
- t.end()
-})
+ });
+ t.end();
+});
diff --git a/test/e2e/cfl.js b/test/e2e/cfl.js
index 7c2b67a1..65ea61a1 100644
--- a/test/e2e/cfl.js
+++ b/test/e2e/cfl.js
@@ -1,26 +1,26 @@
-import tap from 'tap'
-import assert from 'assert'
-import isRoughlyEqual from 'is-roughly-equal'
+import tap from 'tap';
+import assert from 'assert';
+import isRoughlyEqual from 'is-roughly-equal';
-import {createWhen} from './lib/util.js'
-import {createClient} from '../../index.js'
-import {profile as cflProfile} from '../../p/cfl/index.js'
+import {createWhen} from './lib/util.js';
+import {createClient} from '../../index.js';
+import {profile as cflProfile} from '../../p/cfl/index.js';
import {
createValidateLine,
createValidateJourneyLeg,
createValidateMovement,
-} from './lib/validators.js'
-import {createValidateFptfWith as createValidate} from './lib/validate-fptf-with.js'
-import {testJourneysStationToStation} from './lib/journeys-station-to-station.js'
-import {testJourneysStationToAddress} from './lib/journeys-station-to-address.js'
-import {testJourneysStationToPoi} from './lib/journeys-station-to-poi.js'
-import {testEarlierLaterJourneys} from './lib/earlier-later-journeys.js'
-import {journeysFailsWithNoProduct} from './lib/journeys-fails-with-no-product.js'
-import {testDepartures} from './lib/departures.js'
-import {testArrivals} from './lib/arrivals.js'
+} from './lib/validators.js';
+import {createValidateFptfWith as createValidate} from './lib/validate-fptf-with.js';
+import {testJourneysStationToStation} from './lib/journeys-station-to-station.js';
+import {testJourneysStationToAddress} from './lib/journeys-station-to-address.js';
+import {testJourneysStationToPoi} from './lib/journeys-station-to-poi.js';
+import {testEarlierLaterJourneys} from './lib/earlier-later-journeys.js';
+import {journeysFailsWithNoProduct} from './lib/journeys-fails-with-no-product.js';
+import {testDepartures} from './lib/departures.js';
+import {testArrivals} from './lib/arrivals.js';
-const T_MOCK = 1671260400 * 1000 // 2022-12-17T08:00:00+01:00
-const when = createWhen(cflProfile.timezone, cflProfile.locale, T_MOCK)
+const T_MOCK = 1671260400 * 1000; // 2022-12-17T08:00:00+01:00
+const when = createWhen(cflProfile.timezone, cflProfile.locale, T_MOCK);
const cfg = {
when,
@@ -28,65 +28,69 @@ const cfg = {
minLatitude: 47.24,
maxLatitude: 52.9,
minLongitude: -0.63,
- maxLongitude: 14.07
-}
+ maxLongitude: 14.07,
+};
-const _validateLine = createValidateLine(cfg)
+const _validateLine = createValidateLine(cfg);
const validateLine = (validate, l, name) => {
- if (!l.direction) l = Object.assign({}, l, {direction: 'foo'})
- _validateLine(validate, l, name)
-}
+ if (!l.direction) {
+ l = Object.assign({}, l, {direction: 'foo'});
+ }
+ _validateLine(validate, l, name);
+};
-const _validateJourneyLeg = createValidateJourneyLeg(cfg)
+const _validateJourneyLeg = createValidateJourneyLeg(cfg);
const validateJourneyLeg = (validate, l, name) => {
- if (!l.direction) l = Object.assign({}, l, {direction: 'foo'})
- _validateJourneyLeg(validate, l, name)
-}
+ if (!l.direction) {
+ l = Object.assign({}, l, {direction: 'foo'});
+ }
+ _validateJourneyLeg(validate, l, name);
+};
-const _validateMovement = createValidateMovement(cfg)
+const _validateMovement = createValidateMovement(cfg);
const validateMovement = (val, m, name = 'movement') => {
// todo: fix this upstream
- const withFakeLocation = Object.assign({}, m)
+ const withFakeLocation = Object.assign({}, m);
withFakeLocation.location = Object.assign({}, m.location, {
latitude: 50,
- longitude: 12
- })
- _validateMovement(val, withFakeLocation, name)
+ longitude: 12,
+ });
+ _validateMovement(val, withFakeLocation, name);
- assert.ok(m.location.latitude <= 55, name + '.location.latitude is too small')
- assert.ok(m.location.latitude >= 45, name + '.location.latitude is too large')
- assert.ok(m.location.longitude >= 1, name + '.location.longitude is too small')
- assert.ok(m.location.longitude <= 11, name + '.location.longitude is too small')
-}
+ assert.ok(m.location.latitude <= 55, name + '.location.latitude is too small');
+ assert.ok(m.location.latitude >= 45, name + '.location.latitude is too large');
+ assert.ok(m.location.longitude >= 1, name + '.location.longitude is too small');
+ assert.ok(m.location.longitude <= 11, name + '.location.longitude is too small');
+};
const validate = createValidate(cfg, {
line: validateLine,
journeyLeg: validateJourneyLeg,
- movement: validateMovement
-})
+ movement: validateMovement,
+});
-const client = createClient(cflProfile, 'public-transport/hafas-client:test')
+const client = createClient(cflProfile, 'public-transport/hafas-client:test');
-const ettelbruck = '9258199'
-const mersch = '9864348'
-const luxembourgGareCentrale = '9217081'
+const ettelbruck = '9258199';
+const mersch = '9864348';
+const luxembourgGareCentrale = '9217081';
tap.test('journeys – Ettelbruck to Luxembourg', async (t) => {
const res = await client.journeys(ettelbruck, luxembourgGareCentrale, {
results: 4,
departure: when,
- stopovers: true
- })
+ stopovers: true,
+ });
await testJourneysStationToStation({
test: t,
res,
validate,
fromId: ettelbruck,
- toId: luxembourgGareCentrale
- })
- t.end()
-})
+ toId: luxembourgGareCentrale,
+ });
+ t.end();
+});
// todo: journeys, only one product
@@ -98,35 +102,35 @@ tap.test('journeys – fails with no product', async (t) => {
toId: luxembourgGareCentrale,
when,
products: cflProfile.products,
- })
- t.end()
-})
+ });
+ t.end();
+});
tap.test('Luxembourg to 9071 Ettelbruck, Rue des Romains 4', async (t) => {
const rueDeRomain = {
type: 'location',
address: '9071 Ettelbruck, Rue des Romains 4',
latitude: 49.847469,
- longitude: 6.097608
- }
+ longitude: 6.097608,
+ };
const res = await client.journeys(luxembourgGareCentrale, rueDeRomain, {
results: 3,
- departure: when
- })
+ departure: when,
+ });
await testJourneysStationToAddress({
test: t,
res,
validate,
fromId: luxembourgGareCentrale,
- to: rueDeRomain
- })
- t.end()
-})
+ to: rueDeRomain,
+ });
+ t.end();
+});
tap.test('Luxembourg to Centre Hospitalier du Nord', async (t) => {
- const luxembourg = '9217081'
+ const luxembourg = '9217081';
const centreHospitalier = {
type: 'location',
id: '990027653',
@@ -134,21 +138,21 @@ tap.test('Luxembourg to Centre Hospitalier du Nord', async (t) => {
name: 'Centre Hospitalier du Nord (CHDN), Ettelbruck',
latitude: 49.853168,
longitude: 6.096268,
- }
+ };
const res = await client.journeys(luxembourgGareCentrale, centreHospitalier, {
results: 3,
- departure: when
- })
+ departure: when,
+ });
await testJourneysStationToPoi({
test: t,
res,
validate,
fromId: luxembourg,
- to: centreHospitalier
- })
- t.end()
-})
+ to: centreHospitalier,
+ });
+ t.end();
+});
// todo: journeys: via works – with detour
// todo: without detour
@@ -161,53 +165,53 @@ tap.test('earlier/later journeys', async (t) => {
fromId: luxembourgGareCentrale,
toId: ettelbruck,
when,
- })
+ });
- t.end()
-})
+ t.end();
+});
tap.test('trip', async (t) => {
- const { journeys } = await client.journeys(luxembourgGareCentrale, ettelbruck, {
- results: 1, departure: when
- })
+ const {journeys} = await client.journeys(luxembourgGareCentrale, ettelbruck, {
+ results: 1, departure: when,
+ });
- const p = journeys[0].legs.find(l => !l.walking)
- t.ok(p.tripId, 'precondition failed')
- t.ok(p.line.name, 'precondition failed')
+ const p = journeys[0].legs.find(l => !l.walking);
+ t.ok(p.tripId, 'precondition failed');
+ t.ok(p.line.name, 'precondition failed');
- const tripRes = await client.trip(p.tripId, {when})
+ const tripRes = await client.trip(p.tripId, {when});
- validate(t, tripRes, 'tripResult', 'res')
- t.end()
-})
+ validate(t, tripRes, 'tripResult', 'res');
+ t.end();
+});
tap.test('departures at Ettelbruck.', async (t) => {
const res = await client.departures(ettelbruck, {
- duration: 20, when
- })
+ duration: 20, when,
+ });
await testDepartures({
test: t,
res,
validate,
- id: ettelbruck
- })
- t.end()
-})
+ id: ettelbruck,
+ });
+ t.end();
+});
tap.test('arrivals at Ettelbruck.', async (t) => {
const res = await client.arrivals(ettelbruck, {
- duration: 20, when
- })
+ duration: 20, when,
+ });
await testArrivals({
test: t,
res,
validate,
- id: ettelbruck
- })
- t.end()
-})
+ id: ettelbruck,
+ });
+ t.end();
+});
tap.test('departures with station object', async (t) => {
const res = await client.departures({
@@ -217,53 +221,55 @@ tap.test('departures with station object', async (t) => {
location: {
type: 'location',
latitude: 49.847298,
- longitude: 6.106157
- }
- }, {when})
+ longitude: 6.106157,
+ },
+ }, {when});
- validate(t, res, 'departuresResponse', 'res')
- t.end()
-})
+ validate(t, res, 'departuresResponse', 'res');
+ t.end();
+});
// todo: nearby
tap.test('locations named Mersch', async (t) => {
const locations = await client.locations('Mersch', {
- results: 20
- })
+ results: 20,
+ });
- validate(t, locations, 'locations', 'locations')
- t.ok(locations.length <= 20)
+ validate(t, locations, 'locations', 'locations');
+ t.ok(locations.length <= 20);
- t.ok(locations.find(s => s.type === 'stop' || s.type === 'station'))
- t.ok(locations.find(s => s.poi))
+ t.ok(locations.find(s => s.type === 'stop' || s.type === 'station'));
+ t.ok(locations.find(s => s.poi));
t.ok(locations.some((loc) => {
- if (loc.station && loc.station.id === mersch) return true
- return loc.id === mersch
- }))
+ if (loc.station && loc.station.id === mersch) {
+ return true;
+ }
+ return loc.id === mersch;
+ }));
- t.end()
-})
+ t.end();
+});
tap.test('stop Mersch', async (t) => {
- const s = await client.stop(mersch)
+ const s = await client.stop(mersch);
- validate(t, s, ['stop', 'station'], 'stop')
- t.equal(s.id, mersch)
+ validate(t, s, ['stop', 'station'], 'stop');
+ t.equal(s.id, mersch);
- t.end()
-})
+ t.end();
+});
tap.test('radar', async (t) => {
const res = await client.radar({
north: 49.9,
west: 6.05,
south: 49.8,
- east: 6.15
+ east: 6.15,
}, {
- duration: 5 * 60, when, results: 10
- })
+ duration: 5 * 60, when, results: 10,
+ });
- validate(t, res, 'radarResult', 'res')
- t.end()
-})
+ validate(t, res, 'radarResult', 'res');
+ t.end();
+});
diff --git a/test/e2e/cmta.js b/test/e2e/cmta.js
index a262f0e5..81968e64 100644
--- a/test/e2e/cmta.js
+++ b/test/e2e/cmta.js
@@ -1,22 +1,22 @@
-import tap from 'tap'
+import tap from 'tap';
-import {createWhen} from './lib/util.js'
-import {createClient} from '../../index.js'
-import {profile as cmtaProfile} from '../../p/cmta/index.js'
-import {createValidateFptfWith as createValidate} from './lib/validate-fptf-with.js'
-import {testJourneysStationToStation} from './lib/journeys-station-to-station.js'
-import {testJourneysStationToAddress} from './lib/journeys-station-to-address.js'
-import {testJourneysStationToPoi} from './lib/journeys-station-to-poi.js'
-import {testEarlierLaterJourneys} from './lib/earlier-later-journeys.js'
-import {testRefreshJourney} from './lib/refresh-journey.js'
-import {journeysFailsWithNoProduct} from './lib/journeys-fails-with-no-product.js'
-import {testDepartures} from './lib/departures.js'
-import {testArrivals} from './lib/arrivals.js'
-import {testJourneysWithDetour} from './lib/journeys-with-detour.js'
-import {testReachableFrom} from './lib/reachable-from.js'
+import {createWhen} from './lib/util.js';
+import {createClient} from '../../index.js';
+import {profile as cmtaProfile} from '../../p/cmta/index.js';
+import {createValidateFptfWith as createValidate} from './lib/validate-fptf-with.js';
+import {testJourneysStationToStation} from './lib/journeys-station-to-station.js';
+import {testJourneysStationToAddress} from './lib/journeys-station-to-address.js';
+import {testJourneysStationToPoi} from './lib/journeys-station-to-poi.js';
+import {testEarlierLaterJourneys} from './lib/earlier-later-journeys.js';
+import {testRefreshJourney} from './lib/refresh-journey.js';
+import {journeysFailsWithNoProduct} from './lib/journeys-fails-with-no-product.js';
+import {testDepartures} from './lib/departures.js';
+import {testArrivals} from './lib/arrivals.js';
+import {testJourneysWithDetour} from './lib/journeys-with-detour.js';
+import {testReachableFrom} from './lib/reachable-from.js';
-const T_MOCK = 1670310000 * 1000 // 2022-12-06T08:00:00+01:00
-const when = createWhen(cmtaProfile.timezone, cmtaProfile.locale, T_MOCK)
+const T_MOCK = 1670310000 * 1000; // 2022-12-06T08:00:00+01:00
+const when = createWhen(cmtaProfile.timezone, cmtaProfile.locale, T_MOCK);
const cfg = {
when,
@@ -25,33 +25,33 @@ const cfg = {
minLatitude: 26,
maxLatitude: 33,
minLongitude: -100,
- maxLongitude: -95
-}
+ maxLongitude: -95,
+};
-const validate = createValidate(cfg)
+const validate = createValidate(cfg);
-const client = createClient(cmtaProfile, 'public-transport/hafas-client:test')
+const client = createClient(cmtaProfile, 'public-transport/hafas-client:test');
-const broadieOaks = '2370'
-const domain = '5919'
-const capitol591 = '591'
+const broadieOaks = '2370';
+const domain = '5919';
+const capitol591 = '591';
tap.test('journeys – Broadie Oaks to Domain', async (t) => {
const res = await client.journeys(broadieOaks, domain, {
results: 4,
departure: when,
- stopovers: true
- })
+ stopovers: true,
+ });
await testJourneysStationToStation({
test: t,
res,
validate,
fromId: broadieOaks,
- toId: domain
- })
- t.end()
-})
+ toId: domain,
+ });
+ t.end();
+});
// todo: journeys, only one product
@@ -63,32 +63,32 @@ tap.test('journeys – fails with no product', async (t) => {
toId: domain,
when,
products: cmtaProfile.products,
- })
- t.end()
-})
+ });
+ t.end();
+});
tap.test('Domain to 1104 Elm Street, Austin, TX 78703', async (t) => {
const someAddress = {
type: 'location',
address: '1104 ELM ST, Austin, TX 78703',
latitude: 30.279220,
- longitude: -97.758292
- }
+ longitude: -97.758292,
+ };
const res = await client.journeys(domain, someAddress, {
results: 3,
- departure: when
- })
+ departure: when,
+ });
await testJourneysStationToAddress({
test: t,
res,
validate,
fromId: domain,
- to: someAddress
- })
- t.end()
-})
+ to: someAddress,
+ });
+ t.end();
+});
tap.test('Domain to WHOLE FOODS MARKET - ARBOR TRAILS', async (t) => {
const wholeFoodsMarket = {
@@ -98,21 +98,21 @@ tap.test('Domain to WHOLE FOODS MARKET - ARBOR TRAILS', async (t) => {
name: 'WHOLE FOODS MARKET - ARBOR TRAILS',
latitude: 30.22026,
longitude: -97.84174,
- }
+ };
const res = await client.journeys(domain, wholeFoodsMarket, {
results: 3,
- departure: when
- })
+ departure: when,
+ });
await testJourneysStationToPoi({
test: t,
res,
validate,
fromId: domain,
- to: wholeFoodsMarket
- })
- t.end()
-})
+ to: wholeFoodsMarket,
+ });
+ t.end();
+});
// todo: walkingSpeed "2107 MELRIDGE PL" -> 000002148
// todo: via works – with detour
@@ -125,11 +125,11 @@ tap.test('earlier/later journeys', async (t) => {
validate,
fromId: broadieOaks,
toId: domain,
- when
- })
+ when,
+ });
- t.end()
-})
+ t.end();
+});
tap.test('refreshJourney', async (t) => {
await testRefreshJourney({
@@ -139,39 +139,39 @@ tap.test('refreshJourney', async (t) => {
validate,
fromId: broadieOaks,
toId: domain,
- when
- })
- t.end()
-})
+ when,
+ });
+ t.end();
+});
tap.test('trip details', async (t) => {
const res = await client.journeys(broadieOaks, domain, {
- results: 1, departure: when
- })
+ results: 1, departure: when,
+ });
- const p = res.journeys[0].legs.find(l => !l.walking)
- t.ok(p.tripId, 'precondition failed')
- t.ok(p.line.name, 'precondition failed')
+ const p = res.journeys[0].legs.find(l => !l.walking);
+ t.ok(p.tripId, 'precondition failed');
+ t.ok(p.line.name, 'precondition failed');
- const tripRes = await client.trip(p.tripId, {when})
+ const tripRes = await client.trip(p.tripId, {when});
- validate(t, tripRes, 'tripResult', 'res')
- t.end()
-})
+ validate(t, tripRes, 'tripResult', 'res');
+ t.end();
+});
tap.test('departures at Broadie Oaks', async (t) => {
const res = await client.departures(broadieOaks, {
duration: 10, when,
- })
+ });
await testDepartures({
test: t,
res,
validate,
- id: broadieOaks
- })
- t.end()
-})
+ id: broadieOaks,
+ });
+ t.end();
+});
tap.test('departures with station object', async (t) => {
const res = await client.departures({
@@ -181,69 +181,69 @@ tap.test('departures with station object', async (t) => {
location: {
type: 'location',
latitude: 1.23,
- longitude: 2.34
- }
- }, {when})
+ longitude: 2.34,
+ },
+ }, {when});
- validate(t, res, 'departuresResponse', 'res')
- t.end()
-})
+ validate(t, res, 'departuresResponse', 'res');
+ t.end();
+});
tap.test('arrivals at Broadie Oaks', async (t) => {
const res = await client.arrivals(broadieOaks, {
- duration: 10, when
- })
+ duration: 10, when,
+ });
await testArrivals({
test: t,
res,
validate,
- id: broadieOaks
- })
- t.end()
-})
+ id: broadieOaks,
+ });
+ t.end();
+});
// todo: nearby
tap.test('locations named "Capitol"', async (t) => {
const locations = await client.locations('Capitol', {
- results: 10
- })
+ results: 10,
+ });
- validate(t, locations, 'locations', 'locations')
- t.ok(locations.length <= 10)
+ validate(t, locations, 'locations', 'locations');
+ t.ok(locations.length <= 10);
- t.ok(locations.find(s => s.type === 'stop' || s.type === 'station'))
- t.ok(locations.find(s => s.poi)) // POIs
+ t.ok(locations.find(s => s.type === 'stop' || s.type === 'station'));
+ t.ok(locations.find(s => s.poi)); // POIs
t.ok(locations.some((l) => {
- return l.station && l.station.id === capitol591 || l.id === capitol591
- }))
+ return l.station && l.station.id === capitol591 || l.id === capitol591;
+ }));
- t.end()
-})
+ t.end();
+});
tap.test('station Domain', async (t) => {
- const s = await client.stop(domain)
+ const s = await client.stop(domain);
- validate(t, s, ['stop', 'station'], 'station')
- t.equal(s.id, domain)
+ validate(t, s, ['stop', 'station'], 'station');
+ t.equal(s.id, domain);
- t.end()
-})
+ t.end();
+});
tap.test('radar', async (t) => {
const res = await client.radar({
north: 30.240877,
west: -97.804588,
south: 30.225378,
- east: -97.786692
+ east: -97.786692,
}, {
- duration: 5 * 60, when, results: 10
- })
+ duration: 5 * 60, when, results: 10,
+ });
- validate(t, res, 'radarResult', 'res')
- t.end()
-})
+ validate(t, res, 'radarResult', 'res');
+ t.end();
+});
tap.test('reachableFrom', async (t) => {
await testReachableFrom({
@@ -253,11 +253,11 @@ tap.test('reachableFrom', async (t) => {
type: 'location',
address: '604 W 9TH ST, Austin, TX 78701',
latitude: 30.272910,
- longitude: -97.747883
+ longitude: -97.747883,
},
when,
maxDuration: 15,
- validate
- })
- t.end()
-})
+ validate,
+ });
+ t.end();
+});
diff --git a/test/e2e/common.js b/test/e2e/common.js
index 542753b2..61058de2 100644
--- a/test/e2e/common.js
+++ b/test/e2e/common.js
@@ -1,12 +1,12 @@
-import tap from 'tap'
+import tap from 'tap';
-import {createClient} from '../../index.js'
-import {profile as vbbProfile} from '../../p/vbb/index.js'
+import {createClient} from '../../index.js';
+import {profile as vbbProfile} from '../../p/vbb/index.js';
-const client = createClient(vbbProfile, 'public-transport/hafas-client:test')
+const client = createClient(vbbProfile, 'public-transport/hafas-client:test');
tap.test('exposes the profile', (t) => {
- t.ok(client.profile)
- t.equal(client.profile.endpoint, vbbProfile.endpoint)
- t.end()
-})
+ t.ok(client.profile);
+ t.equal(client.profile.endpoint, vbbProfile.endpoint);
+ t.end();
+});
diff --git a/test/e2e/dart.js b/test/e2e/dart.js
index 7edb4b83..39c72a35 100644
--- a/test/e2e/dart.js
+++ b/test/e2e/dart.js
@@ -1,12 +1,12 @@
-import tap from 'tap'
+import tap from 'tap';
-import {createWhen} from './lib/util.js'
-import {createClient} from '../../index.js'
-import {profile as dartProfile} from '../../p/dart/index.js'
-import {createValidateFptfWith as createValidate} from './lib/validate-fptf-with.js'
+import {createWhen} from './lib/util.js';
+import {createClient} from '../../index.js';
+import {profile as dartProfile} from '../../p/dart/index.js';
+import {createValidateFptfWith as createValidate} from './lib/validate-fptf-with.js';
-const T_MOCK = 1671260400 * 1000 // 2022-12-17T08:00:00+01:00
-const when = createWhen(dartProfile.timezone, dartProfile.locale, T_MOCK)
+const T_MOCK = 1671260400 * 1000; // 2022-12-17T08:00:00+01:00
+const when = createWhen(dartProfile.timezone, dartProfile.locale, T_MOCK);
const cfg = {
when,
@@ -16,20 +16,20 @@ const cfg = {
maxLongitude: -88.176,
minLatitude: 37.745,
minLongitude: -96.877,
-}
-const validate = createValidate(cfg)
+};
+const validate = createValidate(cfg);
-const client = createClient(dartProfile, 'public-transport/hafas-client:test')
+const client = createClient(dartProfile, 'public-transport/hafas-client:test');
-const mlkJrParkwayAdamsAve = '951013488' // MARTIN LUTHER KING JR PKWY/ADAMS AVE
+const mlkJrParkwayAdamsAve = '951013488'; // MARTIN LUTHER KING JR PKWY/ADAMS AVE
tap.test('locations named "martin luther kind adams"', async (t) => {
- const locations = await client.locations('martin luther kind adams')
+ const locations = await client.locations('martin luther kind adams');
- validate(t, locations, 'locations', 'locations')
+ validate(t, locations, 'locations', 'locations');
t.ok(locations.some((l) => {
- return l.station && l.station.id === mlkJrParkwayAdamsAve || l.id === mlkJrParkwayAdamsAve
- }), '"MARTIN LUTHER KING JR PKWY/ADAMS AVE" not found')
+ return l.station && l.station.id === mlkJrParkwayAdamsAve || l.id === mlkJrParkwayAdamsAve;
+ }), '"MARTIN LUTHER KING JR PKWY/ADAMS AVE" not found');
- t.end()
-})
+ t.end();
+});
diff --git a/test/e2e/db-busradar-nrw.js b/test/e2e/db-busradar-nrw.js
index 34a812b9..3585db7a 100644
--- a/test/e2e/db-busradar-nrw.js
+++ b/test/e2e/db-busradar-nrw.js
@@ -1,17 +1,17 @@
-import tap from 'tap'
-import isRoughlyEqual from 'is-roughly-equal'
+import tap from 'tap';
+import isRoughlyEqual from 'is-roughly-equal';
-import {createWhen} from './lib/util.js'
-import {createClient} from '../../index.js'
-import {profile as dbBusradarNrwProfile} from '../../p/db-busradar-nrw/index.js'
-import {createValidateFptfWith as createValidate} from './lib/validate-fptf-with.js'
-import {testDepartures} from './lib/departures.js'
-import {testArrivals} from './lib/arrivals.js'
+import {createWhen} from './lib/util.js';
+import {createClient} from '../../index.js';
+import {profile as dbBusradarNrwProfile} from '../../p/db-busradar-nrw/index.js';
+import {createValidateFptfWith as createValidate} from './lib/validate-fptf-with.js';
+import {testDepartures} from './lib/departures.js';
+import {testArrivals} from './lib/arrivals.js';
-const isObj = o => o !== null && 'object' === typeof o && !Array.isArray(o)
+const isObj = o => o !== null && 'object' === typeof o && !Array.isArray(o);
-const T_MOCK = 1668495600 * 1000 // 2022-11-15T08:00:00+01:00
-const when = createWhen(dbBusradarNrwProfile.timezone, dbBusradarNrwProfile.locale, T_MOCK)
+const T_MOCK = 1668495600 * 1000; // 2022-11-15T08:00:00+01:00
+const when = createWhen(dbBusradarNrwProfile.timezone, dbBusradarNrwProfile.locale, T_MOCK);
const cfg = {
when,
@@ -20,45 +20,45 @@ const cfg = {
minLatitude: 49.5,
maxLatitude: 55,
minLongitude: 4,
- maxLongitude: 14
-}
+ maxLongitude: 14,
+};
-const validate = createValidate(cfg, {})
+const validate = createValidate(cfg, {});
-const client = createClient(dbBusradarNrwProfile, 'public-transport/hafas-client:test')
+const client = createClient(dbBusradarNrwProfile, 'public-transport/hafas-client:test');
-const hagenBauhaus = '3307002'
-const bielefeldHbf = '8000036'
-const hagenVorhalle = '8000977'
+const hagenBauhaus = '3307002';
+const bielefeldHbf = '8000036';
+const hagenVorhalle = '8000977';
tap.test('departures at Hagen Bauhaus', async (t) => {
const res = await client.departures(hagenBauhaus, {
duration: 120, when,
- })
+ });
await testDepartures({
test: t,
res,
validate,
- id: hagenBauhaus
- })
- t.end()
-})
+ id: hagenBauhaus,
+ });
+ t.end();
+});
tap.test('trip details', async (t) => {
const res = await client.departures(hagenBauhaus, {
- results: 1, duration: 120, when
- })
+ results: 1, duration: 120, when,
+ });
- const p = res.departures[0] || {}
- t.ok(p.tripId, 'precondition failed')
- t.ok(p.line.name, 'precondition failed')
+ const p = res.departures[0] || {};
+ t.ok(p.tripId, 'precondition failed');
+ t.ok(p.line.name, 'precondition failed');
- const tripRes = await client.trip(p.tripId, {when})
+ const tripRes = await client.trip(p.tripId, {when});
- validate(t, tripRes, 'tripResult', 'res')
- t.end()
-})
+ validate(t, tripRes, 'tripResult', 'res');
+ t.end();
+});
tap.test('departures with station object', async (t) => {
const res = await client.departures({
@@ -68,72 +68,72 @@ tap.test('departures with station object', async (t) => {
location: {
type: 'location',
latitude: 51.375141,
- longitude: 7.455626
- }
- }, {when, duration: 120})
+ longitude: 7.455626,
+ },
+ }, {when, duration: 120});
- validate(t, res, 'departuresResponse', 'res')
- t.end()
-})
+ validate(t, res, 'departuresResponse', 'res');
+ t.end();
+});
// todo: departures at hagenBauhaus in direction of …
tap.test('arrivals at Hagen Bauhaus', async (t) => {
const res = await client.arrivals(hagenBauhaus, {
- duration: 120, when
- })
+ duration: 120, when,
+ });
await testArrivals({
test: t,
res,
validate,
- id: hagenBauhaus
- })
- t.end()
-})
+ id: hagenBauhaus,
+ });
+ t.end();
+});
// todo: nearby
tap.test('locations named Vorhalle', async (t) => {
const locations = await client.locations('vorhalle', {
- results: 10
- })
+ results: 10,
+ });
- validate(t, locations, 'locations', 'locations')
- t.ok(locations.length <= 20)
+ validate(t, locations, 'locations', 'locations');
+ t.ok(locations.length <= 20);
- t.ok(locations.find(s => s.type === 'stop' || s.type === 'station'))
+ t.ok(locations.find(s => s.type === 'stop' || s.type === 'station'));
t.ok(locations.some((l) => {
return l.station && l.station.id === hagenVorhalle
- || l.id === hagenVorhalle
- }))
+ || l.id === hagenVorhalle;
+ }));
- t.end()
-})
+ t.end();
+});
tap.test('station Hagen-Vorhalle', async (t) => {
- const s = await client.stop(hagenVorhalle)
+ const s = await client.stop(hagenVorhalle);
- validate(t, s, ['stop', 'station'], 'station')
- t.equal(s.id, hagenVorhalle)
+ validate(t, s, ['stop', 'station'], 'station');
+ t.equal(s.id, hagenVorhalle);
- t.end()
-})
+ t.end();
+});
tap.test('radar', async (t) => {
const res = await client.radar({
north: 51.5,
west: 7.2,
south: 51.2,
- east: 7.8
+ east: 7.8,
}, {
- duration: 5 * 60, when, results: 10
- })
+ duration: 5 * 60, when, results: 10,
+ });
const validate = createValidate({
...cfg,
stationCoordsOptional: true,
- }, {})
- validate(t, res, 'radarResult', 'res')
- t.end()
-})
+ }, {});
+ validate(t, res, 'radarResult', 'res');
+ t.end();
+});
diff --git a/test/e2e/db.js b/test/e2e/db.js
index 977569f0..e458b845 100644
--- a/test/e2e/db.js
+++ b/test/e2e/db.js
@@ -1,37 +1,37 @@
-import tap from 'tap'
-import isRoughlyEqual from 'is-roughly-equal'
-import maxBy from 'lodash/maxBy.js'
-import flatMap from 'lodash/flatMap.js'
-import last from 'lodash/last.js'
+import tap from 'tap';
+import isRoughlyEqual from 'is-roughly-equal';
+import maxBy from 'lodash/maxBy.js';
+import flatMap from 'lodash/flatMap.js';
+import last from 'lodash/last.js';
-import {createWhen} from './lib/util.js'
-import {createClient} from '../../index.js'
-import {profile as dbProfile} from '../../p/db/index.js'
-import {routingModes} from '../../p/db/routing-modes.js'
+import {createWhen} from './lib/util.js';
+import {createClient} from '../../index.js';
+import {profile as dbProfile} from '../../p/db/index.js';
+import {routingModes} from '../../p/db/routing-modes.js';
import {
- createValidateStation,
- createValidateTrip
-} from './lib/validators.js'
-import {createValidateFptfWith as createValidate} from './lib/validate-fptf-with.js'
-import {testJourneysStationToStation} from './lib/journeys-station-to-station.js'
-import {testJourneysStationToAddress} from './lib/journeys-station-to-address.js'
-import {testJourneysStationToPoi} from './lib/journeys-station-to-poi.js'
-import {testEarlierLaterJourneys} from './lib/earlier-later-journeys.js'
-import {testLegCycleAlternatives} from './lib/leg-cycle-alternatives.js'
-import {testRefreshJourney} from './lib/refresh-journey.js'
-import {journeysFailsWithNoProduct} from './lib/journeys-fails-with-no-product.js'
-import {testDepartures} from './lib/departures.js'
-import {testDeparturesInDirection} from './lib/departures-in-direction.js'
-import {testArrivals} from './lib/arrivals.js'
-import {testJourneysWithDetour} from './lib/journeys-with-detour.js'
-import {testReachableFrom} from './lib/reachable-from.js'
-import {testServerInfo} from './lib/server-info.js'
+ createValidateStation,
+ createValidateTrip,
+} from './lib/validators.js';
+import {createValidateFptfWith as createValidate} from './lib/validate-fptf-with.js';
+import {testJourneysStationToStation} from './lib/journeys-station-to-station.js';
+import {testJourneysStationToAddress} from './lib/journeys-station-to-address.js';
+import {testJourneysStationToPoi} from './lib/journeys-station-to-poi.js';
+import {testEarlierLaterJourneys} from './lib/earlier-later-journeys.js';
+import {testLegCycleAlternatives} from './lib/leg-cycle-alternatives.js';
+import {testRefreshJourney} from './lib/refresh-journey.js';
+import {journeysFailsWithNoProduct} from './lib/journeys-fails-with-no-product.js';
+import {testDepartures} from './lib/departures.js';
+import {testDeparturesInDirection} from './lib/departures-in-direction.js';
+import {testArrivals} from './lib/arrivals.js';
+import {testJourneysWithDetour} from './lib/journeys-with-detour.js';
+import {testReachableFrom} from './lib/reachable-from.js';
+import {testServerInfo} from './lib/server-info.js';
-const isObj = o => o !== null && 'object' === typeof o && !Array.isArray(o)
-const minute = 60 * 1000
+const isObj = o => o !== null && 'object' === typeof o && !Array.isArray(o);
+const minute = 60 * 1000;
-const T_MOCK = 1696921200 * 1000 // 2023-10-10T08:00:00+01:00
-const when = createWhen(dbProfile.timezone, dbProfile.locale, T_MOCK)
+const T_MOCK = 1696921200 * 1000; // 2023-10-10T08:00:00+01:00
+const when = createWhen(dbProfile.timezone, dbProfile.locale, T_MOCK);
const cfg = {
when,
@@ -40,61 +40,63 @@ const cfg = {
minLatitude: 46.673100,
maxLatitude: 55.030671,
minLongitude: 6.896517,
- maxLongitude: 16.180237
-}
+ maxLongitude: 16.180237,
+};
-const validate = createValidate(cfg)
+const validate = createValidate(cfg);
const assertValidPrice = (t, p) => {
- t.ok(p)
+ t.ok(p);
if (p.amount !== null) {
- t.equal(typeof p.amount, 'number')
- t.ok(p.amount > 0)
+ t.equal(typeof p.amount, 'number');
+ t.ok(p.amount > 0);
}
if (p.hint !== null) {
- t.equal(typeof p.hint, 'string')
- t.ok(p.hint)
+ t.equal(typeof p.hint, 'string');
+ t.ok(p.hint);
}
-}
+};
-const client = createClient(dbProfile, 'public-transport/hafas-client:test')
+const client = createClient(dbProfile, 'public-transport/hafas-client:test');
-const berlinHbf = '8011160'
-const münchenHbf = '8000261'
-const jungfernheide = '8011167'
-const blnSchwedterStr = '732652'
-const westhafen = '8089116'
-const wedding = '8089131'
-const württembergallee = '731084'
-const regensburgHbf = '8000309'
-const blnOstbahnhof = '8010255'
-const blnTiergarten = '8089091'
-const blnJannowitzbrücke = '8089019'
-const potsdamHbf = '8012666'
-const berlinSüdkreuz = '8011113'
-const kölnHbf = '8000207'
+const berlinHbf = '8011160';
+const münchenHbf = '8000261';
+const jungfernheide = '8011167';
+const blnSchwedterStr = '732652';
+const westhafen = '8089116';
+const wedding = '8089131';
+const württembergallee = '731084';
+const regensburgHbf = '8000309';
+const blnOstbahnhof = '8010255';
+const blnTiergarten = '8089091';
+const blnJannowitzbrücke = '8089019';
+const potsdamHbf = '8012666';
+const berlinSüdkreuz = '8011113';
+const kölnHbf = '8000207';
tap.test('journeys – Berlin Schwedter Str. to München Hbf', async (t) => {
const res = await client.journeys(blnSchwedterStr, münchenHbf, {
results: 4,
departure: when,
- stopovers: true
- })
+ stopovers: true,
+ });
await testJourneysStationToStation({
test: t,
res,
validate,
fromId: blnSchwedterStr,
- toId: münchenHbf
- })
+ toId: münchenHbf,
+ });
// todo: find a journey where there pricing info is always available
for (let journey of res.journeys) {
- if (journey.price) assertValidPrice(t, journey.price)
+ if (journey.price) {
+ assertValidPrice(t, journey.price);
+ }
}
- t.end()
-})
+ t.end();
+});
// todo: journeys, only one product
@@ -106,31 +108,31 @@ tap.test('journeys – fails with no product', async (t) => {
toId: münchenHbf,
when,
products: dbProfile.products,
- })
- t.end()
-})
+ });
+ t.end();
+});
tap.test('Berlin Schwedter Str. to Torfstraße 17', async (t) => {
const torfstr = {
type: 'location',
address: 'Torfstraße 17',
latitude: 52.5416823,
- longitude: 13.3491223
- }
+ longitude: 13.3491223,
+ };
const res = await client.journeys(blnSchwedterStr, torfstr, {
results: 3,
- departure: when
- })
+ departure: when,
+ });
await testJourneysStationToAddress({
test: t,
res,
validate,
fromId: blnSchwedterStr,
- to: torfstr
- })
- t.end()
-})
+ to: torfstr,
+ });
+ t.end();
+});
tap.test('Berlin Schwedter Str. to ATZE Musiktheater', async (t) => {
const atze = {
@@ -139,22 +141,22 @@ tap.test('Berlin Schwedter Str. to ATZE Musiktheater', async (t) => {
poi: true,
name: 'Berlin, Atze Musiktheater für Kinder (Kultur und U',
latitude: 52.542417,
- longitude: 13.350437
- }
+ longitude: 13.350437,
+ };
const res = await client.journeys(blnSchwedterStr, atze, {
results: 3,
- departure: when
- })
+ departure: when,
+ });
await testJourneysStationToPoi({
test: t,
res,
validate,
fromId: blnSchwedterStr,
- to: atze
- })
- t.end()
-})
+ to: atze,
+ });
+ t.end();
+});
tap.test('journeys: via works – with detour', async (t) => {
// Going from Westhafen to Wedding via Württembergalle without detour
@@ -163,17 +165,17 @@ tap.test('journeys: via works – with detour', async (t) => {
via: württembergallee,
results: 1,
departure: when,
- stopovers: true
- })
+ stopovers: true,
+ });
await testJourneysWithDetour({
test: t,
res,
validate,
- detourIds: [württembergallee]
- })
- t.end()
-})
+ detourIds: [württembergallee],
+ });
+ t.end();
+});
// todo: walkingSpeed "Berlin - Charlottenburg, Hallerstraße" -> jungfernheide
// todo: without detour
@@ -184,11 +186,11 @@ tap.test('journeys – all routing modes work', async (t) => {
results: 1,
departure: when,
routingMode: mode,
- })
+ });
}
- t.end()
-})
+ t.end();
+});
// todo: with the DB endpoint, earlierRef/laterRef is missing queries many days in the future
tap.skip('earlier/later journeys, Jungfernheide -> München Hbf', async (t) => {
@@ -199,10 +201,10 @@ tap.skip('earlier/later journeys, Jungfernheide -> München Hbf', async (t) => {
fromId: jungfernheide,
toId: münchenHbf,
when,
- })
+ });
- t.end()
-})
+ t.end();
+});
if (!process.env.VCR_MODE) {
tap.test('journeys – leg cycle & alternatives', async (t) => {
@@ -212,9 +214,9 @@ if (!process.env.VCR_MODE) {
fromId: blnTiergarten,
toId: blnJannowitzbrücke,
when,
- })
- t.end()
- })
+ });
+ t.end();
+ });
}
tap.test('refreshJourney', async (t) => {
@@ -225,137 +227,141 @@ tap.test('refreshJourney', async (t) => {
validate,
fromId: jungfernheide,
toId: münchenHbf,
- when
- })
- t.end()
-})
+ when,
+ });
+ t.end();
+});
tap.skip('journeysFromTrip – U Mehringdamm to U Naturkundemuseum, reroute to Spittelmarkt.', async (t) => {
- const blnMehringdamm = '730939'
- const blnStadtmitte = '732541'
- const blnNaturkundemuseum = '732539'
- const blnSpittelmarkt = '732543'
+ const blnMehringdamm = '730939';
+ const blnStadtmitte = '732541';
+ const blnNaturkundemuseum = '732539';
+ const blnSpittelmarkt = '732543';
+
+ const isU6Leg = leg => leg.line && leg.line.name
+ && leg.line.name.toUpperCase()
+ .replace(/\s+/g, '') === 'U6';
- const isU6Leg = leg => (
- leg.line && leg.line.name
- && leg.line.name.toUpperCase().replace(/\s+/g, '') === 'U6'
- )
const sameStopOrStation = (stopA) => (stopB) => {
- if (stopA.id && stopB.id && stopA.id === stopB.id) return true
- const statA = stopA.stat && stopA.stat.id || NaN
- const statB = stopB.stat && stopB.stat.id || NaN
- return (statA === statB || stopA.id === statB || stopB.id === statA)
- }
- const departureOf = st => +new Date(st.departure || st.scheduledDeparture)
- const arrivalOf = st => +new Date(st.arrival || st.scheduledArrival)
+ if (stopA.id && stopB.id && stopA.id === stopB.id) {
+ return true;
+ }
+ const statA = stopA.stat && stopA.stat.id || NaN;
+ const statB = stopB.stat && stopB.stat.id || NaN;
+ return statA === statB || stopA.id === statB || stopB.id === statA;
+ };
+ const departureOf = st => Number(new Date(st.departure || st.scheduledDeparture));
+ const arrivalOf = st => Number(new Date(st.arrival || st.scheduledArrival));
// `journeysFromTrip` only supports queries *right now*, so we can't use `when` as in all
// other tests. To make the test less brittle, we pick a connection that is served all night. 🙄
- const when = new Date()
- const validate = createValidate({...cfg, when})
+ const when = new Date();
+ const validate = createValidate({...cfg, when});
const findTripBetween = async (stopAId, stopBId, products = {}) => {
const {journeys} = await client.journeys(stopAId, stopBId, {
departure: new Date(when - 10 * minute),
transfers: 0, products,
results: 8, stopovers: false, remarks: false,
- })
+ });
for (const j of journeys) {
- const l = j.legs.find(isU6Leg)
- if (!l) continue
+ const l = j.legs.find(isU6Leg);
+ if (!l) {
+ continue;
+ }
const t = await client.trip(l.tripId, {
- stopovers: true, remarks: false
- })
+ stopovers: true, remarks: false,
+ });
const pastStopovers = t.stopovers
- .filter(st => departureOf(st) < Date.now()) // todo: <= ?
+ .filter(st => departureOf(st) < Date.now()); // todo: <= ?
const hasStoppedAtA = pastStopovers
- .find(sameStopOrStation({id: stopAId}))
+ .find(sameStopOrStation({id: stopAId}));
const willStopAtB = t.stopovers
- .filter(st => arrivalOf(st) > Date.now()) // todo: >= ?
- .find(sameStopOrStation({id: stopBId}))
+ .filter(st => arrivalOf(st) > Date.now()) // todo: >= ?
+ .find(sameStopOrStation({id: stopBId}));
if (hasStoppedAtA && willStopAtB) {
- const prevStopover = maxBy(pastStopovers, departureOf)
- return {trip: t, prevStopover}
+ const prevStopover = maxBy(pastStopovers, departureOf);
+ return {trip: t, prevStopover};
}
}
- return {trip: null, prevStopover: null}
- }
+ return {trip: null, prevStopover: null};
+ };
// Find a vehicle from U Mehringdamm to U Stadtmitte (to the north) that is currently
// between these two stations.
const {trip, prevStopover} = await findTripBetween(blnMehringdamm, blnStadtmitte, {
- regionalExpress: false, regional: false, suburban: false
- })
- t.ok(trip, 'precondition failed: trip not found')
- t.ok(prevStopover, 'precondition failed: previous stopover missing')
+ regionalExpress: false, regional: false, suburban: false,
+ });
+ t.ok(trip, 'precondition failed: trip not found');
+ t.ok(prevStopover, 'precondition failed: previous stopover missing');
// todo: "Error: Suche aus dem Zug: Vor Abfahrt des Zuges"
const newJourneys = await client.journeysFromTrip(trip.id, prevStopover, blnSpittelmarkt, {
- results: 3, stopovers: true, remarks: false
- })
+ results: 3, stopovers: true, remarks: false,
+ });
// Validate with fake prices.
const withFakePrice = (j) => {
- const clone = Object.assign({}, j)
- clone.price = {amount: 123, currency: 'EUR'}
- return clone
- }
+ const clone = Object.assign({}, j);
+ clone.price = {amount: 123, currency: 'EUR'};
+ return clone;
+ };
// todo: there is no such validator!
- validate(t, newJourneys.map(withFakePrice), 'journeysFromTrip', 'newJourneys')
+ validate(t, newJourneys.map(withFakePrice), 'journeysFromTrip', 'newJourneys');
for (let i = 0; i < newJourneys.length; i++) {
- const j = newJourneys[i]
- const n = `newJourneys[${i}]`
+ const j = newJourneys[i];
+ const n = `newJourneys[${i}]`;
- const legOnTrip = j.legs.find(l => l.tripId === trip.id)
- t.ok(legOnTrip, n + ': leg with trip ID not found')
- t.equal(last(legOnTrip.stopovers).stop.id, blnStadtmitte)
+ const legOnTrip = j.legs.find(l => l.tripId === trip.id);
+ t.ok(legOnTrip, n + ': leg with trip ID not found');
+ t.equal(last(legOnTrip.stopovers).stop.id, blnStadtmitte);
}
-})
+});
tap.test('trip details', async (t) => {
const res = await client.journeys(berlinHbf, münchenHbf, {
- results: 1, departure: when
- })
+ results: 1, departure: when,
+ });
- const p = res.journeys[0].legs.find(l => !l.walking)
- t.ok(p.tripId, 'precondition failed')
- t.ok(p.line.name, 'precondition failed')
+ const p = res.journeys[0].legs.find(l => !l.walking);
+ t.ok(p.tripId, 'precondition failed');
+ t.ok(p.line.name, 'precondition failed');
- const tripRes = await client.trip(p.tripId, {when})
+ const tripRes = await client.trip(p.tripId, {when});
const validate = createValidate(cfg, {
trip: (cfg) => {
- const validateTrip = createValidateTrip(cfg)
+ const validateTrip = createValidateTrip(cfg);
const validateTripWithFakeDirection = (val, trip, name) => {
validateTrip(val, {
...trip,
direction: trip.direction || 'foo', // todo, see #49
- }, name)
- }
- return validateTripWithFakeDirection
- }
- })
- validate(t, tripRes, 'tripResult', 'tripRes')
+ }, name);
+ };
+ return validateTripWithFakeDirection;
+ },
+ });
+ validate(t, tripRes, 'tripResult', 'tripRes');
- t.end()
-})
+ t.end();
+});
tap.test('departures at Berlin Schwedter Str.', async (t) => {
const res = await client.departures(blnSchwedterStr, {
duration: 5, when,
- })
+ });
await testDepartures({
test: t,
res,
validate,
- id: blnSchwedterStr
- })
- t.end()
-})
+ id: blnSchwedterStr,
+ });
+ t.end();
+});
tap.test('departures with station object', async (t) => {
const res = await client.departures({
@@ -365,13 +371,13 @@ tap.test('departures with station object', async (t) => {
location: {
type: 'location',
latitude: 1.23,
- longitude: 2.34
- }
- }, {when})
+ longitude: 2.34,
+ },
+ }, {when});
- validate(t, res, 'departuresResponse', 'res')
- t.end()
-})
+ validate(t, res, 'departuresResponse', 'res');
+ t.end();
+});
tap.test('departures at Berlin Hbf in direction of Berlin Ostbahnhof', async (t) => {
await testDeparturesInDirection({
@@ -381,103 +387,103 @@ tap.test('departures at Berlin Hbf in direction of Berlin Ostbahnhof', async (t)
id: berlinHbf,
directionIds: [blnOstbahnhof, '8089185', '732676'],
when,
- validate
- })
- t.end()
-})
+ validate,
+ });
+ t.end();
+});
tap.test('arrivals at Berlin Schwedter Str.', async (t) => {
const res = await client.arrivals(blnSchwedterStr, {
duration: 5, when,
- })
+ });
await testArrivals({
test: t,
res,
validate,
- id: blnSchwedterStr
- })
- t.end()
-})
+ id: blnSchwedterStr,
+ });
+ t.end();
+});
tap.test('nearby Berlin Jungfernheide', async (t) => {
const nearby = await client.nearby({
type: 'location',
latitude: 52.530273,
- longitude: 13.299433
+ longitude: 13.299433,
}, {
- results: 2, distance: 400
- })
+ results: 2, distance: 400,
+ });
- validate(t, nearby, 'locations', 'nearby')
+ validate(t, nearby, 'locations', 'nearby');
- t.equal(nearby.length, 2)
+ t.equal(nearby.length, 2);
- const s0 = nearby[0]
- t.equal(s0.id, jungfernheide)
- t.equal(s0.name, 'Berlin Jungfernheide')
- t.ok(isRoughlyEqual(.0005, s0.location.latitude, 52.530408))
- t.ok(isRoughlyEqual(.0005, s0.location.longitude, 13.299424))
- t.ok(s0.distance >= 0)
- t.ok(s0.distance <= 100)
+ const s0 = nearby[0];
+ t.equal(s0.id, jungfernheide);
+ t.equal(s0.name, 'Berlin Jungfernheide');
+ t.ok(isRoughlyEqual(0.0005, s0.location.latitude, 52.530408));
+ t.ok(isRoughlyEqual(0.0005, s0.location.longitude, 13.299424));
+ t.ok(s0.distance >= 0);
+ t.ok(s0.distance <= 100);
- t.end()
-})
+ t.end();
+});
tap.test('locations named Jungfernheide', async (t) => {
const locations = await client.locations('Jungfernheide', {
- results: 10
- })
+ results: 10,
+ });
- validate(t, locations, 'locations', 'locations')
- t.ok(locations.length <= 10)
+ validate(t, locations, 'locations', 'locations');
+ t.ok(locations.length <= 10);
t.ok(locations.some((l) => {
- return l.station && l.station.id === jungfernheide || l.id === jungfernheide
- }), 'Jungfernheide not found')
+ return l.station && l.station.id === jungfernheide || l.id === jungfernheide;
+ }), 'Jungfernheide not found');
- t.end()
-})
+ t.end();
+});
tap.test('stop', async (t) => {
- const s = await client.stop(regensburgHbf)
+ const s = await client.stop(regensburgHbf);
- validate(t, s, ['stop', 'station'], 'stop')
- t.equal(s.id, regensburgHbf)
+ validate(t, s, ['stop', 'station'], 'stop');
+ t.equal(s.id, regensburgHbf);
- t.end()
-})
+ t.end();
+});
tap.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}
- })
- t.ok(departures.some(d => d.line && d.line.additionalName))
- t.end()
-})
+ products: {bus: false, suburban: false, tram: false},
+ });
+ t.ok(departures.some(d => d.line && d.line.additionalName));
+ t.end();
+});
tap.test('radar', async (t) => {
const res = await client.radar({
north: 52.52411,
west: 13.41002,
south: 52.51942,
- east: 13.41709
+ east: 13.41709,
}, {
- duration: 5 * 60, when
- })
+ duration: 5 * 60, when,
+ });
- validate(t, res, 'radarResult', 'res')
- t.end()
-})
+ validate(t, res, 'radarResult', 'res');
+ t.end();
+});
tap.test('reachableFrom', {timeout: 20 * 1000}, async (t) => {
const torfstr17 = {
type: 'location',
address: 'Torfstraße 17',
latitude: 52.5416823,
- longitude: 13.3491223
- }
+ longitude: 13.3491223,
+ };
await testReachableFrom({
test: t,
@@ -485,14 +491,14 @@ tap.test('reachableFrom', {timeout: 20 * 1000}, async (t) => {
address: torfstr17,
when,
maxDuration: 15,
- validate
- })
- t.end()
-})
+ validate,
+ });
+ t.end();
+});
tap.test('serverInfo works', async (t) => {
await testServerInfo({
test: t,
fetchServerInfo: client.serverInfo,
- })
-})
+ });
+});
diff --git a/test/e2e/insa.js b/test/e2e/insa.js
index 39e0b23a..367e8b4a 100644
--- a/test/e2e/insa.js
+++ b/test/e2e/insa.js
@@ -1,28 +1,28 @@
-import tap from 'tap'
-import isRoughlyEqual from 'is-roughly-equal'
+import tap from 'tap';
+import isRoughlyEqual from 'is-roughly-equal';
-import {createWhen} from './lib/util.js'
-import {createClient} from '../../index.js'
-import {profile as insaProfile} from '../../p/insa/index.js'
+import {createWhen} from './lib/util.js';
+import {createClient} from '../../index.js';
+import {profile as insaProfile} from '../../p/insa/index.js';
import {
createValidateMovement,
createValidateJourneyLeg,
-} from './lib/validators.js'
-import {createValidateFptfWith as createValidate} from './lib/validate-fptf-with.js'
-import {testJourneysStationToStation} from './lib/journeys-station-to-station.js'
-import {testJourneysStationToAddress} from './lib/journeys-station-to-address.js'
-import {testJourneysStationToPoi} from './lib/journeys-station-to-poi.js'
-import {testEarlierLaterJourneys} from './lib/earlier-later-journeys.js'
-import {journeysFailsWithNoProduct} from './lib/journeys-fails-with-no-product.js'
-import {testDepartures} from './lib/departures.js'
-import {testDeparturesInDirection} from './lib/departures-in-direction.js'
-import {testArrivals} from './lib/arrivals.js'
-import {testJourneysWithDetour} from './lib/journeys-with-detour.js'
+} from './lib/validators.js';
+import {createValidateFptfWith as createValidate} from './lib/validate-fptf-with.js';
+import {testJourneysStationToStation} from './lib/journeys-station-to-station.js';
+import {testJourneysStationToAddress} from './lib/journeys-station-to-address.js';
+import {testJourneysStationToPoi} from './lib/journeys-station-to-poi.js';
+import {testEarlierLaterJourneys} from './lib/earlier-later-journeys.js';
+import {journeysFailsWithNoProduct} from './lib/journeys-fails-with-no-product.js';
+import {testDepartures} from './lib/departures.js';
+import {testDeparturesInDirection} from './lib/departures-in-direction.js';
+import {testArrivals} from './lib/arrivals.js';
+import {testJourneysWithDetour} from './lib/journeys-with-detour.js';
-const isObj = o => o !== null && 'object' === typeof o && !Array.isArray(o)
+const isObj = o => o !== null && 'object' === typeof o && !Array.isArray(o);
-const T_MOCK = 1668495600 * 1000 // 2022-11-15T08:00:00+01:00
-const when = createWhen(insaProfile.timezone, insaProfile.locale, T_MOCK)
+const T_MOCK = 1668495600 * 1000; // 2022-11-15T08:00:00+01:00
+const when = createWhen(insaProfile.timezone, insaProfile.locale, T_MOCK);
const cfg = {
when,
@@ -31,48 +31,50 @@ const cfg = {
minLatitude: 50.7,
maxLatitude: 53.2,
minLongitude: 9, // considering e.g. IC 245
- maxLongitude: 13.4
-}
+ maxLongitude: 13.4,
+};
const withFakeDirection = (validate) => (val, item, name) => {
validate(val, {
...item,
- direction: item.direction === null ? 'foo' : item.direction,
- }, name)
-}
+ direction: item.direction === null
+ ? 'foo'
+ : item.direction,
+ }, name);
+};
const validators = {
movement: withFakeDirection(createValidateMovement(cfg)),
journeyLeg: withFakeDirection(createValidateJourneyLeg(cfg)),
-}
+};
-const validate = createValidate(cfg, validators)
+const validate = createValidate(cfg, validators);
-const client = createClient(insaProfile, 'public-transport/hafas-client:test')
+const client = createClient(insaProfile, 'public-transport/hafas-client:test');
-const magdeburgHbf = '8010224'
-const magdeburgBuckau = '8013456'
-const spielhagenstr = '7336'
-const hasselbachplatz = '90443'
-const stendal = '8010334'
-const dessau = '8010077'
-const universitaet = '19686'
+const magdeburgHbf = '8010224';
+const magdeburgBuckau = '8013456';
+const spielhagenstr = '7336';
+const hasselbachplatz = '90443';
+const stendal = '8010334';
+const dessau = '8010077';
+const universitaet = '19686';
tap.test('journeys – Magdeburg Hbf to Magdeburg-Buckau', async (t) => {
const res = await client.journeys(magdeburgHbf, magdeburgBuckau, {
results: 4,
departure: when,
- stopovers: true
- })
+ stopovers: true,
+ });
await testJourneysStationToStation({
test: t,
res,
validate,
fromId: magdeburgHbf,
- toId: magdeburgBuckau
- })
- t.end()
-})
+ toId: magdeburgBuckau,
+ });
+ t.end();
+});
// todo: journeys, only one product
@@ -84,32 +86,32 @@ tap.test('journeys – fails with no product', async (t) => {
toId: magdeburgBuckau,
when,
products: insaProfile.products,
- })
- t.end()
-})
+ });
+ t.end();
+});
tap.test('Magdeburg Hbf to 39104 Magdeburg, Sternstr. 10', async (t) => {
const sternStr = {
type: 'location',
address: 'Magdeburg - Altenstadt, Sternstraße 10',
latitude: 52.118414,
- longitude: 11.422332
- }
+ longitude: 11.422332,
+ };
const res = await client.journeys(magdeburgHbf, sternStr, {
results: 3,
- departure: when
- })
+ departure: when,
+ });
await testJourneysStationToAddress({
test: t,
res,
validate,
fromId: magdeburgHbf,
- to: sternStr
- })
- t.end()
-})
+ to: sternStr,
+ });
+ t.end();
+});
tap.test('Magdeburg Hbf to Kloster Unser Lieben Frauen', async (t) => {
const kloster = {
@@ -118,22 +120,22 @@ tap.test('Magdeburg Hbf to Kloster Unser Lieben Frauen', async (t) => {
poi: true,
name: 'Magdeburg, Kloster Unser Lieben Frauen (Denkmal)',
latitude: 52.127601,
- longitude: 11.636437
- }
+ longitude: 11.636437,
+ };
const res = await client.journeys(magdeburgHbf, kloster, {
results: 3,
- departure: when
- })
+ departure: when,
+ });
await testJourneysStationToPoi({
test: t,
res,
validate,
fromId: magdeburgHbf,
- to: kloster
- })
- t.end()
-})
+ to: kloster,
+ });
+ t.end();
+});
tap.test('journeys: via works – with detour', async (t) => {
// Going from Magdeburg, Hasselbachplatz (Sternstr.) (Tram/Bus) to Stendal
@@ -143,17 +145,17 @@ tap.test('journeys: via works – with detour', async (t) => {
via: dessau,
results: 1,
departure: when,
- stopovers: true
- })
+ stopovers: true,
+ });
await testJourneysWithDetour({
test: t,
res,
validate,
- detourIds: [dessau]
- })
- t.end()
-})
+ detourIds: [dessau],
+ });
+ t.end();
+});
// todo: without detour
@@ -164,40 +166,40 @@ tap.test('earlier/later journeys', async (t) => {
validate,
fromId: magdeburgHbf,
toId: magdeburgBuckau,
- when
- })
+ when,
+ });
- t.end()
-})
+ t.end();
+});
tap.test('trip details', async (t) => {
const res = await client.journeys(magdeburgHbf, magdeburgBuckau, {
- results: 1, departure: when
- })
+ results: 1, departure: when,
+ });
- const p = res.journeys[0].legs.find(l => !l.walking)
- t.ok(p.tripId, 'precondition failed')
- t.ok(p.line.name, 'precondition failed')
+ const p = res.journeys[0].legs.find(l => !l.walking);
+ t.ok(p.tripId, 'precondition failed');
+ t.ok(p.line.name, 'precondition failed');
- const tripRes = await client.trip(p.tripId, {when})
+ const tripRes = await client.trip(p.tripId, {when});
- validate(t, tripRes, 'tripResult', 'res')
- t.end()
-})
+ validate(t, tripRes, 'tripResult', 'res');
+ t.end();
+});
tap.test('departures at Magdeburg Universität', async (t) => {
const res = await client.departures(universitaet, {
duration: 30, when,
- })
+ });
await testDepartures({
test: t,
res,
validate,
- id: universitaet
- })
- t.end()
-})
+ id: universitaet,
+ });
+ t.end();
+});
tap.test('departures with station object', async (t) => {
const res = await client.departures({
@@ -207,15 +209,15 @@ tap.test('departures with station object', async (t) => {
location: {
type: 'location',
latitude: 1.23,
- longitude: 2.34
- }
+ longitude: 2.34,
+ },
}, {
duration: 30, when,
- })
+ });
- validate(t, res, 'departuresResponse', 'res')
- t.end()
-})
+ validate(t, res, 'departuresResponse', 'res');
+ t.end();
+});
// todo: deps empty, wrong loc ID?
tap.test('departures at Universität in direction of Spielhagenstr.', async (t) => {
@@ -226,69 +228,69 @@ tap.test('departures at Universität in direction of Spielhagenstr.', async (t)
id: universitaet,
directionIds: [spielhagenstr],
when,
- validate
- })
- t.end()
-})
+ validate,
+ });
+ t.end();
+});
tap.test('arrivals at Magdeburg Universität', async (t) => {
const res = await client.arrivals(universitaet, {
- duration: 30, when
- })
+ duration: 30, when,
+ });
await testArrivals({
test: t,
res,
validate,
- id: universitaet
- })
- t.end()
-})
+ id: universitaet,
+ });
+ t.end();
+});
// todo: nearby
tap.test('locations named Magdeburg', async (t) => {
- const nordpark = '7480'
+ const nordpark = '7480';
const locations = await client.locations('nordpark', {
- results: 20
- })
+ results: 20,
+ });
- validate(t, locations, 'locations', 'locations')
- t.ok(locations.length <= 20)
+ validate(t, locations, 'locations', 'locations');
+ t.ok(locations.length <= 20);
- t.ok(locations.find(s => s.type === 'stop' || s.type === 'station'))
- t.ok(locations.find(s => s.poi)) // POIs
+ t.ok(locations.find(s => s.type === 'stop' || s.type === 'station'));
+ t.ok(locations.find(s => s.poi)); // POIs
t.ok(locations.some((l) => {
- return l.station && l.station.id === nordpark || l.id === nordpark
- }))
+ return l.station && l.station.id === nordpark || l.id === nordpark;
+ }));
- t.end()
-})
+ t.end();
+});
tap.test('station Magdeburg-Buckau', async (t) => {
- const s = await client.stop(magdeburgBuckau)
+ const s = await client.stop(magdeburgBuckau);
- validate(t, s, ['stop', 'station'], 'station')
- t.equal(s.id, magdeburgBuckau)
+ validate(t, s, ['stop', 'station'], 'station');
+ t.equal(s.id, magdeburgBuckau);
- t.end()
-})
+ t.end();
+});
tap.test('radar', async (t) => {
const res = await client.radar({
north: 52.148364,
west: 11.600826,
south: 52.108486,
- east: 11.651451
+ east: 11.651451,
}, {
- duration: 5 * 60, when, results: 10
- })
+ duration: 5 * 60, when, results: 10,
+ });
const customCfg = Object.assign({}, cfg, {
stationCoordsOptional: true, // see #28
- })
- const validate = createValidate(customCfg, validators)
- validate(t, res, 'radarResult', 'res')
+ });
+ const validate = createValidate(customCfg, validators);
+ validate(t, res, 'radarResult', 'res');
- t.end()
-})
+ t.end();
+});
diff --git a/test/e2e/invg.js b/test/e2e/invg.js
index 56c44a37..e5e34ab8 100644
--- a/test/e2e/invg.js
+++ b/test/e2e/invg.js
@@ -1,80 +1,80 @@
-import tap from 'tap'
-import isRoughlyEqual from 'is-roughly-equal'
+import tap from 'tap';
+import isRoughlyEqual from 'is-roughly-equal';
-import {createWhen} from './lib/util.js'
-import {createClient} from '../../index.js'
-import {profile as invgProfile} from '../../p/invg/index.js'
+import {createWhen} from './lib/util.js';
+import {createClient} from '../../index.js';
+import {profile as invgProfile} from '../../p/invg/index.js';
import {
createValidateJourneyLeg,
createValidateMovement,
-} from './lib/validators.js'
-import {createValidateFptfWith as createValidate} from './lib/validate-fptf-with.js'
-import {testJourneysStationToStation} from './lib/journeys-station-to-station.js'
-import {testJourneysStationToAddress} from './lib/journeys-station-to-address.js'
-import {testJourneysStationToPoi} from './lib/journeys-station-to-poi.js'
-import {testEarlierLaterJourneys} from './lib/earlier-later-journeys.js'
-import {testRefreshJourney} from './lib/refresh-journey.js'
-import {journeysFailsWithNoProduct} from './lib/journeys-fails-with-no-product.js'
-import {testDepartures} from './lib/departures.js'
-import {testArrivals} from './lib/arrivals.js'
+} from './lib/validators.js';
+import {createValidateFptfWith as createValidate} from './lib/validate-fptf-with.js';
+import {testJourneysStationToStation} from './lib/journeys-station-to-station.js';
+import {testJourneysStationToAddress} from './lib/journeys-station-to-address.js';
+import {testJourneysStationToPoi} from './lib/journeys-station-to-poi.js';
+import {testEarlierLaterJourneys} from './lib/earlier-later-journeys.js';
+import {testRefreshJourney} from './lib/refresh-journey.js';
+import {journeysFailsWithNoProduct} from './lib/journeys-fails-with-no-product.js';
+import {testDepartures} from './lib/departures.js';
+import {testArrivals} from './lib/arrivals.js';
-const T_MOCK = 1668495600 * 1000 // 2022-11-15T08:00:00+01:00
-const when = createWhen(invgProfile.timezone, invgProfile.locale, T_MOCK)
+const T_MOCK = 1668495600 * 1000; // 2022-11-15T08:00:00+01:00
+const when = createWhen(invgProfile.timezone, invgProfile.locale, T_MOCK);
const cfg = {
when,
products: invgProfile.products,
-}
+};
-const _validateJourneyLeg = createValidateJourneyLeg(cfg)
+const _validateJourneyLeg = createValidateJourneyLeg(cfg);
const validateJourneyLeg = (val, leg, name = 'journeyLeg') => {
_validateJourneyLeg(val, {
...leg,
direction: leg.direction || 'foo',
- }, name)
-}
+ }, name);
+};
-const _validateMovement = createValidateMovement(cfg)
+const _validateMovement = createValidateMovement(cfg);
const validateMovement = (val, m, name = 'movement') => {
_validateMovement(val, {
...m,
direction: m.direction || 'foo',
- }, name)
-}
+ }, name);
+};
const validate = createValidate(cfg, {
journeyLeg: validateJourneyLeg,
- movement: validateMovement
-})
+ movement: validateMovement,
+});
-const client = createClient(invgProfile, 'public-transport/hafas-client:test')
+const client = createClient(invgProfile, 'public-transport/hafas-client:test');
-const ingolstadtHbf = '8000183'
-const telemannstr = '71802'
+const ingolstadtHbf = '8000183';
+const telemannstr = '71802';
const uhlandstr1 = {
type: 'location',
address: 'Ingolstadt, Uhlandstraße 1',
latitude: 48.775236,
- longitude: 11.441138
-}
+ longitude: 11.441138,
+};
tap.test('journeys – Ingolstadt Hbf to Audi Parkplatz', async (t) => {
- const telemannstr = '71801'
+ const telemannstr = '71801';
const res = await client.journeys(ingolstadtHbf, telemannstr, {
results: 4,
departure: when,
- stopovers: true
- })
+ stopovers: true,
+ });
await testJourneysStationToStation({
test: t,
res,
validate,
fromId: ingolstadtHbf,
- toId: telemannstr
- })
- t.end()
-})
+ toId: telemannstr,
+ });
+ t.end();
+});
// todo: journeys, only one product
@@ -86,25 +86,25 @@ tap.test('journeys – fails with no product', async (t) => {
toId: telemannstr,
when,
products: invgProfile.products,
- })
- t.end()
-})
+ });
+ t.end();
+});
tap.test('Ingolstadt Hbf to Uhlandstr. 1', async (t) => {
const res = await client.journeys(ingolstadtHbf, uhlandstr1, {
results: 3,
- departure: when
- })
+ departure: when,
+ });
await testJourneysStationToAddress({
test: t,
res,
validate,
fromId: ingolstadtHbf,
- to: uhlandstr1
- })
- t.end()
-})
+ to: uhlandstr1,
+ });
+ t.end();
+});
tap.test('Ingolstadt Hbf to Städtisches Freibad', async (t) => {
const freibad = {
@@ -113,22 +113,22 @@ tap.test('Ingolstadt Hbf to Städtisches Freibad', async (t) => {
poi: true,
name: 'Ingolstadt, Städtisches Freibad (Sport)',
latitude: 48.761473,
- longitude: 11.418602
- }
+ longitude: 11.418602,
+ };
const res = await client.journeys(ingolstadtHbf, freibad, {
results: 3,
- departure: when
- })
+ departure: when,
+ });
await testJourneysStationToPoi({
test: t,
res,
validate,
fromId: ingolstadtHbf,
- to: freibad
- })
- t.end()
-})
+ to: freibad,
+ });
+ t.end();
+});
// todo: via works – with detour
// todo: without detour
@@ -141,10 +141,10 @@ tap.test('earlier/later journeys', async (t) => {
fromId: ingolstadtHbf,
toId: telemannstr,
when,
- })
+ });
- t.end()
-})
+ t.end();
+});
tap.test('refreshJourney', async (t) => {
await testRefreshJourney({
@@ -154,25 +154,25 @@ tap.test('refreshJourney', async (t) => {
validate,
fromId: ingolstadtHbf,
toId: telemannstr,
- when
- })
- t.end()
-})
+ when,
+ });
+ t.end();
+});
tap.test('trip details', async (t) => {
const {journeys} = await client.journeys(ingolstadtHbf, telemannstr, {
- results: 1, departure: when
- })
+ results: 1, departure: when,
+ });
- const p = journeys[0].legs.find(l => !l.walking)
- t.ok(p.tripId, 'precondition failed')
- t.ok(p.line.name, 'precondition failed')
+ const p = journeys[0].legs.find(l => !l.walking);
+ t.ok(p.tripId, 'precondition failed');
+ t.ok(p.line.name, 'precondition failed');
- const tripRes = await client.trip(p.tripId, {when})
+ const tripRes = await client.trip(p.tripId, {when});
- validate(t, tripRes, 'tripResult', 'res')
- t.end()
-})
+ validate(t, tripRes, 'tripResult', 'res');
+ t.end();
+});
tap.test('departures at Ingolstadt Hbf', async (t) => {
const ids = [
@@ -180,20 +180,20 @@ tap.test('departures at Ingolstadt Hbf', async (t) => {
'80301', // stop "Ingolstadt, Hauptbahnhof Stadtauswärts"
'80302', // stop "Ingolstadt, Hauptbahnhof Stadteinwärts"
'80303', // stop "Ingolstadt, Hauptbahnhof Stadtauswärts"
- ]
+ ];
const res = await client.departures(ingolstadtHbf, {
- duration: 10, when
- })
+ duration: 10, when,
+ });
await testDepartures({
test: t,
res,
validate,
ids,
- })
- t.end()
-})
+ });
+ t.end();
+});
tap.test('departures with station object', async (t) => {
const res = await client.departures({
@@ -203,33 +203,33 @@ tap.test('departures with station object', async (t) => {
location: {
type: 'location',
latitude: 48.822834,
- longitude: 11.461148
- }
- }, {when})
+ longitude: 11.461148,
+ },
+ }, {when});
- validate(t, res, 'departuresResponse', 'res')
- t.end()
-})
+ validate(t, res, 'departuresResponse', 'res');
+ t.end();
+});
tap.test('arrivals at Ingolstadt Hbf', async (t) => {
const ids = [
ingolstadtHbf, // station
'80301', // stop "Ingolstadt, Hauptbahnhof Stadtauswärts"
- '80302' // stop "Ingolstadt, Hauptbahnhof Stadteinwärts"
- ]
+ '80302', // stop "Ingolstadt, Hauptbahnhof Stadteinwärts"
+ ];
const res = await client.arrivals(ingolstadtHbf, {
- duration: 10, when
- })
+ duration: 10, when,
+ });
await testArrivals({
test: t,
res,
validate,
ids,
- })
- t.end()
-})
+ });
+ t.end();
+});
tap.test('nearby', async (t) => {
const nearby = await client.nearby({
@@ -237,57 +237,57 @@ tap.test('nearby', async (t) => {
id: '990001921',
address: 'Ingolstadt, Rathausplatz 1',
latitude: 48.76292,
- longitude: 11.424624
- }, {distance: 500})
+ longitude: 11.424624,
+ }, {distance: 500});
- validate(t, nearby, 'locations', 'nearby')
+ validate(t, nearby, 'locations', 'nearby');
- const rathausplatz = '60706'
- const harderstr = '28402'
- t.ok(nearby.find(l => l.id === rathausplatz))
- t.ok(nearby.find(l => l.id === harderstr))
+ const rathausplatz = '60706';
+ const harderstr = '28402';
+ t.ok(nearby.find(l => l.id === rathausplatz));
+ t.ok(nearby.find(l => l.id === harderstr));
- t.end()
-})
+ t.end();
+});
tap.test('locations named "freibad"', async (t) => {
- const freibadIngolstadt = '980000591'
+ const freibadIngolstadt = '980000591';
const locations = await client.locations('freibad', {
- results: 5
- })
+ results: 5,
+ });
- validate(t, locations, 'locations', 'locations')
- t.ok(locations.length <= 10)
+ validate(t, locations, 'locations', 'locations');
+ t.ok(locations.length <= 10);
- t.ok(locations.find(s => s.type === 'stop' || s.type === 'station'))
- t.ok(locations.find(s => s.id && s.name)) // POIs
+ t.ok(locations.find(s => s.type === 'stop' || s.type === 'station'));
+ t.ok(locations.find(s => s.id && s.name)); // POIs
t.ok(locations.some((l) => {
- return l.station && l.station.id === freibadIngolstadt || l.id === freibadIngolstadt
- }))
+ return l.station && l.station.id === freibadIngolstadt || l.id === freibadIngolstadt;
+ }));
- t.end()
-})
+ t.end();
+});
tap.test('stop Ettinger Str.', async (t) => {
- const ettingerStr = '18304'
- const s = await client.stop(ettingerStr)
+ const ettingerStr = '18304';
+ const s = await client.stop(ettingerStr);
- validate(t, s, ['stop', 'station'], 'stop')
- t.equal(s.id, ettingerStr)
+ validate(t, s, ['stop', 'station'], 'stop');
+ t.equal(s.id, ettingerStr);
- t.end()
-})
+ t.end();
+});
tap.test('radar', async (t) => {
const res = await client.radar({
north: 48.74453,
west: 11.42733,
south: 48.73453,
- east: 11.43733
+ east: 11.43733,
}, {
- duration: 5 * 60, when, results: 10
- })
+ duration: 5 * 60, when, results: 10,
+ });
- validate(t, res, 'radarResult', 'res')
- t.end()
-})
+ validate(t, res, 'radarResult', 'res');
+ t.end();
+});
diff --git a/test/e2e/ivb.js b/test/e2e/ivb.js
index 6eef9ffd..5244d234 100644
--- a/test/e2e/ivb.js
+++ b/test/e2e/ivb.js
@@ -1,12 +1,12 @@
-import tap from 'tap'
+import tap from 'tap';
-import {createWhen} from './lib/util.js'
-import {createClient} from '../../index.js'
-import {profile as ivbProfile} from '../../p/ivb/index.js'
-import {createValidateFptfWith as createValidate} from './lib/validate-fptf-with.js'
+import {createWhen} from './lib/util.js';
+import {createClient} from '../../index.js';
+import {profile as ivbProfile} from '../../p/ivb/index.js';
+import {createValidateFptfWith as createValidate} from './lib/validate-fptf-with.js';
-const T_MOCK = 1671260400 * 1000 // 2022-12-17T08:00:00+01:00
-const when = createWhen(ivbProfile.timezone, ivbProfile.locale, T_MOCK)
+const T_MOCK = 1671260400 * 1000; // 2022-12-17T08:00:00+01:00
+const when = createWhen(ivbProfile.timezone, ivbProfile.locale, T_MOCK);
const cfg = {
when,
@@ -16,20 +16,20 @@ const cfg = {
maxLongitude: 17.0892,
minLatitude: 45.7206,
minLongitude: 7.8635,
-}
-const validate = createValidate(cfg)
+};
+const validate = createValidate(cfg);
-const client = createClient(ivbProfile, 'public-transport/hafas-client:test')
+const client = createClient(ivbProfile, 'public-transport/hafas-client:test');
-const innsbruckGriesauweg = '476162400'
+const innsbruckGriesauweg = '476162400';
tap.test('locations named "griesauweg"', async (t) => {
- const locations = await client.locations('griesauweg')
+ const locations = await client.locations('griesauweg');
- validate(t, locations, 'locations', 'locations')
+ validate(t, locations, 'locations', 'locations');
t.ok(locations.some((l) => {
- return l.station && l.station.id === innsbruckGriesauweg || l.id === innsbruckGriesauweg
- }), 'Innsbruck Griesauweg not found')
+ return l.station && l.station.id === innsbruckGriesauweg || l.id === innsbruckGriesauweg;
+ }), 'Innsbruck Griesauweg not found');
- t.end()
-})
+ t.end();
+});
diff --git a/test/e2e/kvb.js b/test/e2e/kvb.js
index 00efd86b..eb09c654 100644
--- a/test/e2e/kvb.js
+++ b/test/e2e/kvb.js
@@ -1,12 +1,12 @@
-import tap from 'tap'
+import tap from 'tap';
-import {createWhen} from './lib/util.js'
-import {createClient} from '../../index.js'
-import {profile as kvbProfile} from '../../p/kvb/index.js'
-import {createValidateFptfWith as createValidate} from './lib/validate-fptf-with.js'
+import {createWhen} from './lib/util.js';
+import {createClient} from '../../index.js';
+import {profile as kvbProfile} from '../../p/kvb/index.js';
+import {createValidateFptfWith as createValidate} from './lib/validate-fptf-with.js';
-const T_MOCK = 1671260400 * 1000 // 2022-12-17T08:00:00+01:00
-const when = createWhen(kvbProfile.timezone, kvbProfile.locale, T_MOCK)
+const T_MOCK = 1671260400 * 1000; // 2022-12-17T08:00:00+01:00
+const when = createWhen(kvbProfile.timezone, kvbProfile.locale, T_MOCK);
const cfg = {
when,
@@ -16,20 +16,20 @@ const cfg = {
maxLongitude: 7.8333,
minLatitude: 50.3253,
minLongitude: 6.2320,
-}
-const validate = createValidate(cfg)
+};
+const validate = createValidate(cfg);
-const client = createClient(kvbProfile, 'public-transport/hafas-client:test')
+const client = createClient(kvbProfile, 'public-transport/hafas-client:test');
-const heumarkt = '900000001'
+const heumarkt = '900000001';
tap.test('locations named "heumarkt"', async (t) => {
- const locations = await client.locations('heumarkt')
+ const locations = await client.locations('heumarkt');
- validate(t, locations, 'locations', 'locations')
+ validate(t, locations, 'locations', 'locations');
t.ok(locations.some((l) => {
- return l.station && l.station.id === heumarkt || l.id === heumarkt
- }), 'Heumarkt not found')
+ return l.station && l.station.id === heumarkt || l.id === heumarkt;
+ }), 'Heumarkt not found');
- t.end()
-})
+ t.end();
+});
diff --git a/test/e2e/lib/arrivals.js b/test/e2e/lib/arrivals.js
index 1a88644a..11ef3f35 100644
--- a/test/e2e/lib/arrivals.js
+++ b/test/e2e/lib/arrivals.js
@@ -1,29 +1,31 @@
const testArrivals = async (cfg) => {
- const {test: t, res, validate} = cfg
- const ids = cfg.ids || (cfg.id ? [cfg.id] : [])
- const {arrivals: arrs} = res
+ const {test: t, res, validate} = cfg;
+ const ids = cfg.ids || (cfg.id
+ ? [cfg.id]
+ : []);
+ const {arrivals: arrs} = res;
- validate(t, res, 'arrivalsResponse', 'res')
+ validate(t, res, 'arrivalsResponse', 'res');
for (let i = 0; i < arrs.length; i++) {
- let stop = arrs[i].stop
- let name = `res.arrivals[${i}].stop`
+ let stop = arrs[i].stop;
+ let name = `res.arrivals[${i}].stop`;
if (stop.station) {
- stop = stop.station
- name += '.station'
+ stop = stop.station;
+ name += '.station';
}
t.ok(
- ids.includes(stop.id) ||
- (stop.station && ids.includes(stop.station.id)),
+ ids.includes(stop.id)
+ || stop.station && ids.includes(stop.station.id),
name + '.id is invalid',
- )
+ );
}
// todo: move into arrivals validator
- t.same(arrs, arrs.sort((a, b) => t.when > b.when), 'res.arrivals must be sorted by .when')
-}
+ t.same(arrs, arrs.sort((a, b) => t.when > b.when), 'res.arrivals must be sorted by .when');
+};
export {
testArrivals,
-}
+};
diff --git a/test/e2e/lib/departures-in-direction.js b/test/e2e/lib/departures-in-direction.js
index 9c94f0e2..7172890d 100644
--- a/test/e2e/lib/departures-in-direction.js
+++ b/test/e2e/lib/departures-in-direction.js
@@ -6,32 +6,31 @@ const testDeparturesInDirection = async (cfg) => {
id,
directionIds,
when,
- validate
- } = cfg
+ validate,
+ } = cfg;
const res = await fetchDepartures(id, {
direction: directionIds[0],
- when
- })
- const {departures: deps} = res
+ when,
+ });
+ const {departures: deps} = res;
- validate(t, res, 'departuresResponse', 'res')
+ validate(t, res, 'departuresResponse', 'res');
for (let i = 0; i < deps.length; i++) {
- const dep = deps[i]
- const name = `deps[${i}]`
+ const dep = deps[i];
+ const name = `deps[${i}]`;
- const line = dep.line && dep.line.name
+ const line = dep.line && dep.line.name;
const {trip} = await fetchTrip(dep.tripId, line, {
- when, stopovers: true
- })
- t.ok(trip.stopovers.some(st => (
- st.stop.station && directionIds.includes(st.stop.station.id) ||
- directionIds.includes(st.stop.id)
- )), `trip ${dep.tripId} of ${name} has no stopover at ${directionIds.join('/')}`)
+ when, stopovers: true,
+ });
+ t.ok(trip.stopovers.some(st => st.stop.station && directionIds.includes(st.stop.station.id)
+ || directionIds.includes(st.stop.id),
+ ), `trip ${dep.tripId} of ${name} has no stopover at ${directionIds.join('/')}`);
}
-}
+};
export {
testDeparturesInDirection,
-}
+};
diff --git a/test/e2e/lib/departures.js b/test/e2e/lib/departures.js
index ea0ea176..1fd44a2f 100644
--- a/test/e2e/lib/departures.js
+++ b/test/e2e/lib/departures.js
@@ -1,29 +1,31 @@
const testDepartures = async (cfg) => {
- const {test: t, res, validate} = cfg
- const ids = cfg.ids || (cfg.id ? [cfg.id] : [])
- const {departures: deps} = res
+ const {test: t, res, validate} = cfg;
+ const ids = cfg.ids || (cfg.id
+ ? [cfg.id]
+ : []);
+ const {departures: deps} = res;
- validate(t, res, 'departuresResponse', 'res')
+ validate(t, res, 'departuresResponse', 'res');
for (let i = 0; i < deps.length; i++) {
- let stop = deps[i].stop
- let name = `res.departures[${i}].stop`
+ let stop = deps[i].stop;
+ let name = `res.departures[${i}].stop`;
if (stop.station) {
- stop = stop.station
- name += '.station'
+ stop = stop.station;
+ name += '.station';
}
t.ok(
- ids.includes(stop.id) ||
- (stop.station && ids.includes(stop.station.id)),
+ ids.includes(stop.id)
+ || stop.station && ids.includes(stop.station.id),
`${name}.id is invalid (${stop.id}), must be one of ${ids.join('/')}`,
- )
+ );
}
// todo: move into deps validator
- t.same(deps, deps.sort((a, b) => t.when > b.when), 'res.departures must be sorted by .when')
-}
+ t.same(deps, deps.sort((a, b) => t.when > b.when), 'res.departures must be sorted by .when');
+};
export {
testDepartures,
-}
+};
diff --git a/test/e2e/lib/earlier-later-journeys.js b/test/e2e/lib/earlier-later-journeys.js
index 1d7b1ccb..00f4fe90 100644
--- a/test/e2e/lib/earlier-later-journeys.js
+++ b/test/e2e/lib/earlier-later-journeys.js
@@ -4,73 +4,78 @@ const testEarlierLaterJourneys = async (cfg) => {
fetchJourneys,
fromId,
toId,
- when
+ when,
// todo: validate
- } = cfg
+ } = cfg;
const model = await fetchJourneys(fromId, toId, {
- results: 3, departure: when
- })
+ results: 3, departure: when,
+ });
// todo: move to journeys validator?
- t.equal(typeof model.earlierRef, 'string')
- t.ok(model.earlierRef)
- t.equal(typeof model.laterRef, 'string')
- t.ok(model.laterRef)
+ t.equal(typeof model.earlierRef, 'string');
+ t.ok(model.earlierRef);
+ t.equal(typeof model.laterRef, 'string');
+ t.ok(model.laterRef);
// departure/arrival and earlierThan/laterThan should be mutually exclusive
await t.rejects(async () => {
await fetchJourneys(fromId, toId, {
- departure: when, earlierThan: model.earlierRef
- })
- })
+ departure: when, earlierThan: model.earlierRef,
+ });
+ });
await t.rejects(async () => {
await fetchJourneys(fromId, toId, {
- departure: when, laterThan: model.laterRef
- })
- })
+ departure: when, laterThan: model.laterRef,
+ });
+ });
await t.rejects(async () => {
await fetchJourneys(fromId, toId, {
- arrival: when, earlierThan: model.earlierRef
- })
- })
+ arrival: when, earlierThan: model.earlierRef,
+ });
+ });
await t.rejects(async () => {
await fetchJourneys(fromId, toId, {
- arrival: when, laterThan: model.laterRef
- })
- })
+ arrival: when, laterThan: model.laterRef,
+ });
+ });
- let earliestDep = Infinity, latestDep = -Infinity
+ let earliestDep = Infinity, latestDep = -Infinity;
for (let j of model.journeys) {
- if (j.legs[0].departure === null) continue
- const dep = Date.parse(j.legs[0].departure)
- if (dep < earliestDep) earliestDep = dep
- else if (dep > latestDep) latestDep = dep
+ if (j.legs[0].departure === null) {
+ continue;
+ }
+ const dep = Date.parse(j.legs[0].departure);
+ if (dep < earliestDep) {
+ earliestDep = dep;
+ } else if (dep > latestDep) {
+ latestDep = dep;
+ }
}
const earlier = await fetchJourneys(fromId, toId, {
results: 3,
// todo: single journey ref?
- earlierThan: model.earlierRef
- })
+ earlierThan: model.earlierRef,
+ });
for (let j of earlier.journeys) {
- const firstLeg = j.legs[0]
- const dep = Date.parse(firstLeg.departure || firstLeg.plannedDeparture)
- t.ok(dep < earliestDep)
+ const firstLeg = j.legs[0];
+ const dep = Date.parse(firstLeg.departure || firstLeg.plannedDeparture);
+ t.ok(dep < earliestDep);
}
const later = await fetchJourneys(fromId, toId, {
results: 3,
// todo: single journey ref?
- laterThan: model.laterRef
- })
+ laterThan: model.laterRef,
+ });
for (let j of later.journeys) {
- const firstLeg = j.legs[0]
- const dep = Date.parse(firstLeg.departure || firstLeg.plannedDeparture)
- t.ok(dep > latestDep)
+ const firstLeg = j.legs[0];
+ const dep = Date.parse(firstLeg.departure || firstLeg.plannedDeparture);
+ t.ok(dep > latestDep);
}
-}
+};
export {
testEarlierLaterJourneys,
-}
+};
diff --git a/test/e2e/lib/journeys-fails-with-no-product.js b/test/e2e/lib/journeys-fails-with-no-product.js
index 982f5635..4adc8061 100644
--- a/test/e2e/lib/journeys-fails-with-no-product.js
+++ b/test/e2e/lib/journeys-fails-with-no-product.js
@@ -5,17 +5,19 @@ const journeysFailsWithNoProduct = async (cfg) => {
fromId,
toId,
when,
- products
- } = cfg
+ products,
+ } = cfg;
- const noProducts = Object.create(null)
- for (let p of products) noProducts[p.id] = false
+ const noProducts = Object.create(null);
+ for (let p of products) {
+ noProducts[p.id] = false;
+ }
await t.rejects(async () => {
- await fetchJourneys(fromId, toId, {departure: when, products: noProducts})
- })
-}
+ await fetchJourneys(fromId, toId, {departure: when, products: noProducts});
+ });
+};
export {
journeysFailsWithNoProduct,
-}
+};
diff --git a/test/e2e/lib/journeys-station-to-address.js b/test/e2e/lib/journeys-station-to-address.js
index 2a7e2b1f..b583f6b2 100644
--- a/test/e2e/lib/journeys-station-to-address.js
+++ b/test/e2e/lib/journeys-station-to-address.js
@@ -1,30 +1,30 @@
-import isRoughlyEqual from 'is-roughly-equal'
+import isRoughlyEqual from 'is-roughly-equal';
const testJourneysStationToAddress = async (cfg) => {
- const {test: t, res, validate, fromId} = cfg
- const {address, latitude, longitude} = cfg.to
+ const {test: t, res, validate, fromId} = cfg;
+ const {address, latitude, longitude} = cfg.to;
- validate(t, res, 'journeysResult', 'res')
- const {journeys} = res
+ validate(t, res, 'journeysResult', 'res');
+ const {journeys} = res;
- t.ok(journeys.length >= 3, 'journeys must have >=3 items')
+ t.ok(journeys.length >= 3, 'journeys must have >=3 items');
for (let i = 0; i < journeys.length; i++) {
- const j = journeys[i]
+ const j = journeys[i];
- const firstLeg = j.legs[0]
- const orig = firstLeg.origin.station || firstLeg.origin
- t.ok(orig.id, fromId)
+ const firstLeg = j.legs[0];
+ const orig = firstLeg.origin.station || firstLeg.origin;
+ t.ok(orig.id, fromId);
- const d = j.legs[j.legs.length - 1].destination
- const n = `res.journeys[0].legs[${i}].destination`
+ const d = j.legs[j.legs.length - 1].destination;
+ const n = `res.journeys[0].legs[${i}].destination`;
- t.equal(d.type, 'location', n + '.type is invalid')
- t.equal(d.address, address, n + '.address is invalid')
- t.ok(isRoughlyEqual(.0001, d.latitude, latitude), n + '.latitude is invalid')
- t.ok(isRoughlyEqual(.0001, d.longitude, longitude), n + '.longitude is invalid')
+ t.equal(d.type, 'location', n + '.type is invalid');
+ t.equal(d.address, address, n + '.address is invalid');
+ t.ok(isRoughlyEqual(0.0001, d.latitude, latitude), n + '.latitude is invalid');
+ t.ok(isRoughlyEqual(0.0001, d.longitude, longitude), n + '.longitude is invalid');
}
-}
+};
export {
testJourneysStationToAddress,
-}
+};
diff --git a/test/e2e/lib/journeys-station-to-poi.js b/test/e2e/lib/journeys-station-to-poi.js
index a9641216..5625b492 100644
--- a/test/e2e/lib/journeys-station-to-poi.js
+++ b/test/e2e/lib/journeys-station-to-poi.js
@@ -1,40 +1,42 @@
-import isRoughlyEqual from 'is-roughly-equal'
+import isRoughlyEqual from 'is-roughly-equal';
const testJourneysStationToPoi = async (cfg) => {
- const {test: t, res, validate} = cfg
- const fromIds = cfg.fromIds || (cfg.fromId ? [cfg.fromId] : [])
- const {id, name, latitude, longitude} = cfg.to
+ const {test: t, res, validate} = cfg;
+ const fromIds = cfg.fromIds || (cfg.fromId
+ ? [cfg.fromId]
+ : []);
+ const {id, name, latitude, longitude} = cfg.to;
- validate(t, res, 'journeysResult', 'res')
- const {journeys} = res
+ validate(t, res, 'journeysResult', 'res');
+ const {journeys} = res;
- t.ok(journeys.length >= 3, 'journeys must have >=3 items')
+ t.ok(journeys.length >= 3, 'journeys must have >=3 items');
for (let i = 0; i < journeys.length; i++) {
- const j = journeys[i]
+ const j = journeys[i];
- let o = j.legs[0].origin
- const oN = `res.journeys[0].legs[0].destination`
+ let o = j.legs[0].origin;
+ const oN = 'res.journeys[0].legs[0].destination';
t.ok(
- fromIds.includes(o.id) ||
- (o.station && fromIds.includes(o.station.id)),
- `invalid ${oN}.legs[0].origin`
- )
+ fromIds.includes(o.id)
+ || o.station && fromIds.includes(o.station.id),
+ `invalid ${oN}.legs[0].origin`,
+ );
- let d = j.legs[j.legs.length - 1].destination
- let dN = `res.journeys[${i}].legs[${j.legs.length - 1}].destination`
+ let d = j.legs[j.legs.length - 1].destination;
+ let dN = `res.journeys[${i}].legs[${j.legs.length - 1}].destination`;
if (d.station) {
- d = d.station
- dN += '.station'
+ d = d.station;
+ dN += '.station';
}
- t.equal(d.type, 'location', dN + '.type is invalid')
- t.equal(d.id, id, dN + '.id is invalid')
- t.equal(d.name, name, dN + '.name is invalid')
- t.ok(isRoughlyEqual(.0001, d.latitude, latitude), dN + '.latitude is invalid')
- t.ok(isRoughlyEqual(.0001, d.longitude, longitude), dN + '.longitude is invalid')
+ t.equal(d.type, 'location', dN + '.type is invalid');
+ t.equal(d.id, id, dN + '.id is invalid');
+ t.equal(d.name, name, dN + '.name is invalid');
+ t.ok(isRoughlyEqual(0.0001, d.latitude, latitude), dN + '.latitude is invalid');
+ t.ok(isRoughlyEqual(0.0001, d.longitude, longitude), dN + '.longitude is invalid');
}
-}
+};
export {
testJourneysStationToPoi,
-}
+};
diff --git a/test/e2e/lib/journeys-station-to-station.js b/test/e2e/lib/journeys-station-to-station.js
index b85674a3..83fdc0fe 100644
--- a/test/e2e/lib/journeys-station-to-station.js
+++ b/test/e2e/lib/journeys-station-to-station.js
@@ -1,31 +1,35 @@
const testJourneysStationToStation = async (cfg) => {
- const {test: t, res, validate} = cfg
- const fromIds = cfg.fromIds || (cfg.fromId ? [cfg.fromId] : [])
- const toIds = cfg.toIds || (cfg.toId ? [cfg.toId] : [])
+ const {test: t, res, validate} = cfg;
+ const fromIds = cfg.fromIds || (cfg.fromId
+ ? [cfg.fromId]
+ : []);
+ const toIds = cfg.toIds || (cfg.toId
+ ? [cfg.toId]
+ : []);
- validate(t, res, 'journeysResult', 'res')
- const {journeys} = res
+ validate(t, res, 'journeysResult', 'res');
+ const {journeys} = res;
- t.ok(journeys.length >= 4, 'journeys must have >=4 items')
+ t.ok(journeys.length >= 4, 'journeys must have >=4 items');
for (let i = 0; i < journeys.length; i++) {
- const j = journeys[i]
- const n = `res.journeys[${i}]`
+ const j = journeys[i];
+ const n = `res.journeys[${i}]`;
- const o = j.legs[0].origin
- const d = j.legs[j.legs.length - 1].destination
+ const o = j.legs[0].origin;
+ const d = j.legs[j.legs.length - 1].destination;
t.ok(
- fromIds.includes(o.id) ||
- (o.station && fromIds.includes(o.station.id)),
- `invalid ${n}.legs[0].origin`
- )
+ fromIds.includes(o.id)
+ || o.station && fromIds.includes(o.station.id),
+ `invalid ${n}.legs[0].origin`,
+ );
t.ok(
- toIds.includes(d.id) ||
- (d.station && toIds.includes(d.station.id)),
- `invalid ${n}.legs[${j.legs.length - 1}].destination`
- )
+ toIds.includes(d.id)
+ || d.station && toIds.includes(d.station.id),
+ `invalid ${n}.legs[${j.legs.length - 1}].destination`,
+ );
}
-}
+};
export {
testJourneysStationToStation,
-}
+};
diff --git a/test/e2e/lib/journeys-walking-speed.js b/test/e2e/lib/journeys-walking-speed.js
index 96a21b70..05ac32ba 100644
--- a/test/e2e/lib/journeys-walking-speed.js
+++ b/test/e2e/lib/journeys-walking-speed.js
@@ -1,31 +1,31 @@
-import isRoughlyEqual from 'is-roughly-equal'
+import isRoughlyEqual from 'is-roughly-equal';
const testJourneysWalkingSpeed = async (cfg) => {
- const {test: t, journeys, validate, from, to, when, 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')
+ 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)
- t.ok(legWithSlowWalking, 'no walking leg in journey with slow walking')
+ results: 1, products, walkingSpeed: 'slow',
+ });
+ const legWithSlowWalking = journeyWithSlowWalking.legs.find(l => l.walking);
+ t.ok(legWithSlowWalking, 'no walking leg in journey with slow walking');
- const fastDist = legWithFastWalking.distance
- const slowDist = legWithSlowWalking.distance
- t.ok(isRoughlyEqual(100, fastDist, slowDist), 'precondition failed')
- const fastDur = new Date(legWithFastWalking.arrival) - new Date(legWithFastWalking.departure)
- const slowDur = new Date(legWithSlowWalking.arrival) - new Date(legWithSlowWalking.departure)
- t.notOk(isRoughlyEqual(minTimeDifference, fastDur, slowDur), 'walkingSpeed not applied')
- t.end()
-}
+ const fastDist = legWithFastWalking.distance;
+ const slowDist = legWithSlowWalking.distance;
+ t.ok(isRoughlyEqual(100, fastDist, slowDist), 'precondition failed');
+ const fastDur = new Date(legWithFastWalking.arrival) - new Date(legWithFastWalking.departure);
+ const slowDur = new Date(legWithSlowWalking.arrival) - new Date(legWithSlowWalking.departure);
+ t.notOk(isRoughlyEqual(minTimeDifference, fastDur, slowDur), 'walkingSpeed not applied');
+ t.end();
+};
export {
testJourneysWalkingSpeed,
-}
+};
diff --git a/test/e2e/lib/journeys-with-detour.js b/test/e2e/lib/journeys-with-detour.js
index f9a1a689..1843d740 100644
--- a/test/e2e/lib/journeys-with-detour.js
+++ b/test/e2e/lib/journeys-with-detour.js
@@ -1,21 +1,20 @@
const testJourneysWithDetour = async (cfg) => {
- const {test: t, res, validate, detourIds} = cfg
+ const {test: t, res, validate, detourIds} = cfg;
// We assume that going from A to B via C *without* detour is currently
// impossible. We check if the routing engine computes a detour.
- validate(t, res, 'journeysResult', 'res')
- const {journeys} = res
+ validate(t, res, 'journeysResult', 'res');
+ const {journeys} = res;
const leg = journeys[0].legs.some((leg) => {
- return leg.stopovers && leg.stopovers.some((st) => (
- st.stop.station && detourIds.includes(st.stop.station.id) ||
- detourIds.includes(st.stop.id)
- ))
- })
- t.ok(leg, detourIds.join('/') + ' is not being passed')
-}
+ return leg.stopovers && leg.stopovers.some((st) => st.stop.station && detourIds.includes(st.stop.station.id)
+ || detourIds.includes(st.stop.id),
+ );
+ });
+ t.ok(leg, detourIds.join('/') + ' is not being passed');
+};
export {
testJourneysWithDetour,
-}
+};
diff --git a/test/e2e/lib/leg-cycle-alternatives.js b/test/e2e/lib/leg-cycle-alternatives.js
index cc0c29ea..3ab4609a 100644
--- a/test/e2e/lib/leg-cycle-alternatives.js
+++ b/test/e2e/lib/leg-cycle-alternatives.js
@@ -1,46 +1,50 @@
-import isRoughlyEqual from 'is-roughly-equal'
+import isRoughlyEqual from 'is-roughly-equal';
-import {hour} from './util.js'
+import {hour} from './util.js';
const testLegCycleAlternatives = async (cfg) => {
const {
test: t,
fetchJourneys,
fromId,
- toId
- } = cfg
+ toId,
+ } = cfg;
// Apparently HAFAS doesn't return the leg cycle or alternatives more
// than ~2 hours in advance. This is why we don't pass `when` here.
- const journeys = await fetchJourneys(fromId, toId, {results: 3})
+ const journeys = await fetchJourneys(fromId, toId, {results: 3});
for (let i = 0; i < journeys.length; i++) {
- const journey = journeys[i]
+ const journey = journeys[i];
for (let j = 0; j < journey.legs.length; j++) {
- const leg = journey.legs[j]
- const name = `journeys[${i}].legs[${j}]`
+ const leg = journey.legs[j];
+ const name = `journeys[${i}].legs[${j}]`;
- if (!leg.line) continue
+ if (!leg.line) {
+ continue;
+ }
- t.ok(leg.cycle, name + '.cycle is missing')
- t.equal(typeof leg.cycle.min, 'number', name + '.cycle.min is not a number')
- t.equal(typeof leg.cycle.max, 'number', name + '.cycle.max is not a number')
- t.equal(typeof leg.cycle.nr, 'number', name + '.cycle.nr is not a number')
+ t.ok(leg.cycle, name + '.cycle is missing');
+ t.equal(typeof leg.cycle.min, 'number', name + '.cycle.min is not a number');
+ t.equal(typeof leg.cycle.max, 'number', name + '.cycle.max is not a number');
+ t.equal(typeof leg.cycle.nr, 'number', name + '.cycle.nr is not a number');
- const lineWhen = +new Date(leg.departure)
- t.ok(Array.isArray(leg.alternatives), name + '.alternatives must be an array')
+ const lineWhen = Number(new Date(leg.departure));
+ t.ok(Array.isArray(leg.alternatives), name + '.alternatives must be an array');
for (let k = 0; k < leg.alternatives.length; k++) {
- const a = leg.alternatives[k]
- const n = name + `.alternatives[${k}]`
+ const a = leg.alternatives[k];
+ const n = name + `.alternatives[${k}]`;
- let alternativeWhen = +new Date(a.when)
- if ('number' === typeof a.delay) alternativeWhen -= a.delay * 1000
- t.ok(isRoughlyEqual(2 * hour, alternativeWhen, lineWhen), n + '.when seems invalid')
+ let alternativeWhen = Number(new Date(a.when));
+ if ('number' === typeof a.delay) {
+ alternativeWhen -= a.delay * 1000;
+ }
+ t.ok(isRoughlyEqual(2 * hour, alternativeWhen, lineWhen), n + '.when seems invalid');
}
}
}
-}
+};
export {
testLegCycleAlternatives,
-}
+};
diff --git a/test/e2e/lib/lines.js b/test/e2e/lib/lines.js
index 75b7508f..fbde7e75 100644
--- a/test/e2e/lib/lines.js
+++ b/test/e2e/lib/lines.js
@@ -4,23 +4,23 @@ const testLines = async (cfg) => {
fetchLines,
validate,
query,
- } = cfg
+ } = cfg;
- const res = await fetchLines(query)
+ const res = await fetchLines(query);
const {
lines,
realtimeDataUpdatedAt,
- } = res
+ } = res;
for (let i = 0; i < res.lines.length; i++) {
- const l = res.lines[i]
- const name = `res.lines[${i}]`
- validate(t, l, 'line', name)
+ const l = res.lines[i];
+ const name = `res.lines[${i}]`;
+ validate(t, l, 'line', name);
}
- validate(t, realtimeDataUpdatedAt, 'realtimeDataUpdatedAt', 'res.realtimeDataUpdatedAt')
-}
+ validate(t, realtimeDataUpdatedAt, 'realtimeDataUpdatedAt', 'res.realtimeDataUpdatedAt');
+};
export {
testLines,
-}
+};
diff --git a/test/e2e/lib/reachable-from.js b/test/e2e/lib/reachable-from.js
index e05402d8..8f8727f7 100644
--- a/test/e2e/lib/reachable-from.js
+++ b/test/e2e/lib/reachable-from.js
@@ -1,4 +1,4 @@
-import isPlainObject from 'lodash/isPlainObject.js'
+import isPlainObject from 'lodash/isPlainObject.js';
const testReachableFrom = async (cfg) => {
const {
@@ -7,44 +7,44 @@ const testReachableFrom = async (cfg) => {
address,
when,
maxDuration,
- validate
- } = cfg
+ validate,
+ } = cfg;
const res = await reachableFrom(address, {
- when, maxDuration
- })
+ when, maxDuration,
+ });
const {
reachable: results,
realtimeDataUpdatedAt,
- } = res
+ } = res;
if (realtimeDataUpdatedAt !== null) { // todo: move this check into validators
- validate(t, realtimeDataUpdatedAt, 'realtimeDataUpdatedAt', 'res.realtimeDataUpdatedAt')
+ validate(t, realtimeDataUpdatedAt, 'realtimeDataUpdatedAt', 'res.realtimeDataUpdatedAt');
}
- t.ok(Array.isArray(results), 'results must an array')
- t.ok(results.length > 0, 'results must have >0 items')
+ t.ok(Array.isArray(results), 'results must an array');
+ t.ok(results.length > 0, 'results must have >0 items');
for (let i = 0; i < results.length; i++) {
- const res = results[i]
- const name = `results[${i}]`
+ const res = results[i];
+ const name = `results[${i}]`;
- t.ok(isPlainObject(res), name + ' must be an object')
- t.equal(typeof res.duration, 'number', name + '.duration must be a number')
- t.ok(res.duration > 0, name + '.duration must be >0')
+ t.ok(isPlainObject(res), name + ' must be an object');
+ t.equal(typeof res.duration, 'number', name + '.duration must be a number');
+ t.ok(res.duration > 0, name + '.duration must be >0');
- t.ok(Array.isArray(res.stations), name + '.stations must be an array')
- t.ok(res.stations.length > 0, name + '.stations must have >0 items')
+ t.ok(Array.isArray(res.stations), name + '.stations must be an array');
+ t.ok(res.stations.length > 0, name + '.stations must have >0 items');
for (let j = 0; j < res.stations.length; j++) {
- validate(t, res.stations[j], ['stop', 'station'], `${name}.stations[${j}]`)
+ validate(t, res.stations[j], ['stop', 'station'], `${name}.stations[${j}]`);
}
}
- const sorted = results.sort((a, b) => a.duration - b.duration)
- t.same(results, sorted, 'results must be sorted by res.duration')
-}
+ const sorted = results.sort((a, b) => a.duration - b.duration);
+ t.same(results, sorted, 'results must be sorted by res.duration');
+};
export {
testReachableFrom,
-}
+};
diff --git a/test/e2e/lib/refresh-journey.js b/test/e2e/lib/refresh-journey.js
index a3a85760..391dec32 100644
--- a/test/e2e/lib/refresh-journey.js
+++ b/test/e2e/lib/refresh-journey.js
@@ -4,9 +4,9 @@ const simplify = j => j.legs.map(l => {
destination: l.destination,
departure: l.plannedDeparture || l.departure,
arrival: l.plannedArrival || l.arrival,
- line: l.line
- }
-})
+ line: l.line,
+ };
+});
const testRefreshJourney = async (cfg) => {
const {
@@ -17,28 +17,28 @@ const testRefreshJourney = async (cfg) => {
fromId,
toId,
when,
- } = cfg
+ } = cfg;
const modelRes = await fetchJourneys(fromId, toId, {
results: 1, departure: when,
- stopovers: false
- })
- validate(t, modelRes, 'journeysResult', 'modelRes')
- const [model] = modelRes.journeys
+ stopovers: false,
+ });
+ validate(t, modelRes, 'journeysResult', 'modelRes');
+ const [model] = modelRes.journeys;
// todo: move to journeys validator?
- t.equal(typeof model.refreshToken, 'string')
- t.ok(model.refreshToken)
+ t.equal(typeof model.refreshToken, 'string');
+ t.ok(model.refreshToken);
const refreshedRes = await refreshJourney(model.refreshToken, {
- stopovers: false
- })
- validate(t, refreshedRes, 'refreshJourneyResult', 'refreshedRes')
- const refreshed = refreshedRes.journey
+ stopovers: false,
+ });
+ validate(t, refreshedRes, 'refreshJourneyResult', 'refreshedRes');
+ const refreshed = refreshedRes.journey;
- t.same(simplify(refreshed), simplify(model))
-}
+ t.same(simplify(refreshed), simplify(model));
+};
export {
testRefreshJourney,
-}
+};
diff --git a/test/e2e/lib/remarks.js b/test/e2e/lib/remarks.js
index 004030ca..634fc7ad 100644
--- a/test/e2e/lib/remarks.js
+++ b/test/e2e/lib/remarks.js
@@ -1,4 +1,4 @@
-const WEEK = 7 * 24 * 60 * 60 * 1000
+const WEEK = 7 * 24 * 60 * 60 * 1000;
const testRemarks = async (cfg) => {
const {
@@ -6,30 +6,30 @@ const testRemarks = async (cfg) => {
fetchRemarks,
validate,
when,
- } = cfg
+ } = cfg;
const res = await fetchRemarks({
results: 10,
from: when,
to: new Date(when + WEEK),
- })
+ });
const {
remarks,
realtimeDataUpdatedAt,
- } = res
+ } = res;
for (let i = 0; i < res.remarks.length; i++) {
- const rem = res.remarks[i]
- const name = `res.remarks[${i}]`
- validate(t, rem, 'remark', name)
+ const rem = res.remarks[i];
+ const name = `res.remarks[${i}]`;
+ validate(t, rem, 'remark', name);
}
// most endpoints currently don't provide this info for remarks()
if (realtimeDataUpdatedAt !== null) {
- validate(t, realtimeDataUpdatedAt, 'realtimeDataUpdatedAt', 'res.realtimeDataUpdatedAt')
+ validate(t, realtimeDataUpdatedAt, 'realtimeDataUpdatedAt', 'res.realtimeDataUpdatedAt');
}
-}
+};
export {
testRemarks,
-}
+};
diff --git a/test/e2e/lib/server-info.js b/test/e2e/lib/server-info.js
index a6a055e7..0a638b53 100644
--- a/test/e2e/lib/server-info.js
+++ b/test/e2e/lib/server-info.js
@@ -2,26 +2,26 @@ const testServerInfo = async (cfg) => {
const {
test: t,
fetchServerInfo,
- } = cfg
+ } = cfg;
- const info = await fetchServerInfo()
- t.ok(info, 'invalid info')
+ const info = await fetchServerInfo();
+ t.ok(info, 'invalid info');
- t.equal(typeof info.hciVersion, 'string', 'invalid info.hciVersion')
- t.ok(info.hciVersion, 'invalid info.hciVersion')
+ t.equal(typeof info.hciVersion, 'string', 'invalid info.hciVersion');
+ t.ok(info.hciVersion, 'invalid info.hciVersion');
- t.equal(typeof info.timetableStart, 'string', 'invalid info.timetableStart')
- t.ok(info.timetableStart, 'invalid info.timetableStart')
- t.equal(typeof info.timetableEnd, 'string', 'invalid info.timetableEnd')
- t.ok(info.timetableEnd, 'invalid info.timetableEnd')
+ t.equal(typeof info.timetableStart, 'string', 'invalid info.timetableStart');
+ t.ok(info.timetableStart, 'invalid info.timetableStart');
+ t.equal(typeof info.timetableEnd, 'string', 'invalid info.timetableEnd');
+ t.ok(info.timetableEnd, 'invalid info.timetableEnd');
- t.equal(typeof info.serverTime, 'string', 'invalid info.serverTime')
- t.notOk(Number.isNaN(Date.parse(info.serverTime)), 'invalid info.serverTime')
+ t.equal(typeof info.serverTime, 'string', 'invalid info.serverTime');
+ t.notOk(Number.isNaN(Date.parse(info.serverTime)), 'invalid info.serverTime');
- t.ok(Number.isInteger(info.realtimeDataUpdatedAt), 'invalid info.realtimeDataUpdatedAt')
- t.ok(info.realtimeDataUpdatedAt > 0, 'invalid info.realtimeDataUpdatedAt')
-}
+ t.ok(Number.isInteger(info.realtimeDataUpdatedAt), 'invalid info.realtimeDataUpdatedAt');
+ t.ok(info.realtimeDataUpdatedAt > 0, 'invalid info.realtimeDataUpdatedAt');
+};
export {
testServerInfo,
-}
+};
diff --git a/test/e2e/lib/util.js b/test/e2e/lib/util.js
index 0ca6136d..860a8e6b 100644
--- a/test/e2e/lib/util.js
+++ b/test/e2e/lib/util.js
@@ -1,75 +1,82 @@
-import isRoughlyEqual from 'is-roughly-equal'
-import {ok, AssertionError} from 'assert'
-import {DateTime} from 'luxon'
-import * as a from 'assert'
-import {createRequire} from 'module'
-import {gunzipSync} from 'zlib'
+import isRoughlyEqual from 'is-roughly-equal';
+import {ok, AssertionError} from 'assert';
+import {DateTime} from 'luxon';
+import * as a from 'assert';
+import {createRequire} from 'module';
+import {gunzipSync} from 'zlib';
-const hour = 60 * 60 * 1000
-const day = 24 * hour
-const week = 7 * day
+const hour = 60 * 60 * 1000;
+const day = 24 * hour;
+const week = 7 * day;
// next Monday 10 am
const createWhen = (timezone, locale, tMock) => {
- ok(Number.isInteger(tMock), 'tMock must be an integer')
+ ok(Number.isInteger(tMock), 'tMock must be an integer');
const t = process.env.VCR_MODE && !process.env.VCR_OFF
? tMock
- : Date.now()
+ : Date.now();
return DateTime.fromMillis(t, {
zone: timezone,
locale,
- }).startOf('week').plus({weeks: 1, hours: 10}).toJSDate()
-}
+ })
+ .startOf('week')
+ .plus({weeks: 1, hours: 10})
+ .toJSDate();
+};
const assertValidWhen = (actual, expected, name, delta = day + 6 * hour) => {
- const ts = +new Date(actual)
- a.ok(!Number.isNaN(ts), name + ' is not parsable by Date')
+ const ts = Number(new Date(actual));
+ a.ok(!Number.isNaN(ts), name + ' is not parsable by Date');
// the timestamps might be from long-distance trains
- if (!isRoughlyEqual(delta, +expected, ts)) {
+ if (!isRoughlyEqual(delta, Number(expected), ts)) {
throw new AssertionError({
message: name + ' is out of range',
actual: ts,
- expected: `${expected - delta} - ${+expected + delta}`,
+ expected: `${expected - delta} - ${Number(expected) + delta}`,
operator: 'isRoughlyEqual',
- })
+ });
}
-}
+};
// HTTP request mocking
if (process.env.VCR_MODE && !process.env.VCR_OFF) {
- const require = createRequire(import.meta.url)
+ const require = createRequire(import.meta.url);
- const {Polly} = require('@pollyjs/core')
- const NodeHttpAdapter = require('@pollyjs/adapter-node-http')
- const FSPersister = require('@pollyjs/persister-fs')
- const tap = require('tap')
+ const {Polly} = require('@pollyjs/core');
+ const NodeHttpAdapter = require('@pollyjs/adapter-node-http');
+ const FSPersister = require('@pollyjs/persister-fs');
+ const tap = require('tap');
// monkey-patch NodeHttpAdapter to handle gzipped responses properly
// todo: submit a PR
// related: https://github.com/Netflix/pollyjs/issues/256
// related: https://github.com/Netflix/pollyjs/issues/463
// related: https://github.com/Netflix/pollyjs/issues/207
- const _getBodyFromChunks = NodeHttpAdapter.prototype.getBodyFromChunks
+ const _getBodyFromChunks = NodeHttpAdapter.prototype.getBodyFromChunks;
NodeHttpAdapter.prototype.getBodyFromChunks = function getBodyFromChunksWithGunzip (chunks, headers) {
if (headers['content-encoding'] === 'gzip') {
- const concatenated = Buffer.concat(chunks)
- chunks = [gunzipSync(concatenated)]
+ const concatenated = Buffer.concat(chunks);
+ chunks = [gunzipSync(concatenated)];
// todo: this is ugly, find a better way
- delete headers['content-encoding']
- headers['content-length'] = chunks[0].length
+ delete headers['content-encoding'];
+ headers['content-length'] = chunks[0].length;
}
- return _getBodyFromChunks.call(this, chunks, headers)
+ return _getBodyFromChunks.call(this, chunks, headers);
+ };
+
+ Polly.register(NodeHttpAdapter);
+ Polly.register(FSPersister);
+
+ let mode;
+ if (process.env.VCR_MODE === 'record') {
+ mode = 'record';
+ } else if (process.env.VCR_MODE === 'playback') {
+ mode = 'replay';
+ } else {
+ throw new Error('invalid $VCR_MODE, must be "record" or "replay"');
}
- Polly.register(NodeHttpAdapter)
- Polly.register(FSPersister)
-
- let mode
- if (process.env.VCR_MODE === 'record') mode = 'record'
- else if (process.env.VCR_MODE === 'playback') mode = 'replay'
- else throw new Error('invalid $VCR_MODE, must be "record" or "replay"')
-
const polly = new Polly('requests', {
logLevel: 'warn',
// If a request's recording is not found, pass-through to the server and record the response.
@@ -106,13 +113,13 @@ if (process.env.VCR_MODE && !process.env.VCR_OFF) {
],
},
},
- })
+ });
tap.teardown(async () => {
- await polly.stop()
- })
+ await polly.stop();
+ });
}
export {
hour, createWhen, assertValidWhen,
-}
+};
diff --git a/test/e2e/lib/validate-fptf-with.js b/test/e2e/lib/validate-fptf-with.js
index e9e3f9eb..81649dd1 100644
--- a/test/e2e/lib/validate-fptf-with.js
+++ b/test/e2e/lib/validate-fptf-with.js
@@ -1,27 +1,27 @@
-import validateFptf from 'validate-fptf'
-const {defaultValidators} = validateFptf
-import anyOf from 'validate-fptf/lib/any-of.js'
+import validateFptf from 'validate-fptf';
+const {defaultValidators} = validateFptf;
+import anyOf from 'validate-fptf/lib/any-of.js';
-import validators from './validators.js'
+import validators from './validators.js';
const createValidateFptfWith = (cfg, customValidators = {}) => {
- const val = Object.assign({}, defaultValidators)
+ const val = Object.assign({}, defaultValidators);
for (let key of Object.keys(validators)) {
- val[key] = validators[key](cfg)
+ val[key] = validators[key](cfg);
}
- Object.assign(val, customValidators)
+ Object.assign(val, customValidators);
const validateFptfWith = (t, item, allowedTypes, name) => {
if ('string' === typeof allowedTypes) {
- val[allowedTypes](val, item, name)
+ val[allowedTypes](val, item, name);
} else {
- anyOf(allowedTypes, val, item, name)
+ anyOf(allowedTypes, val, item, name);
}
- t.pass(name + ' is valid')
- }
- return validateFptfWith
-}
+ t.pass(name + ' is valid');
+ };
+ return validateFptfWith;
+};
export {
createValidateFptfWith,
-}
+};
diff --git a/test/e2e/lib/validators.js b/test/e2e/lib/validators.js
index b31a446b..0cf07b76 100644
--- a/test/e2e/lib/validators.js
+++ b/test/e2e/lib/validators.js
@@ -1,660 +1,667 @@
-import * as a from 'assert'
-import validateFptf from 'validate-fptf'
-const {defaultValidators} = validateFptf
-import anyOf from 'validate-fptf/lib/any-of.js'
+import * as a from 'assert';
+import validateFptf from 'validate-fptf';
+const {defaultValidators} = validateFptf;
+import anyOf from 'validate-fptf/lib/any-of.js';
-import {assertValidWhen} from './util.js'
+import {assertValidWhen} from './util.js';
-const DAY = 24 * 60 * 60 * 1000
+const DAY = 24 * 60 * 60 * 1000;
-const isObj = o => o !== null && 'object' === typeof o && !Array.isArray(o)
-const is = val => val !== null && val !== undefined
+const isObj = o => o !== null && 'object' === typeof o && !Array.isArray(o);
+const is = val => val !== null && val !== undefined;
const createValidateRealtimeDataUpdatedAt = (cfg) => {
const validateRealtimeDataUpdatedAt = (val, rtDataUpdatedAt, name = 'realtimeDataUpdatedAt') => {
- a.ok(Number.isInteger(rtDataUpdatedAt), name + ' must be an integer')
- assertValidWhen(rtDataUpdatedAt * 1000, cfg.when, name, 100 * DAY)
- }
- return validateRealtimeDataUpdatedAt
-}
+ a.ok(Number.isInteger(rtDataUpdatedAt), name + ' must be an integer');
+ assertValidWhen(rtDataUpdatedAt * 1000, cfg.when, name, 100 * DAY);
+ };
+ return validateRealtimeDataUpdatedAt;
+};
const createValidateProducts = (cfg) => {
const validateProducts = (val, p, name = 'products') => {
- a.ok(isObj(p), name + ' must be an object')
+ a.ok(isObj(p), name + ' must be an object');
for (let product of cfg.products) {
- const msg = `${name}[${product.id}] must be a boolean`
- a.strictEqual(typeof p[product.id], 'boolean', msg)
+ const msg = `${name}[${product.id}] must be a boolean`;
+ a.strictEqual(typeof p[product.id], 'boolean', msg);
}
- }
- return validateProducts
-}
+ };
+ return validateProducts;
+};
const createValidateStation = (cfg) => {
const validateStation = (val, s, name = 'station') => {
- defaultValidators.station(val, s, name)
+ defaultValidators.station(val, s, name);
if (!cfg.stationCoordsOptional) {
- a.ok(is(s.location), `missing ${name}.location`)
+ a.ok(is(s.location), `missing ${name}.location`);
}
- val.products(val, s.products, name + '.products')
+ val.products(val, s.products, name + '.products');
if ('lines' in s) {
- a.ok(Array.isArray(s.lines), name + `.lines must be an array`)
+ a.ok(Array.isArray(s.lines), name + '.lines must be an array');
for (let i = 0; i < s.lines.length; i++) {
- val.line(val, s.lines[i], name + `.lines[${i}]`)
+ val.line(val, s.lines[i], name + `.lines[${i}]`);
}
}
- }
- return validateStation
-}
+ };
+ return validateStation;
+};
const validateStop = (val, s, name = 'stop') => {
// HAFAS doesn't always return the station of a stop. We mock it here
// to silence `validate-fptf`.
- const station = Object.assign({}, s)
- station.type = 'station'
- s = Object.assign({station}, s)
- defaultValidators.stop(val, s, name)
+ const station = Object.assign({}, s);
+ station.type = 'station';
+ s = Object.assign({station}, s);
+ defaultValidators.stop(val, s, name);
// todo: check if s.id has leading zeros
-}
-const createValidateStop = () => validateStop
+};
+const createValidateStop = () => validateStop;
const validatePoi = (val, poi, name = 'location') => {
- defaultValidators.location(val, poi, name)
- val.ref(val, poi.id, name + '.id')
+ defaultValidators.location(val, poi, name);
+ val.ref(val, poi.id, name + '.id');
// todo: check if s.id has leading zeros
- a.strictEqual(poi.poi, true, name + '.poi must be true')
- a.strictEqual(typeof poi.name, 'string', name + '.name must be a string')
- a.ok(poi.name, name + '.name must not be empty')
-}
-const createValidatePoi = () => validatePoi
+ a.strictEqual(poi.poi, true, name + '.poi must be true');
+ a.strictEqual(typeof poi.name, 'string', name + '.name must be a string');
+ a.ok(poi.name, name + '.name must not be empty');
+};
+const createValidatePoi = () => validatePoi;
const validateAddress = (val, addr, name = 'location') => {
- defaultValidators.location(val, addr, name)
- a.strictEqual(typeof addr.address, 'string', name + '.address must be a string')
- a.ok(addr.address, name + '.address must not be empty')
-}
-const createValidateAddress = () => validateAddress
+ defaultValidators.location(val, addr, name);
+ a.strictEqual(typeof addr.address, 'string', name + '.address must be a string');
+ a.ok(addr.address, name + '.address must not be empty');
+};
+const createValidateAddress = () => validateAddress;
const validateLocation = (val, loc, name = 'location') => {
- a.ok(isObj(loc), name + ' must be an object')
- if (loc.type === 'stop') val.stop(val, loc, name)
- else if (loc.type === 'station') val.station(val, loc, name)
- else if (loc.poi) validatePoi(val, loc, name)
- else if (!('name' in loc) && ('address' in loc)) {
- validateAddress(val, loc, name)
- } else defaultValidators.location(val, loc, name)
-}
-const createValidateLocation = () => validateLocation
+ a.ok(isObj(loc), name + ' must be an object');
+ if (loc.type === 'stop') {
+ val.stop(val, loc, name);
+ } else if (loc.type === 'station') {
+ val.station(val, loc, name);
+ } else if (loc.poi) {
+ validatePoi(val, loc, name);
+ } else if (!('name' in loc) && 'address' in loc) {
+ validateAddress(val, loc, name);
+ } else {
+ defaultValidators.location(val, loc, name);
+ }
+};
+const createValidateLocation = () => validateLocation;
const validateLocations = (val, locs, name = 'locations') => {
- a.ok(Array.isArray(locs), name + ' must be an array')
- a.ok(locs.length > 0, name + ' must not be empty')
+ a.ok(Array.isArray(locs), name + ' must be an array');
+ a.ok(locs.length > 0, name + ' must not be empty');
for (let i = 0; i < locs.length; i++) {
- val.location(val, locs[i], name + `[${i}]`)
+ val.location(val, locs[i], name + `[${i}]`);
}
-}
-const createValidateLocations = () => validateLocations
+};
+const createValidateLocations = () => validateLocations;
const createValidateLine = (cfg) => {
- const validLineModes = []
+ const validLineModes = [];
for (let product of cfg.products) {
if (!validLineModes.includes(product.mode)) {
- validLineModes.push(product.mode)
+ validLineModes.push(product.mode);
}
}
const validateLine = (val, line, name = 'line') => {
- defaultValidators.line(val, line, name)
+ defaultValidators.line(val, line, name);
- const msg = name + '.fahrtNr must be '
+ const msg = name + '.fahrtNr must be ';
if (line.fahrtNr !== null) {
- a.strictEqual(typeof line.fahrtNr, 'string', msg + 'a string')
- a.ok(line.fahrtNr, msg + ' be empty')
+ a.strictEqual(typeof line.fahrtNr, 'string', msg + 'a string');
+ a.ok(line.fahrtNr, msg + ' be empty');
}
- a.ok(validLineModes.includes(line.mode), name + '.mode is invalid')
- }
- return validateLine
-}
+ a.ok(validLineModes.includes(line.mode), name + '.mode is invalid');
+ };
+ return validateLine;
+};
const validateRemark = (val, rem, name = 'remark') => {
- a.ok(isObj(rem), name + ' must be an object')
- a.strictEqual(typeof rem.id, 'string', name + '.id must be a string')
- a.ok(rem.id, name + '.id must not be empty')
+ a.ok(isObj(rem), name + ' must be an object');
+ a.strictEqual(typeof rem.id, 'string', name + '.id must be a string');
+ a.ok(rem.id, name + '.id must not be empty');
if (rem.summary !== null) {
- a.strictEqual(typeof rem.summary, 'string', name + '.summary must be a string')
- a.ok(rem.summary, name + '.summary must not be empty')
+ a.strictEqual(typeof rem.summary, 'string', name + '.summary must be a string');
+ a.ok(rem.summary, name + '.summary must not be empty');
}
if (rem.text !== null) {
- a.strictEqual(typeof rem.text, 'string', name + '.text must be a string')
- a.ok(rem.text, name + '.text must not be empty')
+ a.strictEqual(typeof rem.text, 'string', name + '.text must be a string');
+ a.ok(rem.text, name + '.text must not be empty');
}
if ('validFrom' in rem) {
- a.strictEqual(typeof rem.validFrom, 'string', name + '.validFrom must be a string')
- a.ok(Number.isInteger(Date.parse(rem.validFrom)), name + '.validFrom must be ISO 8601')
+ a.strictEqual(typeof rem.validFrom, 'string', name + '.validFrom must be a string');
+ a.ok(Number.isInteger(Date.parse(rem.validFrom)), name + '.validFrom must be ISO 8601');
}
if ('validUntil' in rem) {
- a.strictEqual(typeof rem.validUntil, 'string', name + '.validUntil must be a string')
- a.ok(Number.isInteger(Date.parse(rem.validUntil)), name + '.validUntil must be ISO 8601')
+ a.strictEqual(typeof rem.validUntil, 'string', name + '.validUntil must be a string');
+ a.ok(Number.isInteger(Date.parse(rem.validUntil)), name + '.validUntil must be ISO 8601');
}
if ('modified' in rem) {
- a.strictEqual(typeof rem.modified, 'string', name + '.modified must be a string')
- a.ok(Number.isInteger(Date.parse(rem.modified)), name + '.modified must be ISO 8601')
+ a.strictEqual(typeof rem.modified, 'string', name + '.modified must be a string');
+ a.ok(Number.isInteger(Date.parse(rem.modified)), name + '.modified must be ISO 8601');
}
if ('products' in rem) {
- val.products(val, rem.products, name + '.products')
+ val.products(val, rem.products, name + '.products');
}
if ('edges' in rem) {
- a.ok(Array.isArray(rem.edges), name + '.edges must be an array')
+ a.ok(Array.isArray(rem.edges), name + '.edges must be an array');
for (let i = 0; i < rem.edges.length; i++) {
- const e = rem.edges[i]
- const n = `${name}.edges[${i}]`
- a.ok(isObj(e), n + ' must be an object')
+ const e = rem.edges[i];
+ const n = `${name}.edges[${i}]`;
+ a.ok(isObj(e), n + ' must be an object');
if (e.fromLocation !== null) {
- val.location(val, e.fromLocation, n + '.fromLocation')
+ val.location(val, e.fromLocation, n + '.fromLocation');
}
if (e.toLocation !== null) {
- val.location(val, e.toLocation, n + '.toLocation')
+ val.location(val, e.toLocation, n + '.toLocation');
}
}
}
if ('affectedLines' in rem) {
- a.ok(Array.isArray(rem.affectedLines), name + '.affectedLines must be an array')
+ a.ok(Array.isArray(rem.affectedLines), name + '.affectedLines must be an array');
for (let i = 0; i < rem.affectedLines.length; i++) {
- val.line(val, rem.affectedLines[i], `${name}.affectedLines[${i}]`)
+ val.line(val, rem.affectedLines[i], `${name}.affectedLines[${i}]`);
}
}
-}
-const createValidateRemark = () => validateRemark
+};
+const createValidateRemark = () => validateRemark;
const createValidateStopover = (cfg) => {
const validateStopover = (val, s, name = 'stopover') => {
if (
- !is(s.arrival) && !is(s.departure) &&
- !is(s.plannedArrival) && !is(s.plannedDeparture)
+ !is(s.arrival) && !is(s.departure)
+ && !is(s.plannedArrival) && !is(s.plannedDeparture)
) {
- a.fail(name + ' contains neither (planned)arrival nor (planned)departure')
+ a.fail(name + ' contains neither (planned)arrival nor (planned)departure');
}
if (is(s.arrival)) {
- val.date(val, s.arrival, name + '.arrival')
- assertValidWhen(s.arrival, cfg.when, name + '.arrival')
+ val.date(val, s.arrival, name + '.arrival');
+ assertValidWhen(s.arrival, cfg.when, name + '.arrival');
}
if (is(s.departure)) {
- val.date(val, s.departure, name + '.departure')
- assertValidWhen(s.departure, cfg.when, name + '.departure')
+ val.date(val, s.departure, name + '.departure');
+ assertValidWhen(s.departure, cfg.when, name + '.departure');
}
if (is(s.plannedArrival)) {
- val.date(val, s.plannedArrival, name + '.plannedArrival')
- assertValidWhen(s.plannedArrival, cfg.when, name + '.plannedArrival')
+ val.date(val, s.plannedArrival, name + '.plannedArrival');
+ assertValidWhen(s.plannedArrival, cfg.when, name + '.plannedArrival');
}
if (is(s.departurePrognosisType)) {
- const msg = name + '.departurePrognosisType must '
- a.strictEqual(typeof s.departurePrognosisType, 'string', msg + 'be a string')
- a.ok(s.departurePrognosisType, msg + 'not be empty')
+ const msg = name + '.departurePrognosisType must ';
+ a.strictEqual(typeof s.departurePrognosisType, 'string', msg + 'be a string');
+ a.ok(s.departurePrognosisType, msg + 'not be empty');
}
if (is(s.plannedDeparture)) {
- val.date(val, s.plannedDeparture, name + '.plannedDeparture')
- assertValidWhen(s.plannedDeparture, cfg.when, name + '.plannedDeparture')
+ val.date(val, s.plannedDeparture, name + '.plannedDeparture');
+ assertValidWhen(s.plannedDeparture, cfg.when, name + '.plannedDeparture');
}
if (is(s.plannedArrival) && !is(s.arrival) && !s.cancelled) {
- a.fail(name + ' has .plannedArrival but not .arrival')
+ a.fail(name + ' has .plannedArrival but not .arrival');
}
if (is(s.plannedDeparture) && !is(s.departure) && !s.cancelled) {
- a.fail(name + ' has .plannedDeparture but not .departure')
+ a.fail(name + ' has .plannedDeparture but not .departure');
}
if (is(s.arrivalDelay)) {
- const msg = name + '.arrivalDelay must be a number'
- a.strictEqual(typeof s.arrivalDelay, 'number', msg)
- const d = new Date(s.arrival) - new Date(s.plannedArrival)
- a.strictEqual(Math.round(d / 1000), s.arrivalDelay)
+ const msg = name + '.arrivalDelay must be a number';
+ a.strictEqual(typeof s.arrivalDelay, 'number', msg);
+ const d = new Date(s.arrival) - new Date(s.plannedArrival);
+ a.strictEqual(Math.round(d / 1000), s.arrivalDelay);
}
if (is(s.departureDelay)) {
- const msg = name + '.departureDelay must be a number'
- a.strictEqual(typeof s.departureDelay, 'number', msg)
- const d = new Date(s.departure) - new Date(s.plannedDeparture)
- a.strictEqual(Math.round(d / 1000), s.departureDelay)
+ const msg = name + '.departureDelay must be a number';
+ a.strictEqual(typeof s.departureDelay, 'number', msg);
+ const d = new Date(s.departure) - new Date(s.plannedDeparture);
+ a.strictEqual(Math.round(d / 1000), s.departureDelay);
}
if (is(s.arrivalPlatform)) {
- const msg = name + '.arrivalPlatform must '
- a.strictEqual(typeof s.arrivalPlatform, 'string', msg + 'be a string')
- a.ok(s.arrivalPlatform, msg + 'not be empty')
+ const msg = name + '.arrivalPlatform must ';
+ a.strictEqual(typeof s.arrivalPlatform, 'string', msg + 'be a string');
+ a.ok(s.arrivalPlatform, msg + 'not be empty');
}
if (is(s.plannedArrivalPlatform)) {
- const msg = name + '.plannedArrivalPlatform must '
- a.strictEqual(typeof s.plannedArrivalPlatform, 'string', msg + 'be a string')
- a.ok(s.plannedArrivalPlatform, msg + 'not be empty')
+ const msg = name + '.plannedArrivalPlatform must ';
+ a.strictEqual(typeof s.plannedArrivalPlatform, 'string', msg + 'be a string');
+ a.ok(s.plannedArrivalPlatform, msg + 'not be empty');
}
if (is(s.arrivalPrognosisType)) {
- const msg = name + '.arrivalPrognosisType must '
- a.strictEqual(typeof s.arrivalPrognosisType, 'string', msg + 'be a string')
- a.ok(s.arrivalPrognosisType, msg + 'not be empty')
+ const msg = name + '.arrivalPrognosisType must ';
+ a.strictEqual(typeof s.arrivalPrognosisType, 'string', msg + 'be a string');
+ a.ok(s.arrivalPrognosisType, msg + 'not be empty');
}
if (is(s.departurePlatform)) {
- const msg = name + '.departurePlatform must '
- a.strictEqual(typeof s.departurePlatform, 'string', msg + 'be a string')
- a.ok(s.departurePlatform, msg + 'not be empty')
+ const msg = name + '.departurePlatform must ';
+ a.strictEqual(typeof s.departurePlatform, 'string', msg + 'be a string');
+ a.ok(s.departurePlatform, msg + 'not be empty');
}
if (is(s.plannedDeparturePlatform)) {
- const msg = name + '.plannedDeparturePlatform must '
- a.strictEqual(typeof s.plannedDeparturePlatform, 'string', msg + 'be a string')
- a.ok(s.plannedDeparturePlatform, msg + 'not be empty')
+ const msg = name + '.plannedDeparturePlatform must ';
+ a.strictEqual(typeof s.plannedDeparturePlatform, 'string', msg + 'be a string');
+ a.ok(s.plannedDeparturePlatform, msg + 'not be empty');
}
if (is(s.plannedArrivalPlatform) && !is(s.arrivalPlatform)) {
- a.fail(name + ' has .plannedArrivalPlatform but not .arrivalPlatform')
+ a.fail(name + ' has .plannedArrivalPlatform but not .arrivalPlatform');
}
if (is(s.plannedDeparturePlatform) && !is(s.departurePlatform)) {
- a.fail(name + ' has .plannedDeparturePlatform but not .departurePlatform')
+ a.fail(name + ' has .plannedDeparturePlatform but not .departurePlatform');
}
- anyOf(['stop', 'station'], val, s.stop, name + '.stop')
- }
- return validateStopover
-}
+ anyOf(['stop', 'station'], val, s.stop, name + '.stop');
+ };
+ return validateStopover;
+};
const validateTicket = (val, ti, name = 'ticket') => {
- a.strictEqual(typeof ti.name, 'string', name + '.name must be a string')
- a.ok(ti.name, name + '.name must not be empty')
+ a.strictEqual(typeof ti.name, 'string', name + '.name must be a string');
+ a.ok(ti.name, name + '.name must not be empty');
if (is(ti.price)) {
- a.strictEqual(typeof ti.price, 'number', name + '.price must be a number')
- a.ok(ti.price > 0, name + '.price must be >0')
+ a.strictEqual(typeof ti.price, 'number', name + '.price must be a number');
+ a.ok(ti.price > 0, name + '.price must be >0');
}
if (is(ti.amount)) {
- a.strictEqual(typeof ti.amount, 'number', name + '.amount must be a number')
- a.ok(ti.amount > 0, name + '.amount must be >0')
+ a.strictEqual(typeof ti.amount, 'number', name + '.amount must be a number');
+ a.ok(ti.amount > 0, name + '.amount must be >0');
}
// todo: move to VBB tests
if ('bike' in ti) {
- a.strictEqual(typeof ti.bike, 'boolean', name + '.bike must be a boolean')
+ a.strictEqual(typeof ti.bike, 'boolean', name + '.bike must be a boolean');
}
if ('shortTrip' in ti) {
- a.strictEqual(typeof ti.shortTrip, 'boolean', name + '.shortTrip must be a boolean')
+ a.strictEqual(typeof ti.shortTrip, 'boolean', name + '.shortTrip must be a boolean');
}
if ('group' in ti) {
- a.strictEqual(typeof ti.group, 'boolean', name + '.group must be a boolean')
+ a.strictEqual(typeof ti.group, 'boolean', name + '.group must be a boolean');
}
if ('fullDay' in ti) {
- a.strictEqual(typeof ti.fullDay, 'boolean', name + '.fullDay must be a boolean')
+ a.strictEqual(typeof ti.fullDay, 'boolean', name + '.fullDay must be a boolean');
}
if ('tariff' in ti) {
- a.strictEqual(typeof ti.tariff, 'string', name + '.tariff must be a string')
- a.ok(ti.tariff, name + '.tariff must not be empty')
+ a.strictEqual(typeof ti.tariff, 'string', name + '.tariff must be a string');
+ a.ok(ti.tariff, name + '.tariff must not be empty');
}
if ('coverage' in ti) {
- a.strictEqual(typeof ti.coverage, 'string', name + '.coverage must be a string')
- a.ok(ti.coverage, name + '.coverage must not be empty')
+ a.strictEqual(typeof ti.coverage, 'string', name + '.coverage must be a string');
+ a.ok(ti.coverage, name + '.coverage must not be empty');
}
if ('variant' in ti) {
- a.strictEqual(typeof ti.variant, 'string', name + '.variant must be a string')
- a.ok(ti.variant, name + '.variant must not be empty')
+ a.strictEqual(typeof ti.variant, 'string', name + '.variant must be a string');
+ a.ok(ti.variant, name + '.variant must not be empty');
}
-}
-const createValidateTicket = () => validateTicket
+};
+const createValidateTicket = () => validateTicket;
const createValidateJourneyLeg = (cfg) => {
const validateJourneyLeg = (val, leg, name = 'journeyLeg') => {
const fakeLeg = Object.assign({
schedule: 'foo', // todo: let hafas-client parse a schedule ID
- operator: 'bar' // todo: let hafas-client parse the operator
- }, leg)
+ operator: 'bar', // todo: let hafas-client parse the operator
+ }, leg);
if (leg.cancelled) {
// FPTF doesn't support cancelled journey legs yet.
// see https://github.com/public-transport/friendly-public-transport-format/issues/27
// todo: remove once this is resolved upstream
- fakeLeg.departure = leg.plannedDeparture
- fakeLeg.arrival = leg.plannedArrival
+ fakeLeg.departure = leg.plannedDeparture;
+ fakeLeg.arrival = leg.plannedArrival;
}
- defaultValidators.journeyLeg(val, fakeLeg, name)
+ defaultValidators.journeyLeg(val, fakeLeg, name);
if (leg.arrival !== null) {
- assertValidWhen(leg.arrival, cfg.when, name + '.arrival')
+ assertValidWhen(leg.arrival, cfg.when, name + '.arrival');
}
if (leg.departure !== null) {
- assertValidWhen(leg.departure, cfg.when, name + '.departure')
+ assertValidWhen(leg.departure, cfg.when, name + '.departure');
}
// todo: leg.arrivalPlatform !== null
if (is(leg.arrivalPlatform)) {
- const msg = name + '.arrivalPlatform must be a string'
- a.strictEqual(typeof leg.arrivalPlatform, 'string', msg)
- a.ok(leg.arrivalPlatform, name + '.arrivalPlatform must not be empty')
+ const msg = name + '.arrivalPlatform must be a string';
+ a.strictEqual(typeof leg.arrivalPlatform, 'string', msg);
+ a.ok(leg.arrivalPlatform, name + '.arrivalPlatform must not be empty');
}
// todo: leg.departurePlatform !== null
if (is(leg.departurePlatform)) {
- const msg = name + '.departurePlatform must be a string'
- a.strictEqual(typeof leg.departurePlatform, 'string', msg)
- a.ok(leg.departurePlatform, name + '.departurePlatform must not be empty')
+ const msg = name + '.departurePlatform must be a string';
+ a.strictEqual(typeof leg.departurePlatform, 'string', msg);
+ a.ok(leg.departurePlatform, name + '.departurePlatform must not be empty');
}
if ('stopovers' in leg) {
- a.ok(Array.isArray(leg.stopovers), name + '.stopovers must be an array')
- a.ok(leg.stopovers.length > 0, name + '.stopovers must not be empty')
+ a.ok(Array.isArray(leg.stopovers), name + '.stopovers must be an array');
+ a.ok(leg.stopovers.length > 0, name + '.stopovers must not be empty');
for (let i = 0; i < leg.stopovers.length; i++) {
- val.stopover(val, leg.stopovers[i], name + `.stopovers[${i}]`)
+ val.stopover(val, leg.stopovers[i], name + `.stopovers[${i}]`);
}
}
// todo: leg.public
if ('walking' in leg) {
- a.strictEqual(typeof leg.walking, 'boolean', name + '.walking must be a boolean')
+ a.strictEqual(typeof leg.walking, 'boolean', name + '.walking must be a boolean');
}
if (leg.walking) {
if (leg.distance !== null) {
- const msg = name + '.distance must be '
- a.strictEqual(typeof leg.distance, 'number', msg + 'a number')
- a.ok(leg.distance > 0, msg + '> 0')
+ const msg = name + '.distance must be ';
+ a.strictEqual(typeof leg.distance, 'number', msg + 'a number');
+ a.ok(leg.distance > 0, msg + '> 0');
}
} else {
- a.strictEqual(typeof leg.tripId, 'string', name + '.tripId must be a string')
- a.ok(leg.tripId, name + '.tripId must not be empty')
+ a.strictEqual(typeof leg.tripId, 'string', name + '.tripId must be a string');
+ a.ok(leg.tripId, name + '.tripId must not be empty');
if (!leg.cancelled) {
- const msg = name + '.direction must be a string'
- a.strictEqual(typeof leg.direction, 'string', msg)
- a.ok(leg.direction, name + '.direction must not be empty')
+ const msg = name + '.direction must be a string';
+ a.strictEqual(typeof leg.direction, 'string', msg);
+ a.ok(leg.direction, name + '.direction must not be empty');
}
}
if ('cycle' in leg) {
- a.ok(isObj(leg.cycle), name + '.cycle must be an object')
- if (('min' in leg.cycle) && leg.cycle.min !== null) {
- a.strictEqual(typeof leg.cycle.min, 'number', name + '.cycle.min must be a number')
- a.ok(leg.cycle.min > 0, name + '.cycle.min must be >0')
+ a.ok(isObj(leg.cycle), name + '.cycle must be an object');
+ if ('min' in leg.cycle && leg.cycle.min !== null) {
+ a.strictEqual(typeof leg.cycle.min, 'number', name + '.cycle.min must be a number');
+ a.ok(leg.cycle.min > 0, name + '.cycle.min must be >0');
}
- if (('max' in leg.cycle) && leg.cycle.max !== null) {
- a.strictEqual(typeof leg.cycle.max, 'number', name + '.cycle.max must be a number')
- a.ok(leg.cycle.max > 0, name + '.cycle.max must be >0')
+ if ('max' in leg.cycle && leg.cycle.max !== null) {
+ a.strictEqual(typeof leg.cycle.max, 'number', name + '.cycle.max must be a number');
+ a.ok(leg.cycle.max > 0, name + '.cycle.max must be >0');
}
- if (('nr' in leg.cycle) && leg.cycle.nr !== null) {
- a.strictEqual(typeof leg.cycle.nr, 'number', name + '.cycle.nr must be a number')
- a.ok(leg.cycle.nr > 0, name + '.cycle.nr must be >0')
+ if ('nr' in leg.cycle && leg.cycle.nr !== null) {
+ a.strictEqual(typeof leg.cycle.nr, 'number', name + '.cycle.nr must be a number');
+ a.ok(leg.cycle.nr > 0, name + '.cycle.nr must be >0');
}
}
if ('alternatives' in leg) {
- const as = leg.alternatives
- a.ok(Array.isArray(as), name + '.alternatives must be an array')
+ const as = leg.alternatives;
+ a.ok(Array.isArray(as), name + '.alternatives must be an array');
for (let i = 0; i < as.length; i++) {
- const alt = leg.alternatives[i]
- const n = name + `.alternatives[${i}]`
+ const alt = leg.alternatives[i];
+ const n = name + `.alternatives[${i}]`;
- a.ok(isObj(alt), n + ' must be an object')
+ a.ok(isObj(alt), n + ' must be an object');
// todo: when, delay
- val.line(val, alt.line, n + '.line')
+ val.line(val, alt.line, n + '.line');
if (alt.direction !== null) {
- a.strictEqual(typeof alt.direction, 'string', n + '.direction must be a string')
- a.ok(alt.direction, n + '.direction must not be empty')
+ a.strictEqual(typeof alt.direction, 'string', n + '.direction must be a string');
+ a.ok(alt.direction, n + '.direction must not be empty');
}
if (alt.when !== null) {
- assertValidWhen(alt.when, cfg.when, n + '.when')
+ assertValidWhen(alt.when, cfg.when, n + '.when');
}
if (alt.delay !== null) {
- a.strictEqual(typeof alt.delay, 'number', n + '.delay must be a number')
+ a.strictEqual(typeof alt.delay, 'number', n + '.delay must be a number');
}
}
}
// todo: validate polyline
- }
- return validateJourneyLeg
-}
+ };
+ return validateJourneyLeg;
+};
const validateJourney = (val, j, name = 'journey') => {
const withFakeId = Object.assign({
- id: 'foo' // todo: let hafas-client parse a journey ID
- }, j)
- defaultValidators.journey(val, withFakeId, name)
+ id: 'foo', // todo: let hafas-client parse a journey ID
+ }, j);
+ defaultValidators.journey(val, withFakeId, name);
// todo: j.refreshToken
if ('tickets' in j) {
- a.ok(Array.isArray(j.tickets), name + '.tickets must be an array')
- a.ok(j.tickets.length > 0, name + '.tickets must not be empty')
+ a.ok(Array.isArray(j.tickets), name + '.tickets must be an array');
+ a.ok(j.tickets.length > 0, name + '.tickets must not be empty');
for (let i = 0; i < j.tickets.length; i++) {
- val.ticket(val, j.tickets[i], name + `.tickets[${i}]`)
+ val.ticket(val, j.tickets[i], name + `.tickets[${i}]`);
}
}
-}
-const createValidateJourney = () => validateJourney
+};
+const createValidateJourney = () => validateJourney;
const validateJourneys = (val, js, name = 'journeys') => {
- a.ok(Array.isArray(js), name + ' must be an array')
- a.ok(js.length > 0, name + ' must not be empty')
+ a.ok(Array.isArray(js), name + ' must be an array');
+ a.ok(js.length > 0, name + ' must not be empty');
for (let i = 0; i < js.length; i++) {
- val.journey(val, js[i], name + `[${i}]`)
+ val.journey(val, js[i], name + `[${i}]`);
}
-}
-const createValidateJourneys = () => validateJourneys
+};
+const createValidateJourneys = () => validateJourneys;
const validateJourneysResult = (val, res, name = 'journeysResult') => {
- a.ok(isObj(res), name + ' must be an object')
+ a.ok(isObj(res), name + ' must be an object');
// todo: `earlierRef`, `laterRef`
- val.journeys(val, res.journeys, name + '.journeys')
+ val.journeys(val, res.journeys, name + '.journeys');
- val.realtimeDataUpdatedAt(val, res.realtimeDataUpdatedAt, name + '.realtimeDataUpdatedAt')
-}
-const createValidateJourneysResult = () => validateJourneysResult
+ val.realtimeDataUpdatedAt(val, res.realtimeDataUpdatedAt, name + '.realtimeDataUpdatedAt');
+};
+const createValidateJourneysResult = () => validateJourneysResult;
const validateRefreshJourneyResult = (val, res, name = 'refreshJourneyResult') => {
- a.ok(isObj(res), name + ' must be an object')
+ a.ok(isObj(res), name + ' must be an object');
- val.realtimeDataUpdatedAt(val, res.realtimeDataUpdatedAt, name + '.realtimeDataUpdatedAt')
+ val.realtimeDataUpdatedAt(val, res.realtimeDataUpdatedAt, name + '.realtimeDataUpdatedAt');
- val.journey(val, res.journey, name + '.journey')
-}
-const createValidateRefreshJourneyResult = () => validateRefreshJourneyResult
+ val.journey(val, res.journey, name + '.journey');
+};
+const createValidateRefreshJourneyResult = () => validateRefreshJourneyResult;
const validateTrip = (val, trip, name = 'trip') => {
const withFakeTripId = Object.assign({
- tripId: trip.id
- }, trip)
- delete withFakeTripId.id
- val.journeyLeg(val, withFakeTripId, name)
-}
-const createValidateTrip = () => validateTrip
+ tripId: trip.id,
+ }, trip);
+ delete withFakeTripId.id;
+ val.journeyLeg(val, withFakeTripId, name);
+};
+const createValidateTrip = () => validateTrip;
const validateTripResult = (val, res, name = 'tripResult') => {
- a.ok(isObj(res), name + ' must be an object')
+ a.ok(isObj(res), name + ' must be an object');
- val.trip(val, res.trip, name + '.trip')
+ val.trip(val, res.trip, name + '.trip');
- val.realtimeDataUpdatedAt(val, res.realtimeDataUpdatedAt, name + '.realtimeDataUpdatedAt')
-}
-const createValidateTripResult = () => validateTripResult
+ val.realtimeDataUpdatedAt(val, res.realtimeDataUpdatedAt, name + '.realtimeDataUpdatedAt');
+};
+const createValidateTripResult = () => validateTripResult;
const validateTripsByNameResult = (val, res, name = 'tripsByNameResult') => {
- a.ok(isObj(res), name + ' must be an object')
+ a.ok(isObj(res), name + ' must be an object');
- a.ok(Array.isArray(res.trips), name + '.trips must be an array')
- a.ok(res.trips.length > 0, name + '.trips must not be empty')
+ a.ok(Array.isArray(res.trips), name + '.trips must be an array');
+ a.ok(res.trips.length > 0, name + '.trips must not be empty');
for (let i = 0; i < res.trips.length; i++) {
- val.trip(val, res.trips[i], `${name}.trips[${i}]`)
+ val.trip(val, res.trips[i], `${name}.trips[${i}]`);
}
- val.realtimeDataUpdatedAt(val, res.realtimeDataUpdatedAt, name + '.realtimeDataUpdatedAt')
-}
-const createValidateTripsByNameResult = () => validateTripsByNameResult
+ val.realtimeDataUpdatedAt(val, res.realtimeDataUpdatedAt, name + '.realtimeDataUpdatedAt');
+};
+const createValidateTripsByNameResult = () => validateTripsByNameResult;
const createValidateArrivalOrDeparture = (type, cfg) => {
- if (type !== 'arrival' && type !== 'departure') throw new Error('invalid type')
+ if (type !== 'arrival' && type !== 'departure') {
+ throw new Error('invalid type');
+ }
const validateArrivalOrDeparture = (val, dep, name = 'arrOrDep') => {
- a.ok(isObj(dep), name + ' must be an object')
+ a.ok(isObj(dep), name + ' must be an object');
// todo: let hafas-client add a .type field
- a.strictEqual(typeof dep.tripId, 'string', name + '.tripId must be a string')
- a.ok(dep.tripId, name + '.tripId must not be empty')
+ a.strictEqual(typeof dep.tripId, 'string', name + '.tripId must be a string');
+ a.ok(dep.tripId, name + '.tripId must not be empty');
- anyOf(['stop', 'station'], val, dep.stop, name + '.stop')
+ anyOf(['stop', 'station'], val, dep.stop, name + '.stop');
- assertValidWhen(dep.when, cfg.when, name + '.when')
+ assertValidWhen(dep.when, cfg.when, name + '.when');
if (dep.delay !== null) {
- const msg = name + '.delay must be a number'
- a.strictEqual(typeof dep.delay, 'number', msg)
+ const msg = name + '.delay must be a number';
+ a.strictEqual(typeof dep.delay, 'number', msg);
}
if (dep.platform !== null) {
- const msg = name + '.platform must '
- a.strictEqual(typeof dep.platform, 'string', msg + 'be a string')
- a.ok(dep.platform, name + 'not be empty')
+ const msg = name + '.platform must ';
+ a.strictEqual(typeof dep.platform, 'string', msg + 'be a string');
+ a.ok(dep.platform, name + 'not be empty');
}
- val.line(val, dep.line, name + '.line')
+ val.line(val, dep.line, name + '.line');
if (type === 'departure') {
- const n = name + '.direction'
- a.strictEqual(typeof dep.direction, 'string', n + ' must be a string')
- a.ok(dep.direction, n + ' must not be empty')
+ const n = name + '.direction';
+ a.strictEqual(typeof dep.direction, 'string', n + ' must be a string');
+ a.ok(dep.direction, n + ' must not be empty');
}
if (dep.destination !== null) {
- const lName = name + '.destination'
- val.location(val, dep.destination, lName)
+ const lName = name + '.destination';
+ val.location(val, dep.destination, lName);
}
if (dep.origin !== null) {
- const lName = name + '.origin'
- val.location(val, dep.origin, lName)
+ const lName = name + '.origin';
+ val.location(val, dep.origin, lName);
}
- }
- return validateArrivalOrDeparture
-}
+ };
+ return validateArrivalOrDeparture;
+};
const createValidateArrival = (cfg) => {
- const validate = createValidateArrivalOrDeparture('arrival', cfg)
+ const validate = createValidateArrivalOrDeparture('arrival', cfg);
return (val, arr, name = 'arrival') => {
- validate(val, arr, name)
+ validate(val, arr, name);
if ('previousStopovers' in arr) {
- const n = name + '.previousStopovers'
- a.ok(Array.isArray(arr.previousStopovers), n + ' must be an array')
+ const n = name + '.previousStopovers';
+ a.ok(Array.isArray(arr.previousStopovers), n + ' must be an array');
for (let i = 0; i < arr.previousStopovers.length; i++) {
- val.stopover(val, arr.previousStopovers[i], n + `[${i}]`)
+ val.stopover(val, arr.previousStopovers[i], n + `[${i}]`);
}
}
- }
-}
+ };
+};
const createValidateDeparture = (cfg) => {
- const validate = createValidateArrivalOrDeparture('departure', cfg)
+ const validate = createValidateArrivalOrDeparture('departure', cfg);
return (val, dep, name = 'departure') => {
- validate(val, dep, name)
+ validate(val, dep, name);
if ('nextStopovers' in dep) {
- const n = name + '.nextStopovers'
- a.ok(Array.isArray(dep.nextStopovers), n + ' must be an array')
+ const n = name + '.nextStopovers';
+ a.ok(Array.isArray(dep.nextStopovers), n + ' must be an array');
for (let i = 0; i < dep.nextStopovers.length; i++) {
- val.stopover(val, dep.nextStopovers[i], n + `[${i}]`)
+ val.stopover(val, dep.nextStopovers[i], n + `[${i}]`);
}
}
- }
-}
+ };
+};
const _createValidateStationBoardResults = (cfg, validatorsKey) => {
const validateStationBoardResults = (val, arrsOrDeps, name) => {
- a.ok(Array.isArray(arrsOrDeps), name + ' must be an array')
- a.ok(arrsOrDeps.length > 0, name + ' must not be empty')
+ a.ok(Array.isArray(arrsOrDeps), name + ' must be an array');
+ a.ok(arrsOrDeps.length > 0, name + ' must not be empty');
for (let i = 0; i < arrsOrDeps.length; i++) {
- val[validatorsKey](val, arrsOrDeps[i], name + `[${i}]`)
+ val[validatorsKey](val, arrsOrDeps[i], name + `[${i}]`);
}
- }
- return validateStationBoardResults
-}
+ };
+ return validateStationBoardResults;
+};
const createValidateArrivals = (cfg) => {
- return _createValidateStationBoardResults(cfg, 'arrival')
-}
+ return _createValidateStationBoardResults(cfg, 'arrival');
+};
const createValidateDepartures = (cfg) => {
- return _createValidateStationBoardResults(cfg, 'departure')
-}
+ return _createValidateStationBoardResults(cfg, 'departure');
+};
const _createValidateStationBoardResponse = (cfg, validatorsKey, arrsOrDepsKey) => {
const _validateStationBoardResponse = (val, res, name) => {
- a.ok(isObj(res), name + ' must be an object')
+ a.ok(isObj(res), name + ' must be an object');
- val.realtimeDataUpdatedAt(val, res.realtimeDataUpdatedAt, name + '.realtimeDataUpdatedAt')
+ val.realtimeDataUpdatedAt(val, res.realtimeDataUpdatedAt, name + '.realtimeDataUpdatedAt');
- const arrsOrDeps = res[arrsOrDepsKey]
- val[validatorsKey](val, arrsOrDeps, `${name}.${arrsOrDepsKey}`)
- }
- return _validateStationBoardResponse
-}
+ const arrsOrDeps = res[arrsOrDepsKey];
+ val[validatorsKey](val, arrsOrDeps, `${name}.${arrsOrDepsKey}`);
+ };
+ return _validateStationBoardResponse;
+};
const createValidateArrivalsResponse = (cfg) => {
- return _createValidateStationBoardResponse(cfg, 'arrivals', 'arrivals')
-}
+ return _createValidateStationBoardResponse(cfg, 'arrivals', 'arrivals');
+};
const createValidateDeparturesResponse = (cfg) => {
- return _createValidateStationBoardResponse(cfg, 'departures', 'departures')
-}
+ return _createValidateStationBoardResponse(cfg, 'departures', 'departures');
+};
const createValidateMovement = (cfg) => {
- const { maxLatitude, minLatitude, maxLongitude, minLongitude } = cfg
+ const {maxLatitude, minLatitude, maxLongitude, minLongitude} = cfg;
const validateMovement = (val, m, name = 'movement') => {
- a.ok(isObj(m), name + ' must be an object')
+ a.ok(isObj(m), name + ' must be an object');
// todo: let hafas-client add a .type field
- val.line(val, m.line, name + '.line')
- a.strictEqual(typeof m.direction, 'string', name + '.direction must be a string')
- a.ok(m.direction, name + '.direction must not be empty')
+ val.line(val, m.line, name + '.line');
+ a.strictEqual(typeof m.direction, 'string', name + '.direction must be a string');
+ a.ok(m.direction, name + '.direction must not be empty');
- const lName = name + '.location'
- val.location(val, m.location, lName)
- const s = `${m.location.latitude}|${m.location.longitude} ${m.line && m.line.name}`
+ const lName = name + '.location';
+ val.location(val, m.location, lName);
+ const s = `${m.location.latitude}|${m.location.longitude} ${m.line && m.line.name}`;
if ('number' === typeof maxLatitude) {
- a.ok(m.location.latitude <= maxLatitude, lName + '.latitude is too large: ' + s)
+ a.ok(m.location.latitude <= maxLatitude, lName + '.latitude is too large: ' + s);
}
if ('number' === typeof minLatitude) {
- a.ok(m.location.latitude >= minLatitude, lName + '.latitude is too small: ' + s)
+ a.ok(m.location.latitude >= minLatitude, lName + '.latitude is too small: ' + s);
}
if ('number' === typeof maxLongitude) {
- a.ok(m.location.longitude <= maxLongitude, lName + '.longitude is too large: ' + s)
+ a.ok(m.location.longitude <= maxLongitude, lName + '.longitude is too large: ' + s);
}
if ('number' === typeof minLongitude) {
- a.ok(m.location.longitude >= minLongitude, lName + '.longitude is too small: ' + s)
+ a.ok(m.location.longitude >= minLongitude, lName + '.longitude is too small: ' + s);
}
- a.ok(Array.isArray(m.nextStopovers), name + '.nextStopovers must be an array')
+ a.ok(Array.isArray(m.nextStopovers), name + '.nextStopovers must be an array');
for (let i = 0; i < m.nextStopovers.length; i++) {
- const st = m.nextStopovers[i]
- val.stopover(val, st, name + `.nextStopovers[${i}]`)
+ const st = m.nextStopovers[i];
+ val.stopover(val, st, name + `.nextStopovers[${i}]`);
}
- a.ok(Array.isArray(m.frames), name + '.frames must be an array')
- a.ok(m.frames.length > 0, name + '.frames must not be empty')
+ a.ok(Array.isArray(m.frames), name + '.frames must be an array');
+ a.ok(m.frames.length > 0, name + '.frames must not be empty');
for (let i = 0; i < m.frames.length; i++) {
- const f = m.frames[i]
- const fName = name + `.frames[${i}]`
+ const f = m.frames[i];
+ const fName = name + `.frames[${i}]`;
- a.ok(isObj(f), fName + ' must be an object')
- anyOf(['location', 'stop', 'station'], val, f.origin, fName + '.origin')
- anyOf(['location', 'stop', 'station'], val, f.destination, fName + '.destination')
- a.strictEqual(typeof f.t, 'number', fName + '.frames must be a number')
+ a.ok(isObj(f), fName + ' must be an object');
+ anyOf(['location', 'stop', 'station'], val, f.origin, fName + '.origin');
+ anyOf(['location', 'stop', 'station'], val, f.destination, fName + '.destination');
+ a.strictEqual(typeof f.t, 'number', fName + '.frames must be a number');
}
// todo: validate polyline
- }
- return validateMovement
-}
+ };
+ return validateMovement;
+};
const validateMovements = (val, ms, name = 'movements') => {
- a.ok(Array.isArray(ms), name + ' must be an array')
- a.ok(ms.length > 0, name + ' must not be empty')
+ a.ok(Array.isArray(ms), name + ' must be an array');
+ a.ok(ms.length > 0, name + ' must not be empty');
for (let i = 0; i < ms.length; i++) {
- val.movement(val, ms[i], name + `[${i}]`)
+ val.movement(val, ms[i], name + `[${i}]`);
}
-}
-const createValidateMovements = () => validateMovements
+};
+const createValidateMovements = () => validateMovements;
const validateRadarResult = (val, res, name = 'movementsResult') => {
- a.ok(isObj(res), name + ' must be an object')
+ a.ok(isObj(res), name + ' must be an object');
- val.movements(val, res.movements, name + '.movements')
+ val.movements(val, res.movements, name + '.movements');
- val.realtimeDataUpdatedAt(val, res.realtimeDataUpdatedAt, name + '.realtimeDataUpdatedAt')
-}
-const createValidateRadarResult = () => validateRadarResult
+ val.realtimeDataUpdatedAt(val, res.realtimeDataUpdatedAt, name + '.realtimeDataUpdatedAt');
+};
+const createValidateRadarResult = () => validateRadarResult;
export {
createValidateRealtimeDataUpdatedAt,
@@ -686,7 +693,7 @@ export {
createValidateMovement,
createValidateMovements,
createValidateRadarResult,
-}
+};
export default {
realtimeDataUpdatedAt: createValidateRealtimeDataUpdatedAt,
@@ -718,4 +725,4 @@ export default {
movement: createValidateMovement,
movements: createValidateMovements,
radarResult: createValidateRadarResult,
-}
+};
diff --git a/test/e2e/lib/vbb-bvg-validators.js b/test/e2e/lib/vbb-bvg-validators.js
index 2288064a..2d9226b0 100644
--- a/test/e2e/lib/vbb-bvg-validators.js
+++ b/test/e2e/lib/vbb-bvg-validators.js
@@ -1,37 +1,37 @@
-import {products} from '../../../p/bvg/products.js'
+import {products} from '../../../p/bvg/products.js';
import {
createValidateStation,
createValidateJourneyLeg,
createValidateDeparture,
createValidateMovement,
-} from './validators.js'
+} from './validators.js';
const createVbbBvgValidators = ({when}) => {
const cfg = {
when,
stationCoordsOptional: false,
- products
- }
+ products,
+ };
// todo: coordsOptional = false
- const validateStation = createValidateStation(cfg)
+ const validateStation = createValidateStation(cfg);
- const validateJourneyLeg = createValidateJourneyLeg(cfg)
+ const validateJourneyLeg = createValidateJourneyLeg(cfg);
- const validateDeparture = createValidateDeparture(cfg)
+ const validateDeparture = createValidateDeparture(cfg);
- const validateMovement = createValidateMovement(cfg)
+ const validateMovement = createValidateMovement(cfg);
return {
cfg,
validateStation,
validateJourneyLeg,
validateDeparture,
- validateMovement
- }
-}
+ validateMovement,
+ };
+};
export {
createVbbBvgValidators,
-}
+};
diff --git a/test/e2e/mobil-nrw.js b/test/e2e/mobil-nrw.js
index df61495c..04139807 100644
--- a/test/e2e/mobil-nrw.js
+++ b/test/e2e/mobil-nrw.js
@@ -1,20 +1,20 @@
-import tap from 'tap'
+import tap from 'tap';
-import {createWhen} from './lib/util.js'
-import {createClient} from '../../index.js'
-import {profile as mobilNrwProfile} from '../../p/mobil-nrw/index.js'
-import {createValidateFptfWith as createValidate} from './lib/validate-fptf-with.js'
-import {testJourneysStationToStation} from './lib/journeys-station-to-station.js'
-import {testJourneysStationToAddress} from './lib/journeys-station-to-address.js'
-import {testJourneysStationToPoi} from './lib/journeys-station-to-poi.js'
-import {testEarlierLaterJourneys} from './lib/earlier-later-journeys.js'
-import {testRefreshJourney} from './lib/refresh-journey.js'
-import {testDepartures} from './lib/departures.js'
-import {testArrivals} from './lib/arrivals.js'
-import {testReachableFrom} from './lib/reachable-from.js'
+import {createWhen} from './lib/util.js';
+import {createClient} from '../../index.js';
+import {profile as mobilNrwProfile} from '../../p/mobil-nrw/index.js';
+import {createValidateFptfWith as createValidate} from './lib/validate-fptf-with.js';
+import {testJourneysStationToStation} from './lib/journeys-station-to-station.js';
+import {testJourneysStationToAddress} from './lib/journeys-station-to-address.js';
+import {testJourneysStationToPoi} from './lib/journeys-station-to-poi.js';
+import {testEarlierLaterJourneys} from './lib/earlier-later-journeys.js';
+import {testRefreshJourney} from './lib/refresh-journey.js';
+import {testDepartures} from './lib/departures.js';
+import {testArrivals} from './lib/arrivals.js';
+import {testReachableFrom} from './lib/reachable-from.js';
-const T_MOCK = 1671260400 * 1000 // 2022-12-17T08:00:00+01:00
-const when = createWhen(mobilNrwProfile.timezone, mobilNrwProfile.locale, T_MOCK)
+const T_MOCK = 1671260400 * 1000; // 2022-12-17T08:00:00+01:00
+const when = createWhen(mobilNrwProfile.timezone, mobilNrwProfile.locale, T_MOCK);
const cfg = {
when,
@@ -24,32 +24,32 @@ const cfg = {
minLongitude: 1.659,
maxLatitude: 53.531,
maxLongitude: 14.689,
-}
+};
-const validate = createValidate(cfg)
+const validate = createValidate(cfg);
-const client = createClient(mobilNrwProfile, 'public-transport/hafas-client:test')
+const client = createClient(mobilNrwProfile, 'public-transport/hafas-client:test');
-const soest = '8000076'
-const aachenHbf = '8000001'
-const dortmundStadtgarten = '655672'
+const soest = '8000076';
+const aachenHbf = '8000001';
+const dortmundStadtgarten = '655672';
tap.test('journeys – Soest to Aachen Hbf', async (t) => {
const res = await client.journeys(soest, aachenHbf, {
results: 4,
departure: when,
- stopovers: true
- })
+ stopovers: true,
+ });
await testJourneysStationToStation({
test: t,
res,
validate,
fromId: soest,
- toId: aachenHbf
- })
- t.end()
-})
+ toId: aachenHbf,
+ });
+ t.end();
+});
// todo: journeys, only one product
@@ -60,22 +60,22 @@ tap.test('Aachen Hbf to Schillingstr. 3, Dortmund', async (t) => {
address: 'Dortmund - Mitte, Schillingstraße 3',
latitude: 51.504891,
longitude: 7.457802,
- }
+ };
const res = await client.journeys(aachenHbf, schillingstr3, {
results: 3,
- departure: when
- })
+ departure: when,
+ });
await testJourneysStationToAddress({
test: t,
res,
validate,
fromId: aachenHbf,
- to: schillingstr3
- })
- t.end()
-})
+ to: schillingstr3,
+ });
+ t.end();
+});
tap.test('Aachen Hbf to Sportanlage Schulzentrum, Dortmund', async (t) => {
const sportanlage = {
@@ -85,21 +85,21 @@ tap.test('Aachen Hbf to Sportanlage Schulzentrum, Dortmund', async (t) => {
name: 'Dortmund, Sportanlage Schulzentrum (Grünanlagen)',
latitude: 51.491201,
longitude: 7.562859,
- }
+ };
const res = await client.journeys(aachenHbf, sportanlage, {
results: 3,
- departure: when
- })
+ departure: when,
+ });
await testJourneysStationToPoi({
test: t,
res,
validate,
fromId: aachenHbf,
- to: sportanlage
- })
- t.end()
-})
+ to: sportanlage,
+ });
+ t.end();
+});
// todo: walkingSpeed "2107 MELRIDGE PL" -> 000002148
// todo: via works – with detour
@@ -112,11 +112,11 @@ tap.test('earlier/later journeys', async (t) => {
validate,
fromId: soest,
toId: aachenHbf,
- when
- })
+ when,
+ });
- t.end()
-})
+ t.end();
+});
tap.test('refreshJourney', async (t) => {
await testRefreshJourney({
@@ -126,25 +126,25 @@ tap.test('refreshJourney', async (t) => {
validate,
fromId: soest,
toId: aachenHbf,
- when
- })
- t.end()
-})
+ when,
+ });
+ t.end();
+});
tap.test('trip details', async (t) => {
const res = await client.journeys(soest, aachenHbf, {
- results: 1, departure: when
- })
+ results: 1, departure: when,
+ });
- const p = res.journeys[0].legs.find(l => !l.walking)
- t.ok(p.tripId, 'precondition failed')
- t.ok(p.line.name, 'precondition failed')
+ const p = res.journeys[0].legs.find(l => !l.walking);
+ t.ok(p.tripId, 'precondition failed');
+ t.ok(p.line.name, 'precondition failed');
- const tripRes = await client.trip(p.tripId, {when})
+ const tripRes = await client.trip(p.tripId, {when});
- validate(t, tripRes, 'tripResult', 'res')
- t.end()
-})
+ validate(t, tripRes, 'tripResult', 'res');
+ t.end();
+});
tap.test('departures at Soest', async (t) => {
const ids = [
@@ -152,20 +152,20 @@ tap.test('departures at Soest', async (t) => {
'906135', // Bahnhof, Soest
'904812', // Bahnhof/Brüdertor, Soest
'902737', // Bahnhof E, Soest
- ]
+ ];
const res = await client.departures(soest, {
duration: 10, when,
- })
+ });
await testDepartures({
test: t,
res,
validate,
ids,
- })
- t.end()
-})
+ });
+ t.end();
+});
tap.test('departures with station object', async (t) => {
const res = await client.departures({
@@ -175,13 +175,13 @@ tap.test('departures with station object', async (t) => {
location: {
type: 'location',
latitude: 1.23,
- longitude: 2.34
- }
- }, {when})
+ longitude: 2.34,
+ },
+ }, {when});
- validate(t, res, 'departuresResponse', 'res')
- t.end()
-})
+ validate(t, res, 'departuresResponse', 'res');
+ t.end();
+});
tap.test('arrivals at Soest', async (t) => {
const ids = [
@@ -189,48 +189,48 @@ tap.test('arrivals at Soest', async (t) => {
'906135', // Bahnhof, Soest
'904812', // Bahnhof/Brüdertor, Soest
'902737', // Bahnhof E, Soest
- ]
+ ];
const res = await client.arrivals(soest, {
duration: 10, when,
- })
+ });
await testArrivals({
test: t,
res,
validate,
ids,
- })
- t.end()
-})
+ });
+ t.end();
+});
// todo: nearby
tap.test('locations named "stadtgarten dortmund"', async (t) => {
const locations = await client.locations('stadtgarten dortmund', {
results: 10,
- })
+ });
- validate(t, locations, 'locations', 'locations')
- t.ok(locations.length <= 10)
+ validate(t, locations, 'locations', 'locations');
+ t.ok(locations.length <= 10);
- t.ok(locations.find(s => s.type === 'stop' || s.type === 'station'))
- t.ok(locations.find(s => s.poi)) // POIs
+ t.ok(locations.find(s => s.type === 'stop' || s.type === 'station'));
+ t.ok(locations.find(s => s.poi)); // POIs
t.ok(locations.some((l) => {
- return l.station && l.station.id === dortmundStadtgarten || l.id === dortmundStadtgarten
- }))
+ return l.station && l.station.id === dortmundStadtgarten || l.id === dortmundStadtgarten;
+ }));
- t.end()
-})
+ t.end();
+});
tap.test('station Aachen Hbf', async (t) => {
- const s = await client.stop(aachenHbf)
+ const s = await client.stop(aachenHbf);
- validate(t, s, ['stop', 'station'], 'station')
- t.equal(s.id, aachenHbf)
+ validate(t, s, ['stop', 'station'], 'station');
+ t.equal(s.id, aachenHbf);
- t.end()
-})
+ t.end();
+});
tap.test('radar', async (t) => {
const res = await client.radar({
@@ -240,11 +240,11 @@ tap.test('radar', async (t) => {
east: 6.7900,
}, {
duration: 5 * 60, when, results: 10,
- })
+ });
- validate(t, res, 'radarResult', 'res')
- t.end()
-})
+ validate(t, res, 'radarResult', 'res');
+ t.end();
+});
tap.test('reachableFrom', async (t) => {
await testReachableFrom({
@@ -259,7 +259,7 @@ tap.test('reachableFrom', async (t) => {
},
when,
maxDuration: 15,
- validate
- })
- t.end()
-})
+ validate,
+ });
+ t.end();
+});
diff --git a/test/e2e/mobiliteit-lu.js b/test/e2e/mobiliteit-lu.js
index 4481ce27..0a30d82c 100644
--- a/test/e2e/mobiliteit-lu.js
+++ b/test/e2e/mobiliteit-lu.js
@@ -1,26 +1,26 @@
-import tap from 'tap'
-import assert from 'assert'
-import isRoughlyEqual from 'is-roughly-equal'
+import tap from 'tap';
+import assert from 'assert';
+import isRoughlyEqual from 'is-roughly-equal';
-import {createWhen} from './lib/util.js'
-import {createClient} from '../../index.js'
-import {profile as mobiliteitLuProfile} from '../../p/mobiliteit-lu/index.js'
+import {createWhen} from './lib/util.js';
+import {createClient} from '../../index.js';
+import {profile as mobiliteitLuProfile} from '../../p/mobiliteit-lu/index.js';
import {
createValidateLine,
createValidateJourneyLeg,
createValidateMovement,
-} from './lib/validators.js'
-import {createValidateFptfWith as createValidate} from './lib/validate-fptf-with.js'
-import {testJourneysStationToStation} from './lib/journeys-station-to-station.js'
-import {testJourneysStationToAddress} from './lib/journeys-station-to-address.js'
-import {testJourneysStationToPoi} from './lib/journeys-station-to-poi.js'
-import {testEarlierLaterJourneys} from './lib/earlier-later-journeys.js'
-import {journeysFailsWithNoProduct} from './lib/journeys-fails-with-no-product.js'
-import {testDepartures} from './lib/departures.js'
-import {testArrivals} from './lib/arrivals.js'
+} from './lib/validators.js';
+import {createValidateFptfWith as createValidate} from './lib/validate-fptf-with.js';
+import {testJourneysStationToStation} from './lib/journeys-station-to-station.js';
+import {testJourneysStationToAddress} from './lib/journeys-station-to-address.js';
+import {testJourneysStationToPoi} from './lib/journeys-station-to-poi.js';
+import {testEarlierLaterJourneys} from './lib/earlier-later-journeys.js';
+import {journeysFailsWithNoProduct} from './lib/journeys-fails-with-no-product.js';
+import {testDepartures} from './lib/departures.js';
+import {testArrivals} from './lib/arrivals.js';
-const T_MOCK = 1668495600 * 1000 // 2022-11-15T08:00:00+01:00
-const when = createWhen(mobiliteitLuProfile.timezone, mobiliteitLuProfile.locale, T_MOCK)
+const T_MOCK = 1668495600 * 1000; // 2022-11-15T08:00:00+01:00
+const when = createWhen(mobiliteitLuProfile.timezone, mobiliteitLuProfile.locale, T_MOCK);
const cfg = {
when,
@@ -28,55 +28,59 @@ const cfg = {
minLatitude: 47.24,
maxLatitude: 52.9,
minLongitude: -0.63,
- maxLongitude: 14.07
-}
+ maxLongitude: 14.07,
+};
-const _validateLine = createValidateLine(cfg)
+const _validateLine = createValidateLine(cfg);
const validateLine = (validate, l, name) => {
- if (!l.direction) l = Object.assign({}, l, {direction: 'foo'})
- _validateLine(validate, l, name)
-}
+ if (!l.direction) {
+ l = Object.assign({}, l, {direction: 'foo'});
+ }
+ _validateLine(validate, l, name);
+};
-const _validateJourneyLeg = createValidateJourneyLeg(cfg)
+const _validateJourneyLeg = createValidateJourneyLeg(cfg);
const validateJourneyLeg = (validate, l, name) => {
- if (!l.direction) l = Object.assign({}, l, {direction: 'foo'})
- _validateJourneyLeg(validate, l, name)
-}
+ if (!l.direction) {
+ l = Object.assign({}, l, {direction: 'foo'});
+ }
+ _validateJourneyLeg(validate, l, name);
+};
-const _validateMovement = createValidateMovement(cfg)
+const _validateMovement = createValidateMovement(cfg);
const validateMovement = (val, m, name = 'movement') => {
// todo: fix this upstream
- const withFakeLocation = Object.assign({}, m)
+ const withFakeLocation = Object.assign({}, m);
withFakeLocation.location = Object.assign({}, m.location, {
latitude: 50,
- longitude: 12
- })
- _validateMovement(val, withFakeLocation, name)
+ longitude: 12,
+ });
+ _validateMovement(val, withFakeLocation, name);
- assert.ok(m.location.latitude <= 55, name + '.location.latitude is too small')
- assert.ok(m.location.latitude >= 45, name + '.location.latitude is too large')
- assert.ok(m.location.longitude >= 1, name + '.location.longitude is too small')
- assert.ok(m.location.longitude <= 11, name + '.location.longitude is too small')
-}
+ assert.ok(m.location.latitude <= 55, name + '.location.latitude is too small');
+ assert.ok(m.location.latitude >= 45, name + '.location.latitude is too large');
+ assert.ok(m.location.longitude >= 1, name + '.location.longitude is too small');
+ assert.ok(m.location.longitude <= 11, name + '.location.longitude is too small');
+};
const validate = createValidate(cfg, {
line: validateLine,
journeyLeg: validateJourneyLeg,
- movement: validateMovement
-})
+ movement: validateMovement,
+});
-const client = createClient(mobiliteitLuProfile, 'public-transport/hafas-client:test')
+const client = createClient(mobiliteitLuProfile, 'public-transport/hafas-client:test');
-const ettelbruck = '140701016'
-const mersch = '160904011'
-const luxembourgGareCentrale = '200405060'
+const ettelbruck = '140701016';
+const mersch = '160904011';
+const luxembourgGareCentrale = '200405060';
tap.test('journeys – Ettelbruck to Luxembourg', async (t) => {
const res = await client.journeys(ettelbruck, luxembourgGareCentrale, {
results: 4,
departure: when,
- stopovers: true
- })
+ stopovers: true,
+ });
await testJourneysStationToStation({
test: t,
@@ -88,9 +92,9 @@ tap.test('journeys – Ettelbruck to Luxembourg', async (t) => {
'300030001', // Luxembourg, Gare Centrale (Tram)
'300032002', // Luxembourg, Gare Rocade
],
- })
- t.end()
-})
+ });
+ t.end();
+});
// todo: journeys, only one product
@@ -102,32 +106,32 @@ tap.test('journeys – fails with no product', async (t) => {
toId: luxembourgGareCentrale,
when,
products: mobiliteitLuProfile.products,
- })
- t.end()
-})
+ });
+ t.end();
+});
tap.test('Luxembourg to Ettelbruck, Rue des Romains 4', async (t) => {
const rueDeRomain = {
type: 'location',
address: 'Ettelbruck, Rue des Romains 4',
latitude: 49.847469,
- longitude: 6.097608
- }
+ longitude: 6.097608,
+ };
const res = await client.journeys(luxembourgGareCentrale, rueDeRomain, {
results: 3,
- departure: when
- })
+ departure: when,
+ });
await testJourneysStationToAddress({
test: t,
res,
validate,
fromId: luxembourgGareCentrale,
- to: rueDeRomain
- })
- t.end()
-})
+ to: rueDeRomain,
+ });
+ t.end();
+});
// Some journeys don't start or stop at the stop/POI that we queried journeys for.
tap.test('Luxembourg to Centre Hospitalier du Nord', async (t) => {
@@ -138,21 +142,21 @@ tap.test('Luxembourg to Centre Hospitalier du Nord', async (t) => {
name: 'Ettelbruck, Centre Hospitalier du Nord (CHDN)',
latitude: 49.853519,
longitude: 6.094587,
- }
+ };
const res = await client.journeys(luxembourgGareCentrale, centreHospitalier, {
results: 3,
- departure: when
- })
+ departure: when,
+ });
await testJourneysStationToPoi({
test: t,
res,
validate,
fromId: luxembourgGareCentrale,
- to: centreHospitalier
- })
- t.end()
-})
+ to: centreHospitalier,
+ });
+ t.end();
+});
// todo: journeys: via works – with detour
// todo: without detour
@@ -165,53 +169,53 @@ tap.test('earlier/later journeys', async (t) => {
fromId: luxembourgGareCentrale,
toId: ettelbruck,
when,
- })
+ });
- t.end()
-})
+ t.end();
+});
tap.test('trip', async (t) => {
- const { journeys } = await client.journeys(luxembourgGareCentrale, ettelbruck, {
- results: 1, departure: when
- })
+ const {journeys} = await client.journeys(luxembourgGareCentrale, ettelbruck, {
+ results: 1, departure: when,
+ });
- const p = journeys[0].legs.find(l => !l.walking)
- t.ok(p.tripId, 'precondition failed')
- t.ok(p.line.name, 'precondition failed')
+ const p = journeys[0].legs.find(l => !l.walking);
+ t.ok(p.tripId, 'precondition failed');
+ t.ok(p.line.name, 'precondition failed');
- const tripRes = await client.trip(p.tripId, {when})
+ const tripRes = await client.trip(p.tripId, {when});
- validate(t, tripRes, 'tripResult', 'res')
- t.end()
-})
+ validate(t, tripRes, 'tripResult', 'res');
+ t.end();
+});
tap.test('departures at Ettelbruck.', async (t) => {
const res = await client.departures(ettelbruck, {
- duration: 20, when
- })
+ duration: 20, when,
+ });
await testDepartures({
test: t,
res,
validate,
- id: ettelbruck
- })
- t.end()
-})
+ id: ettelbruck,
+ });
+ t.end();
+});
tap.test('arrivals at Ettelbruck.', async (t) => {
const res = await client.arrivals(ettelbruck, {
- duration: 20, when
- })
+ duration: 20, when,
+ });
await testArrivals({
test: t,
res,
validate,
- id: ettelbruck
- })
- t.end()
-})
+ id: ettelbruck,
+ });
+ t.end();
+});
tap.test('departures with station object', async (t) => {
const res = await client.departures({
@@ -221,52 +225,54 @@ tap.test('departures with station object', async (t) => {
location: {
type: 'location',
latitude: 49.847298,
- longitude: 6.106157
- }
- }, {when})
+ longitude: 6.106157,
+ },
+ }, {when});
- validate(t, res, 'departuresResponse', 'res')
- t.end()
-})
+ validate(t, res, 'departuresResponse', 'res');
+ t.end();
+});
// todo: nearby
tap.test('locations named Mersch', async (t) => {
const locations = await client.locations('Mersch', {
- results: 20
- })
+ results: 20,
+ });
- validate(t, locations, 'locations', 'locations')
- t.ok(locations.length <= 20)
+ validate(t, locations, 'locations', 'locations');
+ t.ok(locations.length <= 20);
- t.ok(locations.find(s => s.type === 'stop' || s.type === 'station'))
+ t.ok(locations.find(s => s.type === 'stop' || s.type === 'station'));
t.ok(locations.some((loc) => {
- if (loc.station && loc.station.id === mersch) return true
- return loc.id === mersch
- }))
+ if (loc.station && loc.station.id === mersch) {
+ return true;
+ }
+ return loc.id === mersch;
+ }));
- t.end()
-})
+ t.end();
+});
tap.test('stop Mersch', async (t) => {
- const s = await client.stop(mersch)
+ const s = await client.stop(mersch);
- validate(t, s, ['stop', 'station'], 'stop')
- t.equal(s.id, mersch)
+ validate(t, s, ['stop', 'station'], 'stop');
+ t.equal(s.id, mersch);
- t.end()
-})
+ t.end();
+});
tap.test('radar', async (t) => {
const res = await client.radar({
north: 49.9,
west: 6.05,
south: 49.8,
- east: 6.15
+ east: 6.15,
}, {
- duration: 5 * 60, when, results: 10
- })
+ duration: 5 * 60, when, results: 10,
+ });
- validate(t, res, 'radarResult', 'res')
- t.end()
-})
+ validate(t, res, 'radarResult', 'res');
+ t.end();
+});
diff --git a/test/e2e/nahsh.js b/test/e2e/nahsh.js
index 0b9037c7..09e42ed0 100644
--- a/test/e2e/nahsh.js
+++ b/test/e2e/nahsh.js
@@ -1,28 +1,28 @@
-import tap from 'tap'
-import isRoughlyEqual from 'is-roughly-equal'
+import tap from 'tap';
+import isRoughlyEqual from 'is-roughly-equal';
-import {createWhen} from './lib/util.js'
-import {createClient} from '../../index.js'
-import {profile as nahshProfile} from '../../p/nahsh/index.js'
+import {createWhen} from './lib/util.js';
+import {createClient} from '../../index.js';
+import {profile as nahshProfile} from '../../p/nahsh/index.js';
import {
createValidateLine,
- createValidateStation
-} from './lib/validators.js'
-import {createValidateFptfWith as createValidate} from './lib/validate-fptf-with.js'
-import {testJourneysStationToStation} from './lib/journeys-station-to-station.js'
-import {testJourneysStationToAddress} from './lib/journeys-station-to-address.js'
-import {testJourneysStationToPoi} from './lib/journeys-station-to-poi.js'
-import {testEarlierLaterJourneys} from './lib/earlier-later-journeys.js'
-import {testRefreshJourney} from './lib/refresh-journey.js'
-import {journeysFailsWithNoProduct} from './lib/journeys-fails-with-no-product.js'
-import {testDepartures} from './lib/departures.js'
-import {testDeparturesInDirection} from './lib/departures-in-direction.js'
-import {testArrivals} from './lib/arrivals.js'
-import {testReachableFrom} from './lib/reachable-from.js'
+ createValidateStation,
+} from './lib/validators.js';
+import {createValidateFptfWith as createValidate} from './lib/validate-fptf-with.js';
+import {testJourneysStationToStation} from './lib/journeys-station-to-station.js';
+import {testJourneysStationToAddress} from './lib/journeys-station-to-address.js';
+import {testJourneysStationToPoi} from './lib/journeys-station-to-poi.js';
+import {testEarlierLaterJourneys} from './lib/earlier-later-journeys.js';
+import {testRefreshJourney} from './lib/refresh-journey.js';
+import {journeysFailsWithNoProduct} from './lib/journeys-fails-with-no-product.js';
+import {testDepartures} from './lib/departures.js';
+import {testDeparturesInDirection} from './lib/departures-in-direction.js';
+import {testArrivals} from './lib/arrivals.js';
+import {testReachableFrom} from './lib/reachable-from.js';
-const T_MOCK = 1670310000 * 1000 // 2022-12-06T08:00:00+01:00
+const T_MOCK = 1670310000 * 1000; // 2022-12-06T08:00:00+01:00
// const T_MOCK = 1668495600 * 1000 // 2022-11-15T08:00:00+01:00
-const when = createWhen(nahshProfile.timezone, nahshProfile.locale, T_MOCK)
+const when = createWhen(nahshProfile.timezone, nahshProfile.locale, T_MOCK);
const cfg = {
when,
@@ -31,72 +31,74 @@ const cfg = {
maxLatitude: 55.15,
minLongitude: 7.5,
minLatitude: 53.15,
- maxLongitude: 11.6
-}
+ maxLongitude: 11.6,
+};
-const _validateLine = createValidateLine(cfg)
+const _validateLine = createValidateLine(cfg);
const validateLine = (validate, l, name) => {
if (l && l.product === 'onCall') {
// skip line validation
// https://github.com/derhuerst/hafas-client/issues/8#issuecomment-355839965
- l = Object.assign({}, l)
- l.mode = 'taxi'
+ l = Object.assign({}, l);
+ l.mode = 'taxi';
}
- _validateLine(validate, l, name)
-}
+ _validateLine(validate, l, name);
+};
const validate = createValidate(cfg, {
- line: validateLine
-})
+ line: validateLine,
+});
const assertValidPrice = (t, p) => {
- t.ok(p)
+ t.ok(p);
if (p.amount !== null) {
- t.equal(typeof p.amount, 'number')
- t.ok(p.amount > 0)
+ t.equal(typeof p.amount, 'number');
+ t.ok(p.amount > 0);
}
if (p.hint !== null) {
- t.equal(typeof p.hint, 'string')
- t.ok(p.hint)
+ t.equal(typeof p.hint, 'string');
+ t.ok(p.hint);
}
-}
+};
-const client = createClient(nahshProfile, 'public-transport/hafas-client:test')
+const client = createClient(nahshProfile, 'public-transport/hafas-client:test');
-const kielHbf = '9049079'
-const kielHbf2 = '9049076'
-const flensburg = '9027253'
-const luebeckHbf = '9057819'
-const husum = '9044660'
-const schleswig = '9081683'
-const ellerbekerMarkt = '9049027'
-const seefischmarkt = '9049245'
-const kielRaeucherei = '9049217'
+const kielHbf = '9049079';
+const kielHbf2 = '9049076';
+const flensburg = '9027253';
+const luebeckHbf = '9057819';
+const husum = '9044660';
+const schleswig = '9081683';
+const ellerbekerMarkt = '9049027';
+const seefischmarkt = '9049245';
+const kielRaeucherei = '9049217';
tap.test('journeys – Kiel Hbf to Flensburg', async (t) => {
const res = await client.journeys(kielHbf, flensburg, {
results: 4,
departure: when,
- stopovers: true
- })
+ stopovers: true,
+ });
- const kaistr = '9049113'
+ const kaistr = '9049113';
await testJourneysStationToStation({
test: t,
res,
validate,
fromIds: [kielHbf, kaistr],
- toId: flensburg
- })
+ toId: flensburg,
+ });
for (let i = 0; i < res.journeys.length; i++) {
- const j = res.journeys[i]
+ const j = res.journeys[i];
// todo: find a journey where there pricing info is always available
- if (j.price) assertValidPrice(t, j.price, `res.journeys[${i}].price`)
+ if (j.price) {
+ assertValidPrice(t, j.price, `res.journeys[${i}].price`);
+ }
}
- t.end()
-})
+ t.end();
+});
// todo: journeys, only one product
@@ -108,31 +110,31 @@ tap.test('journeys – fails with no product', async (t) => {
toId: flensburg,
when,
products: nahshProfile.products,
- })
- t.end()
-})
+ });
+ t.end();
+});
tap.test('Kiel Hbf to Berliner Str. 80, Husum', async (t) => {
const berlinerStr = {
type: 'location',
address: 'Husum, Berliner Straße 80',
latitude: 54.488995,
- longitude: 9.056263
- }
+ longitude: 9.056263,
+ };
const res = await client.journeys(kielHbf, berlinerStr, {
results: 3,
- departure: when
- })
+ departure: when,
+ });
await testJourneysStationToAddress({
test: t,
res,
validate,
fromIds: [kielHbf, kielHbf2],
- to: berlinerStr
- })
- t.end()
-})
+ to: berlinerStr,
+ });
+ t.end();
+});
tap.test('Kiel Hbf to Holstentor', async (t) => {
const holstentor = {
@@ -141,43 +143,43 @@ tap.test('Kiel Hbf to Holstentor', async (t) => {
poi: true,
name: 'Hansestadt Lübeck, Holstentor (Denkmal)',
latitude: 53.866321,
- longitude: 10.679976
- }
+ longitude: 10.679976,
+ };
const res = await client.journeys(kielHbf, holstentor, {
results: 3,
- departure: when
- })
+ departure: when,
+ });
await testJourneysStationToPoi({
test: t,
res,
validate,
fromIds: [kielHbf, kielHbf2],
- to: holstentor
- })
- t.end()
-})
+ to: holstentor,
+ });
+ t.end();
+});
tap.test('Husum to Lübeck Hbf with stopover at Kiel Hbf', async (t) => {
const res = await client.journeys(husum, luebeckHbf, {
via: kielHbf,
results: 1,
departure: when,
- stopovers: true
- })
+ stopovers: true,
+ });
- validate(t, res, 'journeysResult', 'res')
+ validate(t, res, 'journeysResult', 'res');
const leg = res.journeys[0].legs.some((leg) => {
return leg.stopovers && leg.stopovers.some((stopover) => {
- const s = stopover.stop
- return s.station && s.station.id === kielHbf || s.id === kielHbf
- })
- })
- t.ok(leg, 'Kiel Hbf is not being passed')
+ const s = stopover.stop;
+ return s.station && s.station.id === kielHbf || s.id === kielHbf;
+ });
+ });
+ t.ok(leg, 'Kiel Hbf is not being passed');
- t.end()
-})
+ t.end();
+});
tap.test('earlier/later journeys, Kiel Hbf -> Flensburg', async (t) => {
await testEarlierLaterJourneys({
@@ -186,11 +188,11 @@ tap.test('earlier/later journeys, Kiel Hbf -> Flensburg', async (t) => {
validate,
fromId: kielHbf,
toId: flensburg,
- when
- })
+ when,
+ });
- t.end()
-})
+ t.end();
+});
tap.test('refreshJourney', async (t) => {
await testRefreshJourney({
@@ -200,42 +202,42 @@ tap.test('refreshJourney', async (t) => {
validate,
fromId: kielHbf,
toId: flensburg,
- when
- })
- t.end()
-})
+ when,
+ });
+ t.end();
+});
// todo: with detour test
// todo: without detour test
tap.test('trip details', async (t) => {
const res = await client.journeys(flensburg, husum, {
- results: 1, departure: when
- })
+ results: 1, departure: when,
+ });
- const p = res.journeys[0].legs.find(l => !l.walking)
- t.ok(p.tripId, 'precondition failed')
- t.ok(p.line.name, 'precondition failed')
+ const p = res.journeys[0].legs.find(l => !l.walking);
+ t.ok(p.tripId, 'precondition failed');
+ t.ok(p.line.name, 'precondition failed');
- const tripRes = await client.trip(p.tripId, {when})
+ const tripRes = await client.trip(p.tripId, {when});
- validate(t, tripRes, 'tripResult', 'res')
- t.end()
-})
+ validate(t, tripRes, 'tripResult', 'res');
+ t.end();
+});
tap.test('departures at Kiel Räucherei', async (t) => {
const res = await client.departures(kielRaeucherei, {
duration: 30, when,
- })
+ });
await testDepartures({
test: t,
res,
validate,
- id: kielRaeucherei
- })
- t.end()
-})
+ id: kielRaeucherei,
+ });
+ t.end();
+});
tap.test('departures with station object', async (t) => {
const res = await client.departures({
@@ -245,13 +247,13 @@ tap.test('departures with station object', async (t) => {
location: {
type: 'location',
latitude: 1.23,
- longitude: 2.34
- }
- }, {when})
+ longitude: 2.34,
+ },
+ }, {when});
- validate(t, res, 'departuresResponse', 'res')
- t.end()
-})
+ validate(t, res, 'departuresResponse', 'res');
+ t.end();
+});
tap.test('departures at Berlin Hbf in direction of Berlin Ostbahnhof', async (t) => {
await testDeparturesInDirection({
@@ -261,109 +263,111 @@ tap.test('departures at Berlin Hbf in direction of Berlin Ostbahnhof', async (t)
id: ellerbekerMarkt,
directionIds: [seefischmarkt, '710102'],
when,
- validate
- })
- t.end()
-})
+ validate,
+ });
+ t.end();
+});
tap.test('arrivals at Kiel Räucherei', async (t) => {
const res = await client.arrivals(kielRaeucherei, {
- duration: 30, when
- })
+ duration: 30, when,
+ });
await testArrivals({
test: t,
res,
validate,
- id: kielRaeucherei
- })
- t.end()
-})
+ id: kielRaeucherei,
+ });
+ t.end();
+});
tap.test('nearby Kiel Hbf', async (t) => {
const kielHbfPosition = {
type: 'location',
latitude: 54.314982,
- longitude: 10.131976
- }
+ longitude: 10.131976,
+ };
const nearby = await client.nearby(kielHbfPosition, {
- results: 2, distance: 400
- })
+ results: 2, distance: 400,
+ });
- validate(t, nearby, 'locations', 'nearby')
+ validate(t, nearby, 'locations', 'nearby');
- t.ok(Array.isArray(nearby))
- t.equal(nearby.length, 2)
+ t.ok(Array.isArray(nearby));
+ t.equal(nearby.length, 2);
- const match = nearby.find(n => n.id === kielHbf || n.station?.id === kielHbf)
- t.ok(match)
- t.equal(match.name, 'Kiel Hbf')
- t.ok(match.distance >= 0)
- t.ok(match.distance <= 100)
+ const match = nearby.find(n => n.id === kielHbf || n.station?.id === kielHbf);
+ t.ok(match);
+ t.equal(match.name, 'Kiel Hbf');
+ t.ok(match.distance >= 0);
+ t.ok(match.distance <= 100);
- t.end()
-})
+ t.end();
+});
tap.test('locations named "Kiel Rathaus"', async (t) => {
- const kielRathaus = '9049200'
+ const kielRathaus = '9049200';
const locations = await client.locations('Kiel Rathaus', {
- results: 15
- })
+ results: 15,
+ });
- validate(t, locations, 'locations', 'locations')
- t.ok(locations.length <= 15)
+ validate(t, locations, 'locations', 'locations');
+ t.ok(locations.length <= 15);
- t.ok(locations.find(l => l.type === 'stop' || l.type === 'station'))
- t.ok(locations.find(l => l.poi)) // POIs
- t.ok(locations.some(l => l.station && l.station.id === kielRathaus || l.id === kielRathaus))
+ t.ok(locations.find(l => l.type === 'stop' || l.type === 'station'));
+ t.ok(locations.find(l => l.poi)); // POIs
+ t.ok(locations.some(l => l.station && l.station.id === kielRathaus || l.id === kielRathaus));
- t.end()
-})
+ t.end();
+});
tap.test('stop', async (t) => {
- const s = await client.stop(kielHbf)
+ const s = await client.stop(kielHbf);
- validate(t, s, ['stop', 'station'], 'stop')
- t.equal(s.id, kielHbf)
+ validate(t, s, ['stop', 'station'], 'stop');
+ t.equal(s.id, kielHbf);
- t.end()
-})
+ t.end();
+});
tap.test('radar', async (t) => {
const res = await client.radar({
north: 54.4,
west: 10.0,
south: 54.2,
- east: 10.2
+ east: 10.2,
}, {
- duration: 5 * 60, when
- })
+ duration: 5 * 60, when,
+ });
// todo: cfg.stationProductsOptional option
- const {products} = nahshProfile
- const allProducts = products.reduce((acc, p) => (acc[p.id] = true, acc), {})
- const validateStation = createValidateStation(cfg)
+ const {products} = nahshProfile;
+ const allProducts = products.reduce((acc, p) => (acc[p.id] = true, acc), {});
+ const validateStation = createValidateStation(cfg);
const validate = createValidate(cfg, {
station: (validate, s, name) => {
s = Object.assign({
- products: allProducts // todo: fix station.products
- }, s)
- if (!s.name) s.name = 'foo' // todo, see #34
- validateStation(validate, s, name)
- }
- })
- validate(t, res, 'radarResult', 'res')
+ products: allProducts, // todo: fix station.products
+ }, s);
+ if (!s.name) {
+ s.name = 'foo';
+ } // todo, see #34
+ validateStation(validate, s, name);
+ },
+ });
+ validate(t, res, 'radarResult', 'res');
- t.end()
-})
+ t.end();
+});
tap.test('reachableFrom', async (t) => {
const berlinerStr = {
type: 'location',
address: 'Husum, Berliner Straße 80',
latitude: 54.488995,
- longitude: 9.056263
- }
+ longitude: 9.056263,
+ };
await testReachableFrom({
test: t,
@@ -371,7 +375,7 @@ tap.test('reachableFrom', async (t) => {
address: berlinerStr,
when,
maxDuration: 60,
- validate
- })
- t.end()
-})
+ validate,
+ });
+ t.end();
+});
diff --git a/test/e2e/nvv.js b/test/e2e/nvv.js
index ca4201b9..a96a84af 100644
--- a/test/e2e/nvv.js
+++ b/test/e2e/nvv.js
@@ -1,24 +1,24 @@
-import tap from 'tap'
-import isRoughlyEqual from 'is-roughly-equal'
+import tap from 'tap';
+import isRoughlyEqual from 'is-roughly-equal';
-import {createWhen} from './lib/util.js'
-import {createClient} from '../../index.js'
-import {profile as nvvProfile} from '../../p/nvv/index.js'
-import {createValidateFptfWith as createValidate} from './lib/validate-fptf-with.js'
-import {testJourneysStationToStation} from './lib/journeys-station-to-station.js'
-import {journeysFailsWithNoProduct} from './lib/journeys-fails-with-no-product.js'
-import {testJourneysStationToAddress} from './lib/journeys-station-to-address.js'
-import {testJourneysStationToPoi} from './lib/journeys-station-to-poi.js'
-import {testEarlierLaterJourneys} from './lib/earlier-later-journeys.js'
-import {testDepartures} from './lib/departures.js'
-import {testDeparturesInDirection} from './lib/departures-in-direction.js'
-import {testArrivals} from './lib/arrivals.js'
-import {testJourneysWithDetour} from './lib/journeys-with-detour.js'
+import {createWhen} from './lib/util.js';
+import {createClient} from '../../index.js';
+import {profile as nvvProfile} from '../../p/nvv/index.js';
+import {createValidateFptfWith as createValidate} from './lib/validate-fptf-with.js';
+import {testJourneysStationToStation} from './lib/journeys-station-to-station.js';
+import {journeysFailsWithNoProduct} from './lib/journeys-fails-with-no-product.js';
+import {testJourneysStationToAddress} from './lib/journeys-station-to-address.js';
+import {testJourneysStationToPoi} from './lib/journeys-station-to-poi.js';
+import {testEarlierLaterJourneys} from './lib/earlier-later-journeys.js';
+import {testDepartures} from './lib/departures.js';
+import {testDeparturesInDirection} from './lib/departures-in-direction.js';
+import {testArrivals} from './lib/arrivals.js';
+import {testJourneysWithDetour} from './lib/journeys-with-detour.js';
-const isObj = o => o !== null && 'object' === typeof o && !Array.isArray(o)
+const isObj = o => o !== null && 'object' === typeof o && !Array.isArray(o);
-const T_MOCK = 1668495600 * 1000 // 2022-11-15T08:00:00+01:00
-const when = createWhen(nvvProfile.timezone, nvvProfile.locale, T_MOCK)
+const T_MOCK = 1668495600 * 1000; // 2022-11-15T08:00:00+01:00
+const when = createWhen(nvvProfile.timezone, nvvProfile.locale, T_MOCK);
const cfg = {
when,
@@ -27,33 +27,33 @@ const cfg = {
minLatitude: 48,
minLongitude: 8,
maxLatitude: 53,
- maxLongitude: 14
-}
-const validate = createValidate(cfg, {})
+ maxLongitude: 14,
+};
+const validate = createValidate(cfg, {});
-const client = createClient(nvvProfile, 'public-transport/hafas-client:test')
+const client = createClient(nvvProfile, 'public-transport/hafas-client:test');
-const scheidemannplatz = '2200073'
-const auestadion = '2200042'
-const weigelstr = '2200056'
-const friedrichsplatz = '2200006'
+const scheidemannplatz = '2200073';
+const auestadion = '2200042';
+const weigelstr = '2200056';
+const friedrichsplatz = '2200006';
tap.test('journeys – Kassel Scheidemannplatz to Kassel Auestadion', async (t) => {
const res = await client.journeys(scheidemannplatz, auestadion, {
results: 4,
departure: when,
- stopovers: true
- })
+ stopovers: true,
+ });
await testJourneysStationToStation({
test: t,
res,
validate,
fromId: scheidemannplatz,
- toId: auestadion
- })
- t.end()
-})
+ toId: auestadion,
+ });
+ t.end();
+});
// todo: journeys, only one product
@@ -65,9 +65,9 @@ tap.test('journeys – fails with no product', async (t) => {
toId: auestadion,
when,
products: nvvProfile.products,
- })
- t.end()
-})
+ });
+ t.end();
+});
tap.test('Kassel Scheidemannplatz to Heckerstraße 2', async (t) => {
const heckerstr2 = {
@@ -75,23 +75,23 @@ tap.test('Kassel Scheidemannplatz to Heckerstraße 2', async (t) => {
id: '990100251',
address: 'Kassel, Heckerstraße 2',
latitude: 51.308108,
- longitude: 9.475152
- }
+ longitude: 9.475152,
+ };
const res = await client.journeys(scheidemannplatz, heckerstr2, {
results: 3,
- departure: when
- })
+ departure: when,
+ });
await testJourneysStationToAddress({
test: t,
res,
validate,
fromId: scheidemannplatz,
- to: heckerstr2
- })
- t.end()
-})
+ to: heckerstr2,
+ });
+ t.end();
+});
tap.test('Kassel Scheidemannplatz to Grimmwelt', async (t) => {
const grimmwelt = {
@@ -101,42 +101,42 @@ tap.test('Kassel Scheidemannplatz to Grimmwelt', async (t) => {
name: 'Grimmwelt Kassel',
latitude: 51.309313,
longitude: 9.489283,
- }
+ };
const res = await client.journeys(scheidemannplatz, grimmwelt, {
results: 3,
- departure: when
- })
+ departure: when,
+ });
await testJourneysStationToPoi({
test: t,
res,
validate,
fromId: scheidemannplatz,
- to: grimmwelt
- })
- t.end()
-})
+ to: grimmwelt,
+ });
+ t.end();
+});
tap.test('journeys: via works – with detour', async (t) => {
// Going from Scheidemannplatz to Rathaus/Fünffensterstr. via Kassel Wilhelmshöhe
// implies a detour. We check if the routing engine computes a detour.
- const rathausFünffensterstr = '2200436'
- const wilhelmshöhe = '2200007'
+ const rathausFünffensterstr = '2200436';
+ const wilhelmshöhe = '2200007';
const res = await client.journeys(scheidemannplatz, rathausFünffensterstr, {
via: wilhelmshöhe,
results: 1,
departure: when,
- stopovers: true
- })
+ stopovers: true,
+ });
await testJourneysWithDetour({
test: t,
res,
validate,
- detourIds: [wilhelmshöhe]
- })
- t.end()
-})
+ detourIds: [wilhelmshöhe],
+ });
+ t.end();
+});
// todo: without detour
@@ -147,40 +147,40 @@ tap.test('earlier/later journeys', async (t) => {
validate,
fromId: scheidemannplatz,
toId: auestadion,
- when
- })
+ when,
+ });
- t.end()
-})
+ t.end();
+});
tap.test('trip details', async (t) => {
const res = await client.journeys(scheidemannplatz, auestadion, {
- results: 1, departure: when
- })
+ results: 1, departure: when,
+ });
- const p = res.journeys[0].legs.find(l => !l.walking)
- t.ok(p.tripId, 'precondition failed')
- t.ok(p.line.name, 'precondition failed')
+ const p = res.journeys[0].legs.find(l => !l.walking);
+ t.ok(p.tripId, 'precondition failed');
+ t.ok(p.line.name, 'precondition failed');
- const tripRes = await client.trip(p.tripId, {when})
+ const tripRes = await client.trip(p.tripId, {when});
- validate(t, tripRes, 'tripResult', 'res')
- t.end()
-})
+ validate(t, tripRes, 'tripResult', 'res');
+ t.end();
+});
tap.test('departures at Kassel Auestadion.', async (t) => {
const res = await client.departures(auestadion, {
duration: 11, when,
- })
+ });
await testDepartures({
test: t,
res,
validate,
- id: auestadion
- })
- t.end()
-})
+ id: auestadion,
+ });
+ t.end();
+});
tap.test('departures with station object', async (t) => {
const res = await client.departures({
@@ -190,13 +190,13 @@ tap.test('departures with station object', async (t) => {
location: {
type: 'location',
latitude: 1.23,
- longitude: 2.34
- }
- }, {when})
+ longitude: 2.34,
+ },
+ }, {when});
- validate(t, res, 'departuresResponse', 'res')
- t.end()
-})
+ validate(t, res, 'departuresResponse', 'res');
+ t.end();
+});
tap.test('departures at Auestadion in direction of Friedrichsplatz', async (t) => {
await testDeparturesInDirection({
@@ -206,60 +206,60 @@ tap.test('departures at Auestadion in direction of Friedrichsplatz', async (t) =
id: weigelstr,
directionIds: [friedrichsplatz],
when,
- validate
- })
- t.end()
-})
+ validate,
+ });
+ t.end();
+});
tap.test('arrivals at Kassel Weigelstr.', async (t) => {
const res = await client.arrivals(weigelstr, {
- duration: 5, when
- })
+ duration: 5, when,
+ });
await testArrivals({
test: t,
res,
validate,
id: weigelstr,
- })
- t.end()
-})
+ });
+ t.end();
+});
// todo: nearby
tap.test('locations named Auestadion', async (t) => {
- const locations = await client.locations('auestadion', {results: 10})
+ const locations = await client.locations('auestadion', {results: 10});
- validate(t, locations, 'locations', 'locations')
- t.ok(locations.length <= 10)
+ validate(t, locations, 'locations', 'locations');
+ t.ok(locations.length <= 10);
- t.ok(locations.find(s => s.type === 'stop' || s.type === 'station'))
- t.ok(locations.find(s => s.poi)) // POIs
- t.ok(locations.some(l => l.station && l.station.id === auestadion || l.id === auestadion))
+ t.ok(locations.find(s => s.type === 'stop' || s.type === 'station'));
+ t.ok(locations.find(s => s.poi)); // POIs
+ t.ok(locations.some(l => l.station && l.station.id === auestadion || l.id === auestadion));
- t.end()
-})
+ t.end();
+});
tap.test('station Auestadion', async (t) => {
- const s = await client.stop(auestadion)
+ const s = await client.stop(auestadion);
- validate(t, s, ['stop', 'station'], 'station')
- t.equal(s.id, auestadion)
+ validate(t, s, ['stop', 'station'], 'station');
+ t.equal(s.id, auestadion);
- t.end()
-})
+ t.end();
+});
tap.test('radar', async (t) => {
const res = await client.radar({
north: 51.320153,
west: 9.458359,
south: 51.304304,
- east: 9.493672
+ east: 9.493672,
}, {
- duration: 5 * 60, when, results: 10
- })
+ duration: 5 * 60, when, results: 10,
+ });
- validate(t, res, 'radarResult', 'res')
+ validate(t, res, 'radarResult', 'res');
- t.end()
-})
+ t.end();
+});
diff --git a/test/e2e/oebb.js b/test/e2e/oebb.js
index 38820d25..e15bfe7f 100644
--- a/test/e2e/oebb.js
+++ b/test/e2e/oebb.js
@@ -1,27 +1,27 @@
-import tap from 'tap'
-import isRoughlyEqual from 'is-roughly-equal'
-import validateLine from 'validate-fptf/line.js'
+import tap from 'tap';
+import isRoughlyEqual from 'is-roughly-equal';
+import validateLine from 'validate-fptf/line.js';
-import {createWhen} from './lib/util.js'
-import {createClient} from '../../index.js'
-import {profile as oebbProfile} from '../../p/oebb/index.js'
+import {createWhen} from './lib/util.js';
+import {createClient} from '../../index.js';
+import {profile as oebbProfile} from '../../p/oebb/index.js';
import {
createValidateStation,
createValidateStop,
-} from './lib/validators.js'
-import {createValidateFptfWith as createValidate} from './lib/validate-fptf-with.js'
-import {testJourneysStationToStation} from './lib/journeys-station-to-station.js'
-import {testJourneysStationToAddress} from './lib/journeys-station-to-address.js'
-import {testJourneysStationToPoi} from './lib/journeys-station-to-poi.js'
-import {testEarlierLaterJourneys} from './lib/earlier-later-journeys.js'
-import {testRefreshJourney} from './lib/refresh-journey.js'
-import {journeysFailsWithNoProduct} from './lib/journeys-fails-with-no-product.js'
-import {testJourneysWithDetour} from './lib/journeys-with-detour.js'
-import {testDepartures} from './lib/departures.js'
-import {testDeparturesInDirection} from './lib/departures-in-direction.js'
+} from './lib/validators.js';
+import {createValidateFptfWith as createValidate} from './lib/validate-fptf-with.js';
+import {testJourneysStationToStation} from './lib/journeys-station-to-station.js';
+import {testJourneysStationToAddress} from './lib/journeys-station-to-address.js';
+import {testJourneysStationToPoi} from './lib/journeys-station-to-poi.js';
+import {testEarlierLaterJourneys} from './lib/earlier-later-journeys.js';
+import {testRefreshJourney} from './lib/refresh-journey.js';
+import {journeysFailsWithNoProduct} from './lib/journeys-fails-with-no-product.js';
+import {testJourneysWithDetour} from './lib/journeys-with-detour.js';
+import {testDepartures} from './lib/departures.js';
+import {testDeparturesInDirection} from './lib/departures-in-direction.js';
-const T_MOCK = 1671260400 * 1000 // 2022-12-17T08:00:00+01:00
-const when = createWhen(oebbProfile.timezone, oebbProfile.locale, T_MOCK)
+const T_MOCK = 1671260400 * 1000; // 2022-12-17T08:00:00+01:00
+const when = createWhen(oebbProfile.timezone, oebbProfile.locale, T_MOCK);
const cfg = {
when,
@@ -30,61 +30,63 @@ const cfg = {
minLatitude: 45.992803,
maxLatitude: 49.453517,
minLongitude: 8.787557,
- maxLongitude: 17.491275
-}
+ maxLongitude: 17.491275,
+};
// todo validateDirection: search list of stations for direction
-const validate = createValidate(cfg)
+const validate = createValidate(cfg);
-const _validateStop = createValidateStop(cfg)
+const _validateStop = createValidateStop(cfg);
const assertValidPrice = (t, p) => {
- t.ok(p)
+ t.ok(p);
if (p.amount !== null) {
- t.equal(typeof p.amount, 'number')
- t.ok(p.amount > 0)
+ t.equal(typeof p.amount, 'number');
+ t.ok(p.amount > 0);
}
if (p.hint !== null) {
- t.equal(typeof p.hint, 'string')
- t.ok(p.hint)
+ t.equal(typeof p.hint, 'string');
+ t.ok(p.hint);
}
-}
+};
-const client = createClient(oebbProfile, 'public-transport/hafas-client:test')
+const client = createClient(oebbProfile, 'public-transport/hafas-client:test');
-const salzburgHbf = '8100002'
-const wienFickeystr = '911014'
-const wien = '1190100'
-const wienWestbahnhof = '1291501'
-const klagenfurtHbf = '8100085'
-const muenchenHbf = '8000261'
-const wienRenngasse = '1390186'
-const wienKarlsplatz = '1390461'
-const wienPilgramgasse = '1390562'
+const salzburgHbf = '8100002';
+const wienFickeystr = '911014';
+const wien = '1190100';
+const wienWestbahnhof = '1291501';
+const klagenfurtHbf = '8100085';
+const muenchenHbf = '8000261';
+const wienRenngasse = '1390186';
+const wienKarlsplatz = '1390461';
+const wienPilgramgasse = '1390562';
tap.test('journeys – Salzburg Hbf to Wien Westbahnhof', async (t) => {
const res = await client.journeys(salzburgHbf, wienFickeystr, {
results: 4,
departure: when,
- stopovers: true
- })
+ stopovers: true,
+ });
await testJourneysStationToStation({
test: t,
res,
validate,
fromId: salzburgHbf,
- toId: wienFickeystr
- })
+ toId: wienFickeystr,
+ });
for (let i = 0; i < res.journeys.length; i++) {
- const j = res.journeys[i]
- if (j.price) assertValidPrice(t, j.price, `res.journeys[${i}].price`)
+ const j = res.journeys[i];
+ if (j.price) {
+ assertValidPrice(t, j.price, `res.journeys[${i}].price`);
+ }
}
- t.end()
-})
+ t.end();
+});
// todo: journeys, only one product
@@ -96,31 +98,31 @@ tap.test('journeys – fails with no product', async (t) => {
toId: wienFickeystr,
when,
products: oebbProfile.products,
- })
- t.end()
-})
+ });
+ t.end();
+});
tap.test('Salzburg Hbf to 1220 Wien, Fischerstrand 7', async (t) => {
const wagramerStr = {
type: 'location',
address: '1220 Wien, Fischerstrand 7',
latitude: 48.236216,
- longitude: 16.425863
- }
+ longitude: 16.425863,
+ };
const res = await client.journeys(salzburgHbf, wagramerStr, {
results: 3,
- departure: when
- })
+ departure: when,
+ });
await testJourneysStationToAddress({
test: t,
res,
validate,
fromId: salzburgHbf,
- to: wagramerStr
- })
- t.end()
-})
+ to: wagramerStr,
+ });
+ t.end();
+});
tap.test('Salzburg Hbf to Uni Wien', async (t) => {
const uniWien = {
@@ -129,10 +131,10 @@ tap.test('Salzburg Hbf to Uni Wien', async (t) => {
poi: true,
name: 'Wien, Donaupark (Parkplatz)',
latitude: 48.240674, longitude: 16.4097,
- }
+ };
const res = await client.journeys(salzburgHbf, uniWien, {
- results: 3, departure: when
- })
+ results: 3, departure: when,
+ });
await testJourneysStationToPoi({
test: t,
@@ -140,67 +142,67 @@ tap.test('Salzburg Hbf to Uni Wien', async (t) => {
validate,
fromId: salzburgHbf,
to: uniWien,
- })
- t.end()
-})
+ });
+ t.end();
+});
tap.test('journeys: via works – with detour', async (t) => {
// Going from Stephansplatz to Schottenring via Donauinsel without detour
// is currently impossible. We check if the routing engine computes a detour.
- const stephansplatz = '1390167'
- const schottenring = '1390163'
- const donauinsel = '1392277'
- const donauinselPassed = '922001'
+ const stephansplatz = '1390167';
+ const schottenring = '1390163';
+ const donauinsel = '1392277';
+ const donauinselPassed = '922001';
const res = await client.journeys(stephansplatz, schottenring, {
via: donauinsel,
results: 1,
departure: when,
- stopovers: true
- })
+ stopovers: true,
+ });
await testJourneysWithDetour({
test: t,
res,
validate,
- detourIds: [donauinsel, donauinselPassed]
- })
- t.end()
-})
+ detourIds: [donauinsel, donauinselPassed],
+ });
+ t.end();
+});
tap.test('journeys: via works – without detour', async (t) => {
// When going from Karlsplatz to Praterstern via Museumsquartier, there is
// *no need* to change trains / no need for a "detour".
- const karlsplatz = '1390461'
- const praterstern = '1290201'
- const stephansplatz = '1390167'
- const stephansplatzPassed = '901006'
+ const karlsplatz = '1390461';
+ const praterstern = '1290201';
+ const stephansplatz = '1390167';
+ const stephansplatzPassed = '901006';
const res = await client.journeys(karlsplatz, praterstern, {
via: stephansplatz,
results: 1,
departure: when,
- stopovers: true
- })
+ stopovers: true,
+ });
- validate(t, res, 'journeysResult', 'res')
+ validate(t, res, 'journeysResult', 'res');
const l1 = res.journeys[0].legs.some((leg) => {
return (
- leg.destination.id === stephansplatz ||
- leg.destination.id === stephansplatzPassed
- )
- })
- t.notOk(l1, 'transfer at Museumsquartier')
+ leg.destination.id === stephansplatz
+ || leg.destination.id === stephansplatzPassed
+ );
+ });
+ t.notOk(l1, 'transfer at Museumsquartier');
const l2 = res.journeys[0].legs.some((leg) => {
return leg.stopovers && leg.stopovers.some((stopover) => {
- return stopover.stop.id === stephansplatzPassed
- })
- })
- t.ok(l2, 'Museumsquartier is not being passed')
+ return stopover.stop.id === stephansplatzPassed;
+ });
+ });
+ t.ok(l2, 'Museumsquartier is not being passed');
- t.end()
-})
+ t.end();
+});
tap.test('earlier/later journeys, Salzburg Hbf -> Wien Westbahnhof', async (t) => {
await testEarlierLaterJourneys({
@@ -209,11 +211,11 @@ tap.test('earlier/later journeys, Salzburg Hbf -> Wien Westbahnhof', async (t) =
validate,
fromId: salzburgHbf,
toId: wienWestbahnhof,
- when
- })
+ when,
+ });
- t.end()
-})
+ t.end();
+});
tap.test('refreshJourney', async (t) => {
await testRefreshJourney({
@@ -223,46 +225,46 @@ tap.test('refreshJourney', async (t) => {
validate,
fromId: salzburgHbf,
toId: wienWestbahnhof,
- when
- })
- t.end()
-})
+ when,
+ });
+ t.end();
+});
tap.test('trip details', async (t) => {
const res = await client.journeys(wienWestbahnhof, muenchenHbf, {
- results: 1, departure: when
- })
+ results: 1, departure: when,
+ });
- const p = res.journeys[0].legs.find(l => !l.walking)
- t.ok(p.tripId, 'precondition failed')
- t.ok(p.line.name, 'precondition failed')
+ const p = res.journeys[0].legs.find(l => !l.walking);
+ t.ok(p.tripId, 'precondition failed');
+ t.ok(p.line.name, 'precondition failed');
- const tripRes = await client.trip(p.tripId, {when})
+ const tripRes = await client.trip(p.tripId, {when});
- validate(t, tripRes, 'tripResult', 'res')
- t.end()
-})
+ validate(t, tripRes, 'tripResult', 'res');
+ t.end();
+});
tap.test('departures at Wien Leibenfrostgasse', async (t) => {
- const wienLeibenfrostgasse = '1390469'
+ const wienLeibenfrostgasse = '1390469';
const ids = [
wienLeibenfrostgasse, // station
'904029', // stop "Wien Leibenfrostgasse (Phorusgasse)s"
- '904030' // stop "Wien Leibenfrostgasse (Ziegelofengasse)"
- ]
+ '904030', // stop "Wien Leibenfrostgasse (Ziegelofengasse)"
+ ];
const res = await client.departures(wienLeibenfrostgasse, {
duration: 15, when,
- })
+ });
await testDepartures({
test: t,
res,
validate,
ids,
- })
- t.end()
-})
+ });
+ t.end();
+});
tap.test('departures with station object', async (t) => {
const res = await client.departures({
@@ -272,18 +274,18 @@ tap.test('departures with station object', async (t) => {
location: {
type: 'location',
latitude: 1.23,
- longitude: 2.34
- }
- }, {when})
+ longitude: 2.34,
+ },
+ }, {when});
- validate(t, res, 'departuresResponse', 'res')
- t.end()
-})
+ validate(t, res, 'departuresResponse', 'res');
+ t.end();
+});
tap.test('departures at Karlsplatz in direction of Pilgramgasse', async (t) => {
const subStops = (await client.stop(wienPilgramgasse, {
subStops: true, entrances: false,
- })).stops || []
+ })).stops || [];
await testDeparturesInDirection({
test: t,
@@ -292,10 +294,10 @@ tap.test('departures at Karlsplatz in direction of Pilgramgasse', async (t) => {
id: wienKarlsplatz,
directionIds: [wienPilgramgasse, ...subStops.map(s => s.id)],
when,
- validate
- })
- t.end()
-})
+ validate,
+ });
+ t.end();
+});
// todo: arrivals
@@ -303,100 +305,102 @@ tap.test('nearby Salzburg Hbf', async (t) => {
const nearby = await client.nearby({
type: 'location',
longitude: 13.045605,
- latitude: 47.812852
+ latitude: 47.812852,
}, {
- results: 5, distance: 400
- })
+ results: 5, distance: 400,
+ });
- validate(t, nearby, 'locations', 'nearby')
- t.equal(nearby.length, 5)
+ validate(t, nearby, 'locations', 'nearby');
+ t.equal(nearby.length, 5);
- const s = nearby[0]
- t.equal(s.id, salzburgHbf, 'id should be ' + salzburgHbf)
- t.equal(s.name, 'Salzburg Hbf')
- t.ok(isRoughlyEqual(.0005, s.location.latitude, 47.812851))
- t.ok(isRoughlyEqual(.0005, s.location.longitude, 13.045604))
- t.ok(s.distance >= 0)
- t.ok(s.distance <= 100)
+ const s = nearby[0];
+ t.equal(s.id, salzburgHbf, 'id should be ' + salzburgHbf);
+ t.equal(s.name, 'Salzburg Hbf');
+ t.ok(isRoughlyEqual(0.0005, s.location.latitude, 47.812851));
+ t.ok(isRoughlyEqual(0.0005, s.location.longitude, 13.045604));
+ t.ok(s.distance >= 0);
+ t.ok(s.distance <= 100);
- t.end()
-})
+ t.end();
+});
tap.test('locations named Salzburg', async (t) => {
- const salzburgVolksgarten = '591161'
+ const salzburgVolksgarten = '591161';
const locations = await client.locations('Salzburg volksgarten', {
- results: 20
- })
+ results: 20,
+ });
- validate(t, locations, 'locations', 'locations')
- t.ok(locations.length <= 20)
+ validate(t, locations, 'locations', 'locations');
+ t.ok(locations.length <= 20);
- t.ok(locations.find(s => s.type === 'stop' || s.type === 'station'))
- t.ok(locations.find(s => s.poi)) // POIs
+ t.ok(locations.find(s => s.type === 'stop' || s.type === 'station'));
+ t.ok(locations.find(s => s.poi)); // POIs
t.ok(locations.some((s) => {
- return s.station && s.station.id === salzburgVolksgarten || s.id === salzburgVolksgarten
- }))
+ return s.station && s.station.id === salzburgVolksgarten || s.id === salzburgVolksgarten;
+ }));
- t.end()
-})
+ t.end();
+});
tap.test('stop', async (t) => {
- const loc = await client.stop(wienRenngasse)
+ const loc = await client.stop(wienRenngasse);
// todo: find a way to always get products from the API
// todo: cfg.stationProductsOptional option
- const {products} = oebbProfile
- const allProducts = products.reduce((acc, p) => (acc[p.id] = true, acc), {})
- const validateStation = createValidateStation(cfg)
+ const {products} = oebbProfile;
+ const allProducts = products.reduce((acc, p) => (acc[p.id] = true, acc), {});
+ const validateStation = createValidateStation(cfg);
const validate = createValidate(cfg, {
stop: (validate, s, name) => {
- const withFakeProducts = Object.assign({products: allProducts}, s)
- _validateStop(validate, withFakeProducts, name)
+ const withFakeProducts = Object.assign({products: allProducts}, s);
+ _validateStop(validate, withFakeProducts, name);
},
station: (validate, s, name) => {
- const withFakeProducts = Object.assign({products: allProducts}, s)
- validateStation(validate, withFakeProducts, name)
- }
- })
- validate(t, loc, ['stop', 'station'], 'stop')
+ const withFakeProducts = Object.assign({products: allProducts}, s);
+ validateStation(validate, withFakeProducts, name);
+ },
+ });
+ validate(t, loc, ['stop', 'station'], 'stop');
- t.equal(loc.id, wienRenngasse)
+ t.equal(loc.id, wienRenngasse);
- t.end()
-})
+ t.end();
+});
tap.test('radar Salzburg', async (t) => {
let res = await client.radar({
north: 47.827203,
west: 13.001261,
south: 47.773278,
- east: 13.07562
+ east: 13.07562,
}, {
- duration: 5 * 60, when
- })
+ duration: 5 * 60, when,
+ });
// todo: find a way to always get frames from the API
- res.movements = res.movements.filter(m => m.frames && m.frames.length > 0)
+ res.movements = res.movements.filter(m => m.frames && m.frames.length > 0);
// todo: find a way to always get products from the API
// todo: cfg.stationProductsOptional option
- const {products} = oebbProfile
- const allProducts = products.reduce((acc, p) => (acc[p.id] = true, acc), {})
- const validateStation = createValidateStation(cfg)
+ const {products} = oebbProfile;
+ const allProducts = products.reduce((acc, p) => (acc[p.id] = true, acc), {});
+ const validateStation = createValidateStation(cfg);
const validate = createValidate(cfg, {
station: (validate, s, name) => {
- const withFakeProducts = Object.assign({products: allProducts}, s)
- validateStation(validate, withFakeProducts, name)
+ const withFakeProducts = Object.assign({products: allProducts}, s);
+ validateStation(validate, withFakeProducts, name);
},
line: (val, line, name = 'line') => {
validateLine(val, {
...line,
// fptf demands a mode
- mode: line.mode === null ? 'bus' : line.mode,
- }, name)
+ mode: line.mode === null
+ ? 'bus'
+ : line.mode,
+ }, name);
},
- })
- validate(t, res, 'radarResult', 'res')
+ });
+ validate(t, res, 'radarResult', 'res');
- t.end()
-})
+ t.end();
+});
diff --git a/test/e2e/ooevv.js b/test/e2e/ooevv.js
index 56f45112..cef3dbef 100644
--- a/test/e2e/ooevv.js
+++ b/test/e2e/ooevv.js
@@ -1,12 +1,12 @@
-import tap from 'tap'
+import tap from 'tap';
-import {createWhen} from './lib/util.js'
-import {createClient} from '../../index.js'
-import {profile as oövvProfile} from '../../p/ooevv/index.js'
-import {createValidateFptfWith as createValidate} from './lib/validate-fptf-with.js'
+import {createWhen} from './lib/util.js';
+import {createClient} from '../../index.js';
+import {profile as oövvProfile} from '../../p/ooevv/index.js';
+import {createValidateFptfWith as createValidate} from './lib/validate-fptf-with.js';
-const T_MOCK = 1671260400 * 1000 // 2022-12-17T08:00:00+01:00
-const when = createWhen(oövvProfile.timezone, oövvProfile.locale, T_MOCK)
+const T_MOCK = 1671260400 * 1000; // 2022-12-17T08:00:00+01:00
+const when = createWhen(oövvProfile.timezone, oövvProfile.locale, T_MOCK);
const cfg = {
when,
@@ -16,20 +16,20 @@ const cfg = {
maxLongitude: 17.0892,
minLatitude: 45.7206,
minLongitude: 7.8635,
-}
-const validate = createValidate(cfg)
+};
+const validate = createValidate(cfg);
-const client = createClient(oövvProfile, 'public-transport/hafas-client:test')
+const client = createClient(oövvProfile, 'public-transport/hafas-client:test');
-const linzTheatergasse = '444670100'
+const linzTheatergasse = '444670100';
tap.test('locations named "theatergasse"', async (t) => {
- const locations = await client.locations('theatergasse')
+ const locations = await client.locations('theatergasse');
- validate(t, locations, 'locations', 'locations')
+ validate(t, locations, 'locations', 'locations');
t.ok(locations.some((l) => {
- return l.station && l.station.id === linzTheatergasse || l.id === linzTheatergasse
- }), 'Linz Theatergasse not found')
+ return l.station && l.station.id === linzTheatergasse || l.id === linzTheatergasse;
+ }), 'Linz Theatergasse not found');
- t.end()
-})
+ t.end();
+});
diff --git a/test/e2e/pkp.js b/test/e2e/pkp.js
index 3cf92c0b..1d703acf 100644
--- a/test/e2e/pkp.js
+++ b/test/e2e/pkp.js
@@ -1,20 +1,20 @@
-import tap from 'tap'
+import tap from 'tap';
-import {createWhen} from './lib/util.js'
-import {createClient} from '../../index.js'
-import {profile as pkpProfile} from '../../p/pkp/index.js'
+import {createWhen} from './lib/util.js';
+import {createClient} from '../../index.js';
+import {profile as pkpProfile} from '../../p/pkp/index.js';
import {
createValidateLine,
createValidateJourneyLeg,
createValidateMovement,
-} from './lib/validators.js'
-import {createValidateFptfWith as createValidate} from './lib/validate-fptf-with.js'
-import {testJourneysStationToStation} from './lib/journeys-station-to-station.js'
-import {testArrivals} from './lib/arrivals.js'
-import {testReachableFrom} from './lib/reachable-from.js'
+} from './lib/validators.js';
+import {createValidateFptfWith as createValidate} from './lib/validate-fptf-with.js';
+import {testJourneysStationToStation} from './lib/journeys-station-to-station.js';
+import {testArrivals} from './lib/arrivals.js';
+import {testReachableFrom} from './lib/reachable-from.js';
-const T_MOCK = 1671260400 * 1000 // 2022-12-17T08:00:00+01:00
-const when = createWhen(pkpProfile.timezone, pkpProfile.locale, T_MOCK)
+const T_MOCK = 1671260400 * 1000; // 2022-12-17T08:00:00+01:00
+const when = createWhen(pkpProfile.timezone, pkpProfile.locale, T_MOCK);
const cfg = {
when,
@@ -24,123 +24,129 @@ const cfg = {
maxLatitude: 65,
minLongitude: 10,
maxLongitude: 30,
-}
+};
-const _validateLine = createValidateLine(cfg)
+const _validateLine = createValidateLine(cfg);
const validateLine = (validate, l, name) => {
- if (!l.direction) l = Object.assign({}, l, { direction: 'foo' })
- _validateLine(validate, l, name)
-}
+ if (!l.direction) {
+ l = Object.assign({}, l, {direction: 'foo'});
+ }
+ _validateLine(validate, l, name);
+};
-const _validateJourneyLeg = createValidateJourneyLeg(cfg)
+const _validateJourneyLeg = createValidateJourneyLeg(cfg);
const validateJourneyLeg = (validate, l, name) => {
- if (!l.direction) l = Object.assign({}, l, { direction: 'foo' })
- _validateJourneyLeg(validate, l, name)
-}
+ if (!l.direction) {
+ l = Object.assign({}, l, {direction: 'foo'});
+ }
+ _validateJourneyLeg(validate, l, name);
+};
-const _validateMovement = createValidateMovement(cfg)
+const _validateMovement = createValidateMovement(cfg);
const validateMovement = (val, m, name) => {
- if (!m.direction) m = Object.assign({}, m, { direction: 'foo' })
- _validateMovement(val, m, name)
-}
+ if (!m.direction) {
+ m = Object.assign({}, m, {direction: 'foo'});
+ }
+ _validateMovement(val, m, name);
+};
const validate = createValidate(cfg, {
line: validateLine,
journeyLeg: validateJourneyLeg,
- movement: validateMovement
-})
+ movement: validateMovement,
+});
-const client = createClient(pkpProfile, 'public-transport/hafas-client:test')
+const client = createClient(pkpProfile, 'public-transport/hafas-client:test');
-const wrocławGł = '5100069'
-const krakówGł = '5100028'
+const wrocławGł = '5100069';
+const krakówGł = '5100028';
const dworcowa100 = {
type: 'location',
address: 'Bydgoszcz, Dworcowa 100',
latitude: 53.1336648,
- longitude: 17.9908571
-}
+ longitude: 17.9908571,
+};
const filharmonia = {
type: 'location',
id: '980013218',
latitude: 54.351487,
longitude: 18.659548,
name: 'Gdańsk, Filharmonia',
- poi: true
-}
+ poi: true,
+};
tap.skip('journeys – Wrocław Główny to Kraków Główny', async (t) => {
const res = await client.journeys(wrocławGł, krakówGł, {
results: 4,
departure: when,
- stopovers: true
- })
+ stopovers: true,
+ });
await testJourneysStationToStation({
test: t,
res,
validate,
fromId: wrocławGł,
- toId: krakówGł
- })
- t.end()
-})
+ toId: krakówGł,
+ });
+ t.end();
+});
// todo: via works – with detour
// todo: without detour
tap.skip('trip details', async (t) => {
const res = await client.journeys(wrocławGł, krakówGł, {
- results: 1, departure: when
- })
+ results: 1, departure: when,
+ });
- const p = res.journeys[0].legs.find(l => !l.walking)
- t.ok(p.tripId, 'precondition failed')
- t.ok(p.line.name, 'precondition failed')
+ const p = res.journeys[0].legs.find(l => !l.walking);
+ t.ok(p.tripId, 'precondition failed');
+ t.ok(p.line.name, 'precondition failed');
- const tripRes = await client.trip(p.tripId, {when})
+ const tripRes = await client.trip(p.tripId, {when});
- validate(t, tripRes, 'tripResult', 'res')
- t.end()
-})
+ validate(t, tripRes, 'tripResult', 'res');
+ t.end();
+});
tap.skip('arrivals at Kraków Główny', async (t) => {
const arrivals = await client.arrivals(krakówGł, {
- duration: 10, when
- })
+ duration: 10, when,
+ });
await testArrivals({
test: t,
arrivals,
id: krakówGł,
- validate
- })
- t.end()
-})
+ validate,
+ });
+ t.end();
+});
tap.skip('nearby', async (t) => {
- const nearby = await client.nearby(dworcowa100, { distance: 500 })
+ const nearby = await client.nearby(dworcowa100, {distance: 500});
- validate(t, nearby, 'locations', 'nearby')
+ validate(t, nearby, 'locations', 'nearby');
- const bydgoszczGł = '5100005'
- t.ok(nearby.find(l => l.id === bydgoszczGł))
+ const bydgoszczGł = '5100005';
+ t.ok(nearby.find(l => l.id === bydgoszczGł));
- t.end()
-})
+ t.end();
+});
tap.skip('radar', async (t) => {
const res = await client.radar({
north: 48.74453,
west: 11.42733,
south: 48.73453,
- east: 11.43733
+ east: 11.43733,
}, {
- duration: 5 * 60, when, results: 10
- })
+ duration: 5 * 60, when, results: 10,
+ });
- validate(t, res, 'radarResult', 'res')
- t.end()
-})
+ validate(t, res, 'radarResult', 'res');
+ t.end();
+});
tap.skip('reachableFrom', async (t) => {
await testReachableFrom({
@@ -149,7 +155,7 @@ tap.skip('reachableFrom', async (t) => {
address: dworcowa100,
when,
maxDuration: 20,
- validate
- })
- t.end()
-})
+ validate,
+ });
+ t.end();
+});
diff --git a/test/e2e/rejseplanen.js b/test/e2e/rejseplanen.js
index 626a0d5e..bbd7ff19 100644
--- a/test/e2e/rejseplanen.js
+++ b/test/e2e/rejseplanen.js
@@ -1,19 +1,19 @@
-import tap from 'tap'
-import assert from 'assert'
+import tap from 'tap';
+import assert from 'assert';
-import {createWhen} from './lib/util.js'
-import {createClient} from '../../index.js'
-import {profile as rejseplanenProfile} from '../../p/rejseplanen/index.js'
-import {createValidateFptfWith as createValidate} from './lib/validate-fptf-with.js'
-import {testJourneysStationToStation} from './lib/journeys-station-to-station.js'
-import {journeysFailsWithNoProduct} from './lib/journeys-fails-with-no-product.js'
-import {testJourneysStationToAddress} from './lib/journeys-station-to-address.js'
-import {testEarlierLaterJourneys} from './lib/earlier-later-journeys.js'
-import {testDepartures} from './lib/departures.js'
-import {testArrivals} from './lib/arrivals.js'
+import {createWhen} from './lib/util.js';
+import {createClient} from '../../index.js';
+import {profile as rejseplanenProfile} from '../../p/rejseplanen/index.js';
+import {createValidateFptfWith as createValidate} from './lib/validate-fptf-with.js';
+import {testJourneysStationToStation} from './lib/journeys-station-to-station.js';
+import {journeysFailsWithNoProduct} from './lib/journeys-fails-with-no-product.js';
+import {testJourneysStationToAddress} from './lib/journeys-station-to-address.js';
+import {testEarlierLaterJourneys} from './lib/earlier-later-journeys.js';
+import {testDepartures} from './lib/departures.js';
+import {testArrivals} from './lib/arrivals.js';
-const T_MOCK = 1671260400 * 1000 // 2022-12-17T08:00:00+01:00
-const when = createWhen(rejseplanenProfile.timezone, rejseplanenProfile.locale, T_MOCK)
+const T_MOCK = 1671260400 * 1000; // 2022-12-17T08:00:00+01:00
+const when = createWhen(rejseplanenProfile.timezone, rejseplanenProfile.locale, T_MOCK);
const validate = createValidate({
when,
@@ -22,20 +22,20 @@ const validate = createValidate({
maxLatitude: 58.85,
minLongitude: 5.8,
maxLongitude: 15.7,
-}, {})
+}, {});
-const client = createClient(rejseplanenProfile, 'public-transport/hafas-client:test')
+const client = createClient(rejseplanenProfile, 'public-transport/hafas-client:test');
-const næstved = '8600810'
-const randers = '8600040'
-const aalborg = '8600020'
+const næstved = '8600810';
+const randers = '8600040';
+const aalborg = '8600020';
tap.test('journeys – Næstved to Aalborg', async (t) => {
const res = await client.journeys(næstved, aalborg, {
results: 4,
departure: when,
stopovers: true,
- })
+ });
await testJourneysStationToStation({
test: t,
@@ -43,9 +43,9 @@ tap.test('journeys – Næstved to Aalborg', async (t) => {
validate,
fromId: næstved,
toId: aalborg,
- })
- t.end()
-})
+ });
+ t.end();
+});
// todo: journeys, only one product
@@ -57,9 +57,9 @@ tap.test('journeys – fails with no product', async (t) => {
toId: aalborg,
when,
products: rejseplanenProfile.products,
- })
- t.end()
-})
+ });
+ t.end();
+});
tap.test('Randers to Møllegade 3, København', async (t) => {
const møllegade3 = {
@@ -67,12 +67,12 @@ tap.test('Randers to Møllegade 3, København', async (t) => {
id: '901011579',
address: 'Møllegade 3, 2200 København N, Københavns Kommune',
latitude: 55.69052, longitude: 12.555494,
- }
+ };
const res = await client.journeys(randers, møllegade3, {
results: 3,
departure: when,
- })
+ });
await testJourneysStationToAddress({
test: t,
@@ -80,9 +80,9 @@ tap.test('Randers to Møllegade 3, København', async (t) => {
validate,
fromId: randers,
to: møllegade3,
- })
- t.end()
-})
+ });
+ t.end();
+});
// todo: journeys: via works – with detour
// todo: without detour
@@ -95,30 +95,30 @@ tap.test('earlier/later journeys', async (t) => {
fromId: randers,
toId: næstved,
when,
- })
+ });
- t.end()
-})
+ t.end();
+});
tap.test('trip', async (t) => {
- const { journeys } = await client.journeys(aalborg, næstved, {
+ const {journeys} = await client.journeys(aalborg, næstved, {
results: 1, departure: when,
- })
+ });
- const p = journeys[0].legs.find(l => !l.walking)
- t.ok(p.tripId, 'precondition failed')
- t.ok(p.line.name, 'precondition failed')
+ const p = journeys[0].legs.find(l => !l.walking);
+ t.ok(p.tripId, 'precondition failed');
+ t.ok(p.line.name, 'precondition failed');
- const tripRes = await client.trip(p.tripId, {when})
+ const tripRes = await client.trip(p.tripId, {when});
- validate(t, tripRes, 'tripResult', 'res')
- t.end()
-})
+ validate(t, tripRes, 'tripResult', 'res');
+ t.end();
+});
tap.test('departures at Næstved.', async (t) => {
const res = await client.departures(næstved, {
duration: 20, when,
- })
+ });
await testDepartures({
test: t,
@@ -129,14 +129,14 @@ tap.test('departures at Næstved.', async (t) => {
'8650810', // Næstved St. (togbus)
'8651810', // Næstved St. (togbus)
],
- })
- t.end()
-})
+ });
+ t.end();
+});
tap.test('arrivals at Næstved.', async (t) => {
const res = await client.arrivals(næstved, {
- duration: 20, when
- })
+ duration: 20, when,
+ });
await testArrivals({
test: t,
@@ -147,38 +147,40 @@ tap.test('arrivals at Næstved.', async (t) => {
'8650810', // Næstved St. (togbus)
'8651810', // Næstved St. (togbus)
],
- })
- t.end()
-})
+ });
+ t.end();
+});
// todo: nearby
tap.test('locations named "næstved"', async (t) => {
const locations = await client.locations('næstved', {
results: 20,
- })
+ });
- validate(t, locations, 'locations', 'locations')
- t.ok(locations.length <= 20)
+ validate(t, locations, 'locations', 'locations');
+ t.ok(locations.length <= 20);
- t.ok(locations.find(s => s.type === 'stop' || s.type === 'station'))
- t.ok(locations.find(s => s.poi))
+ t.ok(locations.find(s => s.type === 'stop' || s.type === 'station'));
+ t.ok(locations.find(s => s.poi));
t.ok(locations.some((loc) => {
- if (loc.station && loc.station.id === næstved) return true
- return loc.id === næstved
- }))
+ if (loc.station && loc.station.id === næstved) {
+ return true;
+ }
+ return loc.id === næstved;
+ }));
- t.end()
-})
+ t.end();
+});
tap.test('stop Næstved', async (t) => {
- const s = await client.stop(næstved)
+ const s = await client.stop(næstved);
- validate(t, s, ['stop', 'station'], 'stop')
- t.equal(s.id, næstved)
+ validate(t, s, ['stop', 'station'], 'stop');
+ t.equal(s.id, næstved);
- t.end()
-})
+ t.end();
+});
tap.test('radar', async (t) => {
const res = await client.radar({
@@ -188,8 +190,8 @@ tap.test('radar', async (t) => {
east: 12.621,
}, {
duration: 5 * 60, when, results: 10,
- })
+ });
- validate(t, res, 'radarResult', 'res')
- t.end()
-})
+ validate(t, res, 'radarResult', 'res');
+ t.end();
+});
diff --git a/test/e2e/rmv.js b/test/e2e/rmv.js
index a246914b..109f85e8 100644
--- a/test/e2e/rmv.js
+++ b/test/e2e/rmv.js
@@ -1,15 +1,15 @@
-import tap from 'tap'
+import tap from 'tap';
-import {createWhen} from './lib/util.js'
-import {createClient} from '../../index.js'
-import {profile as rmvProfile} from '../../p/rmv/index.js'
-import {createValidateFptfWith as createValidate} from './lib/validate-fptf-with.js'
-import {testJourneysStationToStation} from './lib/journeys-station-to-station.js'
-import {testArrivals} from './lib/arrivals.js'
-import {testReachableFrom} from './lib/reachable-from.js'
+import {createWhen} from './lib/util.js';
+import {createClient} from '../../index.js';
+import {profile as rmvProfile} from '../../p/rmv/index.js';
+import {createValidateFptfWith as createValidate} from './lib/validate-fptf-with.js';
+import {testJourneysStationToStation} from './lib/journeys-station-to-station.js';
+import {testArrivals} from './lib/arrivals.js';
+import {testReachableFrom} from './lib/reachable-from.js';
-const T_MOCK = 1668495600 * 1000 // 2022-11-15T08:00:00+01:00
-const when = createWhen(rmvProfile.timezone, rmvProfile.locale, T_MOCK)
+const T_MOCK = 1668495600 * 1000; // 2022-11-15T08:00:00+01:00
+const when = createWhen(rmvProfile.timezone, rmvProfile.locale, T_MOCK);
const cfg = {
when,
@@ -19,63 +19,63 @@ const cfg = {
maxLatitude: 54,
minLongitude: 6,
maxLongitude: 11,
-}
+};
-const validate = createValidate(cfg)
+const validate = createValidate(cfg);
-const client = createClient(rmvProfile, 'public-transport/hafas-client:test')
+const client = createClient(rmvProfile, 'public-transport/hafas-client:test');
-const frankfurtOstendstr = '3000525'
-const wiesbadenHbf = '3006907'
+const frankfurtOstendstr = '3000525';
+const wiesbadenHbf = '3006907';
tap.test('journeys – Frankfurt Ostendstr. to Wiesbaden Hbf', async (t) => {
const res = await client.journeys(frankfurtOstendstr, wiesbadenHbf, {
results: 4,
departure: when,
- stopovers: true
- })
+ stopovers: true,
+ });
await testJourneysStationToStation({
test: t,
res,
validate,
fromId: frankfurtOstendstr,
- toId: wiesbadenHbf
- })
- t.end()
-})
+ toId: wiesbadenHbf,
+ });
+ t.end();
+});
// todo: via works – with detour
// todo: without detour
tap.test('trip details', async (t) => {
const res = await client.journeys(frankfurtOstendstr, wiesbadenHbf, {
- results: 1, departure: when
- })
+ results: 1, departure: when,
+ });
- const p = res.journeys[0].legs.find(l => !l.walking)
- t.ok(p.tripId, 'precondition failed')
- t.ok(p.line.name, 'precondition failed')
+ const p = res.journeys[0].legs.find(l => !l.walking);
+ t.ok(p.tripId, 'precondition failed');
+ t.ok(p.line.name, 'precondition failed');
- const tripRes = await client.trip(p.tripId, {when})
+ const tripRes = await client.trip(p.tripId, {when});
- validate(t, tripRes, 'tripResult', 'res')
- t.end()
-})
+ validate(t, tripRes, 'tripResult', 'res');
+ t.end();
+});
tap.test('arrivals at Wiesbaden Hbf', async (t) => {
const res = await client.arrivals(wiesbadenHbf, {
- duration: 10, when
- })
+ duration: 10, when,
+ });
await testArrivals({
test: t,
res,
validate,
id: wiesbadenHbf,
- })
- t.end()
-})
+ });
+ t.end();
+});
// todo: nearby
@@ -84,14 +84,14 @@ tap.test('radar', async (t) => {
north: 53.090516,
west: 8.750106,
south: 53.062859,
- east: 8.847423
+ east: 8.847423,
}, {
- duration: 5 * 60, when, results: 10
- })
+ duration: 5 * 60, when, results: 10,
+ });
- validate(t, res, 'radarResult', 'res')
- t.end()
-})
+ validate(t, res, 'radarResult', 'res');
+ t.end();
+});
tap.test('reachableFrom', async (t) => {
await testReachableFrom({
@@ -106,7 +106,7 @@ tap.test('reachableFrom', async (t) => {
},
when,
maxDuration: 15,
- validate
- })
- t.end()
-})
+ validate,
+ });
+ t.end();
+});
diff --git a/test/e2e/rsag.js b/test/e2e/rsag.js
index 9a36cdee..a21b4e19 100644
--- a/test/e2e/rsag.js
+++ b/test/e2e/rsag.js
@@ -1,17 +1,17 @@
-import tap from 'tap'
+import tap from 'tap';
-import {createWhen} from './lib/util.js'
-import {createClient} from '../../index.js'
-import {profile as rsagProfile} from '../../p/rsag/index.js'
-import {createValidateFptfWith as createValidate} from './lib/validate-fptf-with.js'
-import {testJourneysStationToStation} from './lib/journeys-station-to-station.js'
-import {testEarlierLaterJourneys} from './lib/earlier-later-journeys.js'
-import {testRefreshJourney} from './lib/refresh-journey.js'
-import {testArrivals} from './lib/arrivals.js'
-import {testReachableFrom} from './lib/reachable-from.js'
+import {createWhen} from './lib/util.js';
+import {createClient} from '../../index.js';
+import {profile as rsagProfile} from '../../p/rsag/index.js';
+import {createValidateFptfWith as createValidate} from './lib/validate-fptf-with.js';
+import {testJourneysStationToStation} from './lib/journeys-station-to-station.js';
+import {testEarlierLaterJourneys} from './lib/earlier-later-journeys.js';
+import {testRefreshJourney} from './lib/refresh-journey.js';
+import {testArrivals} from './lib/arrivals.js';
+import {testReachableFrom} from './lib/reachable-from.js';
-const T_MOCK = 1671260400 * 1000 // 2022-12-17T08:00:00+01:00
-const when = createWhen(rsagProfile.timezone, rsagProfile.locale, T_MOCK)
+const T_MOCK = 1671260400 * 1000; // 2022-12-17T08:00:00+01:00
+const when = createWhen(rsagProfile.timezone, rsagProfile.locale, T_MOCK);
const cfg = {
when,
@@ -21,22 +21,22 @@ const cfg = {
maxLatitude: 54.862,
minLongitude: 9.121,
maxLongitude: 14.824,
-}
+};
-const validate = createValidate(cfg)
+const validate = createValidate(cfg);
-const client = createClient(rsagProfile, 'public-transport/hafas-client:test')
+const client = createClient(rsagProfile, 'public-transport/hafas-client:test');
-const sternwarte = '704956'
-const sternwarte2 = '708539'
-const weißesKreuz = '708573'
+const sternwarte = '704956';
+const sternwarte2 = '708539';
+const weißesKreuz = '708573';
tap.test('journeys – Platz der Jugend to Weißes Kreuz', async (t) => {
const res = await client.journeys(sternwarte, weißesKreuz, {
results: 4,
departure: when,
- stopovers: true
- })
+ stopovers: true,
+ });
await testJourneysStationToStation({
test: t,
@@ -44,9 +44,9 @@ tap.test('journeys – Platz der Jugend to Weißes Kreuz', async (t) => {
validate,
fromIds: [sternwarte, sternwarte2],
toId: weißesKreuz,
- })
- t.end()
-})
+ });
+ t.end();
+});
// todo: journeys, walkingSpeed
// todo: via works – with detour
@@ -58,11 +58,11 @@ tap.test('earlier/later journeys', async (t) => {
validate,
fromId: sternwarte,
toId: weißesKreuz,
- when
- })
+ when,
+ });
- t.end()
-})
+ t.end();
+});
tap.test('refreshJourney', async (t) => {
await testRefreshJourney({
@@ -72,15 +72,15 @@ tap.test('refreshJourney', async (t) => {
validate,
fromId: sternwarte,
toId: weißesKreuz,
- when
- })
- t.end()
-})
+ when,
+ });
+ t.end();
+});
tap.test('arrivals at Platz der Jugend', async (t) => {
const res = await client.arrivals(sternwarte, {
- duration: 30, when
- })
+ duration: 30, when,
+ });
await testArrivals({
test: t,
@@ -90,9 +90,9 @@ tap.test('arrivals at Platz der Jugend', async (t) => {
sternwarte,
'708539', // Rostock Sternwarte
],
- })
- t.end()
-})
+ });
+ t.end();
+});
// todo: nearby
@@ -101,14 +101,14 @@ tap.test('radar', async (t) => {
north: 54.116968,
west: 12.029738,
south: 54.060517,
- east: 12.203261
+ east: 12.203261,
}, {
- duration: 5 * 60, when, results: 10
- })
+ duration: 5 * 60, when, results: 10,
+ });
- validate(t, res, 'radarResult', 'res')
- t.end()
-})
+ validate(t, res, 'radarResult', 'res');
+ t.end();
+});
tap.test('reachableFrom', async (t) => {
await testReachableFrom({
@@ -118,11 +118,11 @@ tap.test('reachableFrom', async (t) => {
type: 'location',
id: '990004158',
address: 'Rostock - Stadtmitte, Pläterstraße 2',
- latitude: 54.091285, longitude: 12.13648
+ latitude: 54.091285, longitude: 12.13648,
},
when,
maxDuration: 15,
- validate
- })
- t.end()
-})
+ validate,
+ });
+ t.end();
+});
diff --git a/test/e2e/saarfahrplan.js b/test/e2e/saarfahrplan.js
index 31ce490b..bfac419c 100644
--- a/test/e2e/saarfahrplan.js
+++ b/test/e2e/saarfahrplan.js
@@ -1,25 +1,25 @@
-import tap from 'tap'
-import isRoughlyEqual from 'is-roughly-equal'
+import tap from 'tap';
+import isRoughlyEqual from 'is-roughly-equal';
-import {createWhen} from './lib/util.js'
-import {createClient} from '../../index.js'
-import {profile as saarfahrplanProfile} from '../../p/saarfahrplan/index.js'
+import {createWhen} from './lib/util.js';
+import {createClient} from '../../index.js';
+import {profile as saarfahrplanProfile} from '../../p/saarfahrplan/index.js';
import {
createValidateStation,
createValidateStop,
-} from './lib/validators.js'
-import {createValidateFptfWith as createValidate} from './lib/validate-fptf-with.js'
-import {testJourneysStationToStation} from './lib/journeys-station-to-station.js'
-import {testJourneysStationToAddress} from './lib/journeys-station-to-address.js'
-import {testJourneysStationToPoi} from './lib/journeys-station-to-poi.js'
-import {testEarlierLaterJourneys} from './lib/earlier-later-journeys.js'
-import {journeysFailsWithNoProduct} from './lib/journeys-fails-with-no-product.js'
-import {testJourneysWithDetour} from './lib/journeys-with-detour.js'
-import {testDepartures} from './lib/departures.js'
-import {testDeparturesInDirection} from './lib/departures-in-direction.js'
+} from './lib/validators.js';
+import {createValidateFptfWith as createValidate} from './lib/validate-fptf-with.js';
+import {testJourneysStationToStation} from './lib/journeys-station-to-station.js';
+import {testJourneysStationToAddress} from './lib/journeys-station-to-address.js';
+import {testJourneysStationToPoi} from './lib/journeys-station-to-poi.js';
+import {testEarlierLaterJourneys} from './lib/earlier-later-journeys.js';
+import {journeysFailsWithNoProduct} from './lib/journeys-fails-with-no-product.js';
+import {testJourneysWithDetour} from './lib/journeys-with-detour.js';
+import {testDepartures} from './lib/departures.js';
+import {testDeparturesInDirection} from './lib/departures-in-direction.js';
-const T_MOCK = 1671260400 * 1000 // 2022-12-17T08:00:00+01:00
-const when = createWhen(saarfahrplanProfile.timezone, saarfahrplanProfile.locale, T_MOCK)
+const T_MOCK = 1671260400 * 1000; // 2022-12-17T08:00:00+01:00
+const when = createWhen(saarfahrplanProfile.timezone, saarfahrplanProfile.locale, T_MOCK);
const cfg = {
when,
@@ -28,40 +28,40 @@ const cfg = {
minLatitude: 49,
maxLatitude: 49.6,
minLongitude: 6.1,
- maxLongitude: 7.5
-}
+ maxLongitude: 7.5,
+};
// @todo validateDirection: search list of stations for direction
-const validate = createValidate(cfg)
+const validate = createValidate(cfg);
const assertValidPrice = (t, p) => {
- t.ok(p)
+ t.ok(p);
if (p.amount !== null) {
- t.equal(typeof p.amount, 'number')
- t.ok(p.amount > 0)
+ t.equal(typeof p.amount, 'number');
+ t.ok(p.amount > 0);
}
if (p.hint !== null) {
- t.equal(typeof p.hint, 'string')
- t.ok(p.hint)
+ t.equal(typeof p.hint, 'string');
+ t.ok(p.hint);
}
-}
+};
-const client = createClient(saarfahrplanProfile, 'public-transport/hafas-client:test')
+const client = createClient(saarfahrplanProfile, 'public-transport/hafas-client:test');
-const saarbrueckenHbf = '8000323'
+const saarbrueckenHbf = '8000323';
// This seems to be the bus/tram stop. 🙄
-const hauptbahnhofSaarbruecken = '10600'
-const saarlouisHbf = '8005247'
-const metzVille = '8700019'
-const saarbrueckenUhlandstr = '10609'
+const hauptbahnhofSaarbruecken = '10600';
+const saarlouisHbf = '8005247';
+const metzVille = '8700019';
+const saarbrueckenUhlandstr = '10609';
const thomasMannStr = {
type: 'location',
address: 'Neunkirchen, Thomas-Mann-Straße 1',
latitude: 49.348307,
- longitude: 7.183613
-}
+ longitude: 7.183613,
+};
// @todo prices/tickets
// @todo journeys, only one product
@@ -74,25 +74,25 @@ tap.test('journeys – fails with no product', async (t) => {
toId: saarlouisHbf,
when,
products: saarfahrplanProfile.products,
- })
- t.end()
-})
+ });
+ t.end();
+});
tap.test('Saarbrücken Hbf to Neunkirchen, Thomas-Mann-Straße 1', async (t) => {
const res = await client.journeys(saarbrueckenHbf, thomasMannStr, {
results: 3,
- departure: when
- })
+ departure: when,
+ });
await testJourneysStationToAddress({
test: t,
res,
validate,
fromId: saarbrueckenHbf,
- to: thomasMannStr
- })
- t.end()
-})
+ to: thomasMannStr,
+ });
+ t.end();
+});
tap.test('Saarbrücken Hbf to Schlossberghöhlen', async (t) => {
const schlossberghoehlen = {
@@ -101,43 +101,43 @@ tap.test('Saarbrücken Hbf to Schlossberghöhlen', async (t) => {
poi: true,
name: 'Homburg, Schlossberghöhlen',
latitude: 49.32071,
- longitude: 7.343764
- }
+ longitude: 7.343764,
+ };
const res = await client.journeys(saarbrueckenHbf, schlossberghoehlen, {
- results: 3, departure: when
- })
+ results: 3, departure: when,
+ });
await testJourneysStationToPoi({
test: t,
res,
validate,
fromId: saarbrueckenHbf,
- to: schlossberghoehlen
- })
- t.end()
-})
+ to: schlossberghoehlen,
+ });
+ t.end();
+});
tap.test('journeys: via works – with detour', async (t) => {
// Going from Lessingstr. to An der Trift via Steubenstr. without detour
// is currently impossible. We check if the routing engine computes a detour.
- const lessingstr = '10615'
- const anDerTrift = '10801'
- const steubenstr = '10051'
+ const lessingstr = '10615';
+ const anDerTrift = '10801';
+ const steubenstr = '10051';
const res = await client.journeys(lessingstr, anDerTrift, {
via: steubenstr,
results: 1,
departure: when,
- stopovers: true
- })
+ stopovers: true,
+ });
await testJourneysWithDetour({
test: t,
res,
validate,
detourIds: [steubenstr],
- })
- t.end()
-})
+ });
+ t.end();
+});
// todo: journeys: via works – without detour
@@ -148,40 +148,40 @@ tap.test('earlier/later journeys, Saarbrücken Hbf -> Saarlouis Hbf', async (t)
validate,
fromId: saarbrueckenHbf,
toId: saarlouisHbf,
- when
- })
+ when,
+ });
- t.end()
-})
+ t.end();
+});
tap.test('trip details', async (t) => {
const res = await client.journeys(saarlouisHbf, metzVille, {
- results: 1, departure: when
- })
+ results: 1, departure: when,
+ });
- const p = res.journeys[0].legs.find(l => !l.walking)
- t.ok(p.tripId, 'precondition failed')
- t.ok(p.line.name, 'precondition failed')
+ const p = res.journeys[0].legs.find(l => !l.walking);
+ t.ok(p.tripId, 'precondition failed');
+ t.ok(p.line.name, 'precondition failed');
- const tripRes = await client.trip(p.tripId, { when })
+ const tripRes = await client.trip(p.tripId, {when});
- validate(t, tripRes, 'tripResult', 'res')
- t.end()
-})
+ validate(t, tripRes, 'tripResult', 'res');
+ t.end();
+});
tap.test('departures', async (t) => {
const res = await client.departures(saarbrueckenUhlandstr, {
- duration: 5, when
- })
+ duration: 5, when,
+ });
await testDepartures({
test: t,
res,
validate,
id: saarbrueckenUhlandstr,
- })
- t.end()
-})
+ });
+ t.end();
+});
tap.test('departures with stop object', async (t) => {
const res = await client.departures({
@@ -191,16 +191,16 @@ tap.test('departures with stop object', async (t) => {
location: {
type: 'location',
latitude: 49.241066,
- longitude: 6.991019
- }
- }, {when})
+ longitude: 6.991019,
+ },
+ }, {when});
- validate(t, res, 'departuresResponse', 'res')
- t.end()
-})
+ validate(t, res, 'departuresResponse', 'res');
+ t.end();
+});
tap.test('departures at Uhlandstr., Saarbrücken in direction of Landwehrplatz', async (t) => {
- const saarbrueckenLandwehrplatz = '10606'
+ const saarbrueckenLandwehrplatz = '10606';
await testDeparturesInDirection({
test: t,
fetchDepartures: client.departures,
@@ -208,10 +208,10 @@ tap.test('departures at Uhlandstr., Saarbrücken in direction of Landwehrplatz',
id: saarbrueckenUhlandstr,
directionIds: [saarbrueckenLandwehrplatz],
when,
- validate
- })
- t.end()
-})
+ validate,
+ });
+ t.end();
+});
// todo: arrivals
@@ -219,62 +219,62 @@ tap.test('nearby Saarbrücken Hbf', async (t) => {
const nearby = await client.nearby({
type: 'location',
latitude: 49.241066,
- longitude: 6.991019
+ longitude: 6.991019,
}, {
- results: 5, distance: 400
- })
+ results: 5, distance: 400,
+ });
- validate(t, nearby, 'locations', 'nearby')
- t.equal(nearby.length, 5)
+ validate(t, nearby, 'locations', 'nearby');
+ t.equal(nearby.length, 5);
- const s = nearby[0]
- t.equal(s.id, saarbrueckenHbf, 'id should be ' + saarbrueckenHbf)
- t.equal(s.name, 'Saarbrücken Hbf')
- t.ok(isRoughlyEqual(0.0005, s.location.latitude, 49.241066))
- t.ok(isRoughlyEqual(0.0005, s.location.longitude, 6.991019))
- t.ok(s.distance >= 0)
- t.ok(s.distance <= 100)
+ const s = nearby[0];
+ t.equal(s.id, saarbrueckenHbf, 'id should be ' + saarbrueckenHbf);
+ t.equal(s.name, 'Saarbrücken Hbf');
+ t.ok(isRoughlyEqual(0.0005, s.location.latitude, 49.241066));
+ t.ok(isRoughlyEqual(0.0005, s.location.longitude, 6.991019));
+ t.ok(s.distance >= 0);
+ t.ok(s.distance <= 100);
- t.end()
-})
+ t.end();
+});
tap.test('locations named Saarbrücken', async (t) => {
- const aufDerWerthBürgerpark = '10204'
+ const aufDerWerthBürgerpark = '10204';
const locations = await client.locations('bürgerpark', {
- results: 20
- })
+ results: 20,
+ });
- validate(t, locations, 'locations', 'locations')
- t.ok(locations.length <= 20)
+ validate(t, locations, 'locations', 'locations');
+ t.ok(locations.length <= 20);
- t.ok(locations.find(s => s.type === 'stop' || s.type === 'station'))
- t.ok(locations.find(s => s.poi)) // POIs
+ t.ok(locations.find(s => s.type === 'stop' || s.type === 'station'));
+ t.ok(locations.find(s => s.poi)); // POIs
t.ok(locations.some((s) => {
- return s.station && s.station.id === aufDerWerthBürgerpark || s.id === aufDerWerthBürgerpark
- }))
+ return s.station && s.station.id === aufDerWerthBürgerpark || s.id === aufDerWerthBürgerpark;
+ }));
- t.end()
-})
+ t.end();
+});
tap.test('stop', async (t) => {
- const s = await client.stop(saarbrueckenUhlandstr)
+ const s = await client.stop(saarbrueckenUhlandstr);
- validate(t, s, ['stop', 'station'], 'stop')
- t.equal(s.id, saarbrueckenUhlandstr)
+ validate(t, s, ['stop', 'station'], 'stop');
+ t.equal(s.id, saarbrueckenUhlandstr);
- t.end()
-})
+ t.end();
+});
tap.test('radar', async (t) => {
const res = await client.radar({
north: 49.27,
west: 6.97,
south: 49.22,
- east: 7.02
+ east: 7.02,
}, {
- duration: 5 * 60, when
- })
+ duration: 5 * 60, when,
+ });
- validate(t, res, 'radarResult', 'res')
- t.end()
-})
+ validate(t, res, 'radarResult', 'res');
+ t.end();
+});
diff --git a/test/e2e/salzburg.js b/test/e2e/salzburg.js
index 0aadef9d..7ebbe585 100644
--- a/test/e2e/salzburg.js
+++ b/test/e2e/salzburg.js
@@ -1,12 +1,12 @@
-import tap from 'tap'
+import tap from 'tap';
-import {createWhen} from './lib/util.js'
-import {createClient} from '../../index.js'
-import {profile as salzburgProfile} from '../../p/salzburg/index.js'
-import {createValidateFptfWith as createValidate} from './lib/validate-fptf-with.js'
+import {createWhen} from './lib/util.js';
+import {createClient} from '../../index.js';
+import {profile as salzburgProfile} from '../../p/salzburg/index.js';
+import {createValidateFptfWith as createValidate} from './lib/validate-fptf-with.js';
-const T_MOCK = 1671260400 * 1000 // 2022-12-17T08:00:00+01:00
-const when = createWhen(salzburgProfile.timezone, salzburgProfile.locale, T_MOCK)
+const T_MOCK = 1671260400 * 1000; // 2022-12-17T08:00:00+01:00
+const when = createWhen(salzburgProfile.timezone, salzburgProfile.locale, T_MOCK);
const cfg = {
when,
@@ -16,20 +16,20 @@ const cfg = {
maxLongitude: 17.0892,
minLatitude: 45.7206,
minLongitude: 7.8635,
-}
-const validate = createValidate(cfg)
+};
+const validate = createValidate(cfg);
-const client = createClient(salzburgProfile, 'public-transport/hafas-client:test')
+const client = createClient(salzburgProfile, 'public-transport/hafas-client:test');
-const salzburgGaswerkgasse = '455001300'
+const salzburgGaswerkgasse = '455001300';
tap.test('locations named "gaswerkgasse"', async (t) => {
- const locations = await client.locations('gaswerkgasse')
+ const locations = await client.locations('gaswerkgasse');
- validate(t, locations, 'locations', 'locations')
+ validate(t, locations, 'locations', 'locations');
t.ok(locations.some((l) => {
- return l.station && l.station.id === salzburgGaswerkgasse || l.id === salzburgGaswerkgasse
- }), 'Salzburg Gaswerkgasse not found')
+ return l.station && l.station.id === salzburgGaswerkgasse || l.id === salzburgGaswerkgasse;
+ }), 'Salzburg Gaswerkgasse not found');
- t.end()
-})
+ t.end();
+});
diff --git a/test/e2e/sbahn-muenchen.js b/test/e2e/sbahn-muenchen.js
index 720c5813..624cc4a4 100644
--- a/test/e2e/sbahn-muenchen.js
+++ b/test/e2e/sbahn-muenchen.js
@@ -1,23 +1,23 @@
-import tap from 'tap'
+import tap from 'tap';
-import {createWhen} from './lib/util.js'
-import {createClient} from '../../index.js'
-import {profile as sMunichProfile} from '../../p/sbahn-muenchen/index.js'
-import {createValidateMovement as _createValidateMovement} from './lib/validators.js'
-import {createValidateFptfWith as createValidate} from './lib/validate-fptf-with.js'
-import {testJourneysStationToStation} from './lib/journeys-station-to-station.js'
-import {testJourneysStationToAddress} from './lib/journeys-station-to-address.js'
-import {testJourneysStationToPoi} from './lib/journeys-station-to-poi.js'
-import {testEarlierLaterJourneys} from './lib/earlier-later-journeys.js'
-import {testRefreshJourney} from './lib/refresh-journey.js'
-import {journeysFailsWithNoProduct} from './lib/journeys-fails-with-no-product.js'
-import {testDepartures} from './lib/departures.js'
-import {testArrivals} from './lib/arrivals.js'
-import {testJourneysWithDetour} from './lib/journeys-with-detour.js'
-import {testReachableFrom} from './lib/reachable-from.js'
+import {createWhen} from './lib/util.js';
+import {createClient} from '../../index.js';
+import {profile as sMunichProfile} from '../../p/sbahn-muenchen/index.js';
+import {createValidateMovement as _createValidateMovement} from './lib/validators.js';
+import {createValidateFptfWith as createValidate} from './lib/validate-fptf-with.js';
+import {testJourneysStationToStation} from './lib/journeys-station-to-station.js';
+import {testJourneysStationToAddress} from './lib/journeys-station-to-address.js';
+import {testJourneysStationToPoi} from './lib/journeys-station-to-poi.js';
+import {testEarlierLaterJourneys} from './lib/earlier-later-journeys.js';
+import {testRefreshJourney} from './lib/refresh-journey.js';
+import {journeysFailsWithNoProduct} from './lib/journeys-fails-with-no-product.js';
+import {testDepartures} from './lib/departures.js';
+import {testArrivals} from './lib/arrivals.js';
+import {testJourneysWithDetour} from './lib/journeys-with-detour.js';
+import {testReachableFrom} from './lib/reachable-from.js';
-const T_MOCK = 1668495600 * 1000 // 2022-11-15T08:00:00+01:00
-const when = createWhen(sMunichProfile.timezone, sMunichProfile.locale, T_MOCK)
+const T_MOCK = 1668495600 * 1000; // 2022-11-15T08:00:00+01:00
+const when = createWhen(sMunichProfile.timezone, sMunichProfile.locale, T_MOCK);
const cfg = {
when,
@@ -26,55 +26,55 @@ const cfg = {
minLatitude: 48,
maxLatitude: 48.3,
minLongitude: 11.3,
- maxLongitude: 11.8
-}
+ maxLongitude: 11.8,
+};
-const _validateMovement = _createValidateMovement(cfg)
+const _validateMovement = _createValidateMovement(cfg);
const validateMovement = (val, m, name = 'movement') => {
- const dummyStopA = {type: 'stop', id: '123'}
- const dummyStopB = {type: 'stop', id: '321'}
+ const dummyStopA = {type: 'stop', id: '123'};
+ const dummyStopB = {type: 'stop', id: '321'};
- const withFakeFrame = Object.assign({}, m)
+ const withFakeFrame = Object.assign({}, m);
if (!m.frames.length) {
withFakeFrame.frames = [
- {t: 5, origin: dummyStopA, destination: dummyStopB}
- ]
+ {t: 5, origin: dummyStopA, destination: dummyStopB},
+ ];
}
- _validateMovement(val, withFakeFrame, name)
-}
+ _validateMovement(val, withFakeFrame, name);
+};
const validate = createValidate(cfg, {
- movement: validateMovement
-})
+ movement: validateMovement,
+});
-const client = createClient(sMunichProfile, 'public-transport/hafas-client:test')
+const client = createClient(sMunichProfile, 'public-transport/hafas-client:test');
-const mittersendling = '8004154'
-const karlTheodorStr = '638842' // Karl-Theodor-Straße
-const lehel = '624826'
+const mittersendling = '8004154';
+const karlTheodorStr = '638842'; // Karl-Theodor-Straße
+const lehel = '624826';
const poetschnerstr = {
type: 'location',
address: 'Pötschnerstraße 3, Neuhausen',
latitude: 48.152499,
- longitude: 11.531695
-}
+ longitude: 11.531695,
+};
tap.test('journeys – Mittersendling to Karl-Theodor-Straße', async (t) => {
const res = await client.journeys(mittersendling, karlTheodorStr, {
results: 4,
departure: when,
- stopovers: true
- })
+ stopovers: true,
+ });
await testJourneysStationToStation({
test: t,
res,
validate,
fromId: mittersendling,
- toId: karlTheodorStr
- })
- t.end()
-})
+ toId: karlTheodorStr,
+ });
+ t.end();
+});
// todo: journeys, only one product
@@ -86,25 +86,25 @@ tap.test('journeys – fails with no product', async (t) => {
toId: karlTheodorStr,
when,
products: sMunichProfile.products,
- })
- t.end()
-})
+ });
+ t.end();
+});
tap.test('Karl-Theodor-Straße to Pötschnerstraße 3, Neuhausen', async (t) => {
const res = await client.journeys(karlTheodorStr, poetschnerstr, {
results: 3,
- departure: when
- })
+ departure: when,
+ });
await testJourneysStationToAddress({
test: t,
res,
validate,
fromId: karlTheodorStr,
- to: poetschnerstr
- })
- t.end()
-})
+ to: poetschnerstr,
+ });
+ t.end();
+});
tap.test('Karl-Theodor-Straße to Hofbräuhaus', async (t) => {
const hofbraeuhaus = {
@@ -113,22 +113,22 @@ tap.test('Karl-Theodor-Straße to Hofbräuhaus', async (t) => {
poi: true,
name: 'München, Hofbräuhaus München',
latitude: 48.137739,
- longitude: 11.579823
- }
+ longitude: 11.579823,
+ };
const res = await client.journeys(karlTheodorStr, hofbraeuhaus, {
results: 3,
- departure: when
- })
+ departure: when,
+ });
await testJourneysStationToPoi({
test: t,
res,
validate,
fromId: karlTheodorStr,
- to: hofbraeuhaus
- })
- t.end()
-})
+ to: hofbraeuhaus,
+ });
+ t.end();
+});
// todo: walkingSpeed "München - Freimann, Gyßlingstraße 78" -> lehel
// todo: via works – with detour
@@ -141,11 +141,11 @@ tap.test('earlier/later journeys', async (t) => {
validate,
fromId: mittersendling,
toId: karlTheodorStr,
- when
- })
+ when,
+ });
- t.end()
-})
+ t.end();
+});
// todo: for some reason, a leg is missing in the journey returned by refreshJourney()
tap.skip('refreshJourney', async (t) => {
@@ -156,40 +156,40 @@ tap.skip('refreshJourney', async (t) => {
validate,
fromId: mittersendling,
toId: karlTheodorStr,
- when
- })
- t.end()
-})
+ when,
+ });
+ t.end();
+});
tap.test('trip details', async (t) => {
const res = await client.journeys(mittersendling, karlTheodorStr, {
- results: 1, departure: when
- })
+ results: 1, departure: when,
+ });
- const p = res.journeys[0].legs.find(l => !l.walking)
- t.ok(p.tripId, 'precondition failed')
- t.ok(p.line.name, 'precondition failed')
+ const p = res.journeys[0].legs.find(l => !l.walking);
+ t.ok(p.tripId, 'precondition failed');
+ t.ok(p.line.name, 'precondition failed');
- const tripRes = await client.trip(p.tripId, {when})
+ const tripRes = await client.trip(p.tripId, {when});
- validate(t, tripRes, 'tripResult', 'res')
- t.end()
-})
+ validate(t, tripRes, 'tripResult', 'res');
+ t.end();
+});
tap.test('departures at Dietlindenstraße', async (t) => {
- const dietlindenstr = '624391'
+ const dietlindenstr = '624391';
const res = await client.departures(dietlindenstr, {
duration: 10, when,
- })
+ });
await testDepartures({
test: t,
res,
validate,
- id: dietlindenstr
- })
- t.end()
-})
+ id: dietlindenstr,
+ });
+ t.end();
+});
tap.test('departures with station object', async (t) => {
const res = await client.departures({
@@ -199,70 +199,70 @@ tap.test('departures with station object', async (t) => {
location: {
type: 'location',
latitude: 48.107418,
- longitude: 11.536306
- }
- }, {when})
+ longitude: 11.536306,
+ },
+ }, {when});
- validate(t, res, 'departuresResponse', 'res')
- t.end()
-})
+ validate(t, res, 'departuresResponse', 'res');
+ t.end();
+});
tap.test('arrivals at Karl-Theodor-Straße', async (t) => {
const res = await client.arrivals(karlTheodorStr, {
duration: 10, when,
- })
+ });
await testArrivals({
test: t,
res,
validate,
- id: karlTheodorStr
- })
- t.end()
-})
+ id: karlTheodorStr,
+ });
+ t.end();
+});
// todo: nearby
tap.test('locations named "Nationaltheater"', async (t) => {
- const nationaltheater = '624639'
+ const nationaltheater = '624639';
const locations = await client.locations('Nationaltheater', {
- results: 10
- })
+ results: 10,
+ });
- validate(t, locations, 'locations', 'locations')
- t.ok(locations.length <= 10)
+ validate(t, locations, 'locations', 'locations');
+ t.ok(locations.length <= 10);
- t.ok(locations.find(s => s.type === 'stop' || s.type === 'station'))
- t.ok(locations.find(s => s.poi)) // POIs
+ t.ok(locations.find(s => s.type === 'stop' || s.type === 'station'));
+ t.ok(locations.find(s => s.poi)); // POIs
t.ok(locations.some((l) => {
- return l.station && l.station.id === nationaltheater || l.id === nationaltheater
- }))
+ return l.station && l.station.id === nationaltheater || l.id === nationaltheater;
+ }));
- t.end()
-})
+ t.end();
+});
tap.test('station Karl-Theodor-Straße', async (t) => {
- const s = await client.stop(karlTheodorStr)
+ const s = await client.stop(karlTheodorStr);
- validate(t, s, ['stop', 'station'], 'station')
- t.equal(s.id, karlTheodorStr)
+ validate(t, s, ['stop', 'station'], 'station');
+ t.equal(s.id, karlTheodorStr);
- t.end()
-})
+ t.end();
+});
tap.test('radar', async (t) => {
const res = await client.radar({
north: 48.145121,
west: 11.543736,
south: 48.138339,
- east: 11.553776
+ east: 11.553776,
}, {
- duration: 5 * 60, when, results: 10
- })
+ duration: 5 * 60, when, results: 10,
+ });
- validate(t, res, 'radarResult', 'res')
- t.end()
-})
+ validate(t, res, 'radarResult', 'res');
+ t.end();
+});
tap.test('reachableFrom', async (t) => {
await testReachableFrom({
@@ -271,7 +271,7 @@ tap.test('reachableFrom', async (t) => {
address: poetschnerstr,
when,
maxDuration: 15,
- validate
- })
- t.end()
-})
+ validate,
+ });
+ t.end();
+});
diff --git a/test/e2e/sncb.js b/test/e2e/sncb.js
index 8d507ace..6a2c8212 100644
--- a/test/e2e/sncb.js
+++ b/test/e2e/sncb.js
@@ -1,15 +1,15 @@
-import tap from 'tap'
+import tap from 'tap';
-import {createWhen} from './lib/util.js'
-import {createClient} from '../../index.js'
-import {profile as sncbProfile} from '../../p/sncb/index.js'
-import {createValidateFptfWith as createValidate} from './lib/validate-fptf-with.js'
-import {testJourneysStationToStation} from './lib/journeys-station-to-station.js'
-import {testArrivals} from './lib/arrivals.js'
-import {testReachableFrom} from './lib/reachable-from.js'
+import {createWhen} from './lib/util.js';
+import {createClient} from '../../index.js';
+import {profile as sncbProfile} from '../../p/sncb/index.js';
+import {createValidateFptfWith as createValidate} from './lib/validate-fptf-with.js';
+import {testJourneysStationToStation} from './lib/journeys-station-to-station.js';
+import {testArrivals} from './lib/arrivals.js';
+import {testReachableFrom} from './lib/reachable-from.js';
-const T_MOCK = 1668495600 * 1000 // 2022-11-15T08:00:00+01:00
-const when = createWhen(sncbProfile.timezone, sncbProfile.locale, T_MOCK)
+const T_MOCK = 1668495600 * 1000; // 2022-11-15T08:00:00+01:00
+const when = createWhen(sncbProfile.timezone, sncbProfile.locale, T_MOCK);
const cfg = {
when,
@@ -18,69 +18,69 @@ const cfg = {
minLatitude: 46.513,
maxLatitude: 54.521,
minLongitude: -1.423,
- maxLongitude: 15.26
-}
+ maxLongitude: 15.26,
+};
-const validate = createValidate(cfg)
+const validate = createValidate(cfg);
-const client = createClient(sncbProfile, 'public-transport/hafas-client:test')
+const client = createClient(sncbProfile, 'public-transport/hafas-client:test');
-const gentStPieters = '8892007'
-const bruxellesMidi = '8814001'
+const gentStPieters = '8892007';
+const bruxellesMidi = '8814001';
const gentPaddenhoek = {
type: 'location',
address: 'Gent, Paddenhoek',
latitude: 51.051691, longitude: 3.724914,
-}
+};
tap.skip('journeys – Gent Sant Pieters to Bruxelles Midi', async (t) => {
const res = await client.journeys(gentStPieters, bruxellesMidi, {
results: 4,
departure: when,
- stopovers: true
- })
+ stopovers: true,
+ });
await testJourneysStationToStation({
test: t,
res,
validate,
fromId: gentStPieters,
- toId: bruxellesMidi
- })
- t.end()
-})
+ toId: bruxellesMidi,
+ });
+ t.end();
+});
// todo: via works – with detour
// todo: without detour
tap.skip('trip details', async (t) => {
const res = await client.journeys(gentStPieters, bruxellesMidi, {
- results: 1, departure: when
- })
+ results: 1, departure: when,
+ });
- const p = res.journeys[0].legs.find(l => !l.walking)
- t.ok(p.tripId, 'precondition failed')
- t.ok(p.line.name, 'precondition failed')
+ const p = res.journeys[0].legs.find(l => !l.walking);
+ t.ok(p.tripId, 'precondition failed');
+ t.ok(p.line.name, 'precondition failed');
- const tripRes = await client.trip(p.tripId, {when})
+ const tripRes = await client.trip(p.tripId, {when});
- validate(t, tripRes, 'tripResult', 'res')
- t.end()
-})
+ validate(t, tripRes, 'tripResult', 'res');
+ t.end();
+});
tap.skip('arrivals at Bruxelles Midi', async (t) => {
const res = await client.arrivals(bruxellesMidi, {
- duration: 10, when
- })
+ duration: 10, when,
+ });
await testArrivals({
test: t,
res,
validate,
id: bruxellesMidi,
- })
- t.end()
-})
+ });
+ t.end();
+});
// todo: nearby
@@ -89,14 +89,14 @@ tap.skip('radar', async (t) => {
north: 51.065,
west: 3.688,
south: 51.04,
- east: 3.748
+ east: 3.748,
}, {
- duration: 5 * 60, when, results: 10
- })
+ duration: 5 * 60, when, results: 10,
+ });
- validate(t, res, 'radarResult', 'res')
- t.end()
-})
+ validate(t, res, 'radarResult', 'res');
+ t.end();
+});
tap.skip('reachableFrom', async (t) => {
await testReachableFrom({
@@ -105,7 +105,7 @@ tap.skip('reachableFrom', async (t) => {
address: gentPaddenhoek,
when,
maxDuration: 15,
- validate
- })
- t.end()
-})
+ validate,
+ });
+ t.end();
+});
diff --git a/test/e2e/stv.js b/test/e2e/stv.js
index 953f78eb..5c176fe8 100644
--- a/test/e2e/stv.js
+++ b/test/e2e/stv.js
@@ -1,12 +1,12 @@
-import tap from 'tap'
+import tap from 'tap';
-import {createWhen} from './lib/util.js'
-import {createClient} from '../../index.js'
-import {profile as stvProfile} from '../../p/stv/index.js'
-import {createValidateFptfWith as createValidate} from './lib/validate-fptf-with.js'
+import {createWhen} from './lib/util.js';
+import {createClient} from '../../index.js';
+import {profile as stvProfile} from '../../p/stv/index.js';
+import {createValidateFptfWith as createValidate} from './lib/validate-fptf-with.js';
-const T_MOCK = 1671260400 * 1000 // 2022-12-17T08:00:00+01:00
-const when = createWhen(stvProfile.timezone, stvProfile.locale, T_MOCK)
+const T_MOCK = 1671260400 * 1000; // 2022-12-17T08:00:00+01:00
+const when = createWhen(stvProfile.timezone, stvProfile.locale, T_MOCK);
const cfg = {
when,
@@ -16,20 +16,20 @@ const cfg = {
maxLongitude: 18.347,
minLatitude: 46.127,
minLongitude: 7.8635,
-}
-const validate = createValidate(cfg)
+};
+const validate = createValidate(cfg);
-const client = createClient(stvProfile, 'public-transport/hafas-client:test')
+const client = createClient(stvProfile, 'public-transport/hafas-client:test');
-const grazSonnenhang = '460413500'
+const grazSonnenhang = '460413500';
tap.test('locations named "sonnenhang"', async (t) => {
- const locations = await client.locations('sonnenhang')
+ const locations = await client.locations('sonnenhang');
- validate(t, locations, 'locations', 'locations')
+ validate(t, locations, 'locations', 'locations');
t.ok(locations.some((l) => {
- return l.station && l.station.id === grazSonnenhang || l.id === grazSonnenhang
- }), 'Graz Sonnenhang not found')
+ return l.station && l.station.id === grazSonnenhang || l.id === grazSonnenhang;
+ }), 'Graz Sonnenhang not found');
- t.end()
-})
+ t.end();
+});
diff --git a/test/e2e/svv.js b/test/e2e/svv.js
index 7090116b..40d6213e 100644
--- a/test/e2e/svv.js
+++ b/test/e2e/svv.js
@@ -1,16 +1,16 @@
-import tap from 'tap'
+import tap from 'tap';
-import {createWhen} from './lib/util.js'
-import {createClient} from '../../index.js'
-import {profile as svvProfile} from '../../p/svv/index.js'
-import {createValidateFptfWith as createValidate} from './lib/validate-fptf-with.js'
-import {testJourneysStationToStation} from './lib/journeys-station-to-station.js'
-import {testArrivals} from './lib/arrivals.js'
-import {testReachableFrom} from './lib/reachable-from.js'
-import {testServerInfo} from './lib/server-info.js'
+import {createWhen} from './lib/util.js';
+import {createClient} from '../../index.js';
+import {profile as svvProfile} from '../../p/svv/index.js';
+import {createValidateFptfWith as createValidate} from './lib/validate-fptf-with.js';
+import {testJourneysStationToStation} from './lib/journeys-station-to-station.js';
+import {testArrivals} from './lib/arrivals.js';
+import {testReachableFrom} from './lib/reachable-from.js';
+import {testServerInfo} from './lib/server-info.js';
-const T_MOCK = 1671260400 * 1000 // 2022-12-17T08:00:00+01:00
-const when = createWhen(svvProfile.timezone, svvProfile.locale, T_MOCK)
+const T_MOCK = 1671260400 * 1000; // 2022-12-17T08:00:00+01:00
+const when = createWhen(svvProfile.timezone, svvProfile.locale, T_MOCK);
const cfg = {
when,
@@ -20,69 +20,69 @@ const cfg = {
maxLatitude: 49.41,
minLongitude: 8.177,
maxLongitude: 18.448,
-}
+};
-const validate = createValidate(cfg)
+const validate = createValidate(cfg);
-const client = createClient(svvProfile, 'public-transport/hafas-client:test')
+const client = createClient(svvProfile, 'public-transport/hafas-client:test');
-const sam = '455086100'
-const volksgarten = '455082100'
+const sam = '455086100';
+const volksgarten = '455082100';
const zillnerstr2 = {
type: 'location',
id: '980133209',
address: 'Zillnerstraße 2, 5020 Salzburg',
latitude: 47.801434, longitude: 13.031006,
-}
+};
tap.test('journeys – Sam to Volksgarten', async (t) => {
const res = await client.journeys(sam, volksgarten, {
results: 4,
departure: when,
- stopovers: true
- })
+ stopovers: true,
+ });
await testJourneysStationToStation({
test: t,
res,
validate,
fromId: sam,
- toId: volksgarten
- })
- t.end()
-})
+ toId: volksgarten,
+ });
+ t.end();
+});
// todo: via works – with detour
// todo: without detour
tap.test('trip details', async (t) => {
const res = await client.journeys(sam, volksgarten, {
- results: 1, departure: when
- })
+ results: 1, departure: when,
+ });
- const p = res.journeys[0].legs.find(l => !l.walking)
- t.ok(p.tripId, 'precondition failed')
- t.ok(p.line.name, 'precondition failed')
+ const p = res.journeys[0].legs.find(l => !l.walking);
+ t.ok(p.tripId, 'precondition failed');
+ t.ok(p.line.name, 'precondition failed');
- const tripRes = await client.trip(p.tripId, {when})
+ const tripRes = await client.trip(p.tripId, {when});
- validate(t, tripRes, 'tripResult', 'res')
- t.end()
-})
+ validate(t, tripRes, 'tripResult', 'res');
+ t.end();
+});
tap.test('arrivals at Volksgarten', async (t) => {
const res = await client.arrivals(volksgarten, {
- duration: 10, when
- })
+ duration: 10, when,
+ });
await testArrivals({
test: t,
res,
validate,
id: volksgarten,
- })
- t.end()
-})
+ });
+ t.end();
+});
// todo: nearby
@@ -93,14 +93,14 @@ tap.test('reachableFrom', async (t) => {
address: zillnerstr2,
when,
maxDuration: 15,
- validate
- })
- t.end()
-})
+ validate,
+ });
+ t.end();
+});
tap.test('serverInfo works', async (t) => {
await testServerInfo({
test: t,
fetchServerInfo: client.serverInfo,
- })
-})
+ });
+});
diff --git a/test/e2e/tpg.js b/test/e2e/tpg.js
index 8adaedb7..64126f95 100644
--- a/test/e2e/tpg.js
+++ b/test/e2e/tpg.js
@@ -1,13 +1,13 @@
-import tap from 'tap'
+import tap from 'tap';
-import {createWhen} from './lib/util.js'
-import {createClient} from '../../index.js'
-import {profile as tpgProfile} from '../../p/tpg/index.js'
-import {createValidateFptfWith as createValidate} from './lib/validate-fptf-with.js'
-import {testJourneysStationToAddress} from './lib/journeys-station-to-address.js'
+import {createWhen} from './lib/util.js';
+import {createClient} from '../../index.js';
+import {profile as tpgProfile} from '../../p/tpg/index.js';
+import {createValidateFptfWith as createValidate} from './lib/validate-fptf-with.js';
+import {testJourneysStationToAddress} from './lib/journeys-station-to-address.js';
-const T_MOCK = 1668495600 * 1000 // 2022-11-15T08:00:00+01:00
-const when = createWhen(tpgProfile.timezone, tpgProfile.locale, T_MOCK)
+const T_MOCK = 1668495600 * 1000; // 2022-11-15T08:00:00+01:00
+const when = createWhen(tpgProfile.timezone, tpgProfile.locale, T_MOCK);
const cfg = {
when,
@@ -17,13 +17,13 @@ const cfg = {
minLongitude: 4.4604,
maxLatitude: 47.2969,
maxLongitude: 7.8607,
-}
+};
-const validate = createValidate(cfg)
+const validate = createValidate(cfg);
-const client = createClient(tpgProfile, 'public-transport/hafas-client:test')
+const client = createClient(tpgProfile, 'public-transport/hafas-client:test');
-const moillebeau = '100451'
+const moillebeau = '100451';
tap.test('Moillebeau to Cours des Bastions 10', async (t) => {
const coursDesBastions10 = {
@@ -32,12 +32,12 @@ tap.test('Moillebeau to Cours des Bastions 10', async (t) => {
address: 'Cours des Bastions 10, 1205 Genève',
latitude: 46.197768,
longitude: 6.148046,
- }
+ };
const res = await client.journeys(moillebeau, coursDesBastions10, {
results: 3,
departure: when,
- })
+ });
await testJourneysStationToAddress({
test: t,
@@ -45,6 +45,6 @@ tap.test('Moillebeau to Cours des Bastions 10', async (t) => {
validate,
fromId: moillebeau,
to: coursDesBastions10,
- })
- t.end()
-})
+ });
+ t.end();
+});
diff --git a/test/e2e/vbb.js b/test/e2e/vbb.js
index 9623d029..15d751da 100644
--- a/test/e2e/vbb.js
+++ b/test/e2e/vbb.js
@@ -1,74 +1,74 @@
-import tap from 'tap'
+import tap from 'tap';
-import {createWhen} from './lib/util.js'
-import {createClient} from '../../index.js'
-import {profile as vbbProfile} from '../../p/vbb/index.js'
-import {createVbbBvgValidators} from './lib/vbb-bvg-validators.js'
-import {createValidateFptfWith as createValidate} from './lib/validate-fptf-with.js'
-import {testJourneysStationToStation} from './lib/journeys-station-to-station.js'
-import {testJourneysStationToAddress} from './lib/journeys-station-to-address.js'
-import {testJourneysStationToPoi} from './lib/journeys-station-to-poi.js'
-import {testJourneysWalkingSpeed} from './lib/journeys-walking-speed.js'
-import {testEarlierLaterJourneys} from './lib/earlier-later-journeys.js'
-import {testRefreshJourney} from './lib/refresh-journey.js'
-import {journeysFailsWithNoProduct} from './lib/journeys-fails-with-no-product.js'
-import {testDepartures} from './lib/departures.js'
-import {testDeparturesInDirection} from './lib/departures-in-direction.js'
-import {testArrivals} from './lib/arrivals.js'
-import {testJourneysWithDetour} from './lib/journeys-with-detour.js'
-import {testReachableFrom} from './lib/reachable-from.js'
+import {createWhen} from './lib/util.js';
+import {createClient} from '../../index.js';
+import {profile as vbbProfile} from '../../p/vbb/index.js';
+import {createVbbBvgValidators} from './lib/vbb-bvg-validators.js';
+import {createValidateFptfWith as createValidate} from './lib/validate-fptf-with.js';
+import {testJourneysStationToStation} from './lib/journeys-station-to-station.js';
+import {testJourneysStationToAddress} from './lib/journeys-station-to-address.js';
+import {testJourneysStationToPoi} from './lib/journeys-station-to-poi.js';
+import {testJourneysWalkingSpeed} from './lib/journeys-walking-speed.js';
+import {testEarlierLaterJourneys} from './lib/earlier-later-journeys.js';
+import {testRefreshJourney} from './lib/refresh-journey.js';
+import {journeysFailsWithNoProduct} from './lib/journeys-fails-with-no-product.js';
+import {testDepartures} from './lib/departures.js';
+import {testDeparturesInDirection} from './lib/departures-in-direction.js';
+import {testArrivals} from './lib/arrivals.js';
+import {testJourneysWithDetour} from './lib/journeys-with-detour.js';
+import {testReachableFrom} from './lib/reachable-from.js';
-const T_MOCK = 1671260400 * 1000 // 2022-12-17T08:00:00+01:00
-const when = createWhen(vbbProfile.timezone, vbbProfile.locale, T_MOCK)
+const T_MOCK = 1671260400 * 1000; // 2022-12-17T08:00:00+01:00
+const when = createWhen(vbbProfile.timezone, vbbProfile.locale, T_MOCK);
const {
cfg,
validateStation,
validateJourneyLeg,
validateDeparture,
- validateMovement
+ validateMovement,
} = createVbbBvgValidators({
when,
-})
+});
const validate = createValidate(cfg, {
station: validateStation,
journeyLeg: validateJourneyLeg,
departure: validateDeparture,
- movement: validateMovement
-})
+ movement: validateMovement,
+});
-const client = createClient(vbbProfile, 'public-transport/hafas-client:test')
+const client = createClient(vbbProfile, 'public-transport/hafas-client:test');
-const amrumerStr = '900009101'
-const spichernstr = '900042101'
-const bismarckstr = '900024201'
-const westhafen = '900001201'
-const wedding = '900009104'
-const württembergallee = '900026153'
+const amrumerStr = '900009101';
+const spichernstr = '900042101';
+const bismarckstr = '900024201';
+const westhafen = '900001201';
+const wedding = '900009104';
+const württembergallee = '900026153';
tap.test('journeys – Spichernstr. to Bismarckstr.', async (t) => {
const res = await client.journeys({
type: 'stop',
id: spichernstr,
- name: 'U Spichernstr.'
+ name: 'U Spichernstr.',
}, bismarckstr, {
results: 4,
departure: when,
- stopovers: true
- })
+ stopovers: true,
+ });
await testJourneysStationToStation({
test: t,
res,
validate,
fromId: spichernstr,
- toId: bismarckstr
- })
+ toId: bismarckstr,
+ });
// todo: find a journey where there ticket info is always available
- t.end()
-})
+ t.end();
+});
tap.test('journeys – only subway', async (t) => {
const res = await client.journeys(spichernstr, bismarckstr, {
@@ -76,34 +76,34 @@ tap.test('journeys – only subway', async (t) => {
departure: when,
products: {
suburban: false,
- subway: true,
- tram: false,
- bus: false,
- ferry: false,
- express: false,
- regional: false
- }
- })
+ subway: true,
+ tram: false,
+ bus: false,
+ ferry: false,
+ express: false,
+ regional: false,
+ },
+ });
- validate(t, res, 'journeysResult', 'res')
+ validate(t, res, 'journeysResult', 'res');
- t.ok(res.journeys.length > 1)
+ t.ok(res.journeys.length > 1);
for (let i = 0; i < res.journeys.length; i++) {
- const journey = res.journeys[i]
+ const journey = res.journeys[i];
for (let j = 0; j < journey.legs.length; j++) {
- const leg = journey.legs[j]
+ const leg = journey.legs[j];
- const name = `res.journeys[${i}].legs[${i}].line`
+ const name = `res.journeys[${i}].legs[${i}].line`;
if (leg.line) {
- t.equal(leg.line.mode, 'train', name + '.mode is invalid')
- t.equal(leg.line.product, 'subway', name + '.product is invalid')
+ t.equal(leg.line.mode, 'train', name + '.mode is invalid');
+ t.equal(leg.line.product, 'subway', name + '.product is invalid');
}
- t.ok(journey.legs.some(l => l.line), name + '.legs has no subway leg')
+ t.ok(journey.legs.some(l => l.line), name + '.legs has no subway leg');
}
}
- t.end()
-})
+ t.end();
+});
// todo: journeys – with arrival time
@@ -115,18 +115,18 @@ tap.test('journeys – fails with no product', async (t) => {
toId: bismarckstr,
when,
products: vbbProfile.products,
- })
- t.end()
-})
+ });
+ t.end();
+});
tap.test('journeys: walkingSpeed', async (t) => {
const havelchaussee = {
type: 'location',
address: 'Havelchaussee',
latitude: 52.443576,
- longitude: 13.198973
- }
- const wannsee = '900053301'
+ longitude: 13.198973,
+ };
+ const wannsee = '900053301';
await testJourneysWalkingSpeed({
test: t,
@@ -136,9 +136,9 @@ tap.test('journeys: walkingSpeed', async (t) => {
to: wannsee,
when,
products: {bus: false},
- minTimeDifference: 5 * 60 * 1000
- })
-})
+ minTimeDifference: 5 * 60 * 1000,
+ });
+});
tap.test('earlier/later journeys', async (t) => {
await testEarlierLaterJourneys({
@@ -147,11 +147,11 @@ tap.test('earlier/later journeys', async (t) => {
validate,
fromId: spichernstr,
toId: bismarckstr,
- when
- })
+ when,
+ });
- t.end()
-})
+ t.end();
+});
tap.test('refreshJourney', async (t) => {
await testRefreshJourney({
@@ -161,81 +161,81 @@ tap.test('refreshJourney', async (t) => {
validate,
fromId: spichernstr,
toId: bismarckstr,
- when
- })
- t.end()
-})
+ when,
+ });
+ t.end();
+});
tap.test('trip details', async (t) => {
const res = await client.journeys(spichernstr, amrumerStr, {
- results: 1, departure: when
- })
+ results: 1, departure: when,
+ });
- const p = res.journeys[0].legs.find(l => !l.walking)
- t.ok(p.tripId, 'precondition failed')
- t.ok(p.line.name, 'precondition failed')
+ const p = res.journeys[0].legs.find(l => !l.walking);
+ t.ok(p.tripId, 'precondition failed');
+ t.ok(p.line.name, 'precondition failed');
- const tripRes = await client.trip(p.tripId, {when})
+ const tripRes = await client.trip(p.tripId, {when});
- validate(t, tripRes, 'tripResult', 'res')
- t.end()
-})
+ validate(t, tripRes, 'tripResult', 'res');
+ t.end();
+});
// This currently fails because some trips' departure/arrival is out of the range
// around `when`, as expected by `assertValidWhen`, as called by `validate`.
// todo: allow turning this off?
tap.skip('trips', async (t) => {
- const {trips: r1} = await client.tripsByName('S1')
- t.ok(Array.isArray(r1))
- t.ok(r1.length > 0)
- t.ok(r1.every(t => t.line.name.trim() === 'S1'))
+ const {trips: r1} = await client.tripsByName('S1');
+ t.ok(Array.isArray(r1));
+ t.ok(r1.length > 0);
+ t.ok(r1.every(t => t.line.name.trim() === 'S1'));
for (let i = 0; i < r1.length; i++) {
- validate(t, r1[i], 'trip', `r1[${i}]`)
+ validate(t, r1[i], 'trip', `r1[${i}]`);
}
const {trips: r2} = await client.tripsByName('S1', {
onlyCurrentlyRunning: false,
- })
- t.ok(Array.isArray(r2))
- t.ok(r2.length > r1.length)
- t.ok(r2.every(t => t.line.name.trim() === 'S1'))
+ });
+ t.ok(Array.isArray(r2));
+ t.ok(r2.length > r1.length);
+ t.ok(r2.every(t => t.line.name.trim() === 'S1'));
for (let i = 0; i < r2.length; i++) {
- validate(t, r2[i], 'trip', `r2[${i}]`)
+ validate(t, r2[i], 'trip', `r2[${i}]`);
}
const {trips: r3} = await client.tripsByName('*', {
onlyCurrentlyRunning: false,
- })
- t.ok(Array.isArray(r3))
- t.ok(r3.length > r2.length)
+ });
+ t.ok(Array.isArray(r3));
+ t.ok(r3.length > r2.length);
for (let i = 0; i < r3.length; i++) {
- validate(t, r3[i], 'trip', `r3[${i}]`)
+ validate(t, r3[i], 'trip', `r3[${i}]`);
}
- t.end()
-})
+ t.end();
+});
tap.test('journeys – station to address', async (t) => {
const torfstr = {
type: 'location',
address: '13353 Berlin-Wedding, Torfstr. 17',
latitude: 52.541797,
- longitude: 13.350042
- }
+ longitude: 13.350042,
+ };
const res = await client.journeys(spichernstr, torfstr, {
results: 3,
- departure: when
- })
+ departure: when,
+ });
await testJourneysStationToAddress({
test: t,
res,
validate,
fromId: spichernstr,
- to: torfstr
- })
- t.end()
-})
+ to: torfstr,
+ });
+ t.end();
+});
tap.test('journeys – station to POI', async (t) => {
const atze = {
@@ -244,22 +244,22 @@ tap.test('journeys – station to POI', async (t) => {
poi: true,
name: 'Berlin, Atze Musiktheater für Kinder',
latitude: 52.543333,
- longitude: 13.351686
- }
+ longitude: 13.351686,
+ };
const res = await client.journeys(spichernstr, atze, {
results: 3,
- departure: when
- })
+ departure: when,
+ });
await testJourneysStationToPoi({
test: t,
res,
validate,
fromId: spichernstr,
- to: atze
- })
- t.end()
-})
+ to: atze,
+ });
+ t.end();
+});
tap.test('journeys: via works – with detour', async (t) => {
// Going from Westhafen to Wedding via Württembergalle without detour
@@ -268,33 +268,33 @@ tap.test('journeys: via works – with detour', async (t) => {
via: württembergallee,
results: 1,
departure: when,
- stopovers: true
- })
+ stopovers: true,
+ });
await testJourneysWithDetour({
test: t,
res,
validate,
- detourIds: [württembergallee]
- })
- t.end()
-})
+ detourIds: [württembergallee],
+ });
+ t.end();
+});
// todo: without detour test
tap.test('departures', async (t) => {
const res = await client.departures(spichernstr, {
duration: 5, when,
- })
+ });
await testDepartures({
test: t,
res,
validate,
- id: spichernstr
- })
- t.end()
-})
+ id: spichernstr,
+ });
+ t.end();
+});
tap.test('departures with station object', async (t) => {
const res = await client.departures({
@@ -304,13 +304,13 @@ tap.test('departures with station object', async (t) => {
location: {
type: 'location',
latitude: 1.23,
- longitude: 2.34
- }
- }, {when})
+ longitude: 2.34,
+ },
+ }, {when});
- validate(t, res, 'departuresResponse', 'res')
- t.end()
-})
+ validate(t, res, 'departuresResponse', 'res');
+ t.end();
+});
tap.test('departures at Spichernstr. in direction of Westhafen', async (t) => {
await testDeparturesInDirection({
@@ -320,105 +320,105 @@ tap.test('departures at Spichernstr. in direction of Westhafen', async (t) => {
id: spichernstr,
directionIds: [westhafen],
when,
- validate
- })
- t.end()
-})
+ validate,
+ });
+ t.end();
+});
tap.test('departures at 7-digit station', async (t) => {
- const eisenach = '8010097' // see derhuerst/vbb-hafas#22
- await client.departures(eisenach, {when})
- t.pass('did not fail')
- t.end()
-})
+ const eisenach = '8010097'; // see derhuerst/vbb-hafas#22
+ await client.departures(eisenach, {when});
+ t.pass('did not fail');
+ t.end();
+});
tap.test('arrivals', async (t) => {
const res = await client.arrivals(spichernstr, {
duration: 5, when,
- })
+ });
await testArrivals({
test: t,
res,
validate,
- id: spichernstr
- })
- t.end()
-})
+ id: spichernstr,
+ });
+ t.end();
+});
tap.test('nearby', async (t) => {
- const berlinerStr = '900044201'
- const landhausstr = '900043252'
+ const berlinerStr = '900044201';
+ const landhausstr = '900043252';
// Berliner Str./Bundesallee
const nearby = await client.nearby({
type: 'location',
latitude: 52.4873452,
- longitude: 13.3310411
+ longitude: 13.3310411,
}, {
// Even though HAFAS reports Landhausstr. to be 179m, we have to pass way more here. 🙄
distance: 600,
- })
+ });
- validate(t, nearby, 'locations', 'nearby')
+ validate(t, nearby, 'locations', 'nearby');
- t.equal(nearby[0].id, berlinerStr)
- t.equal(nearby[0].name, 'U Berliner Str. (Berlin)')
- t.ok(nearby[0].distance > 0)
- t.ok(nearby[0].distance < 100)
+ t.equal(nearby[0].id, berlinerStr);
+ t.equal(nearby[0].name, 'U Berliner Str. (Berlin)');
+ t.ok(nearby[0].distance > 0);
+ t.ok(nearby[0].distance < 100);
- const res = nearby.find(s => s.id === landhausstr)
- t.ok(res, `Landhausstr. ${landhausstr} is not among the nearby stops`)
- t.equal(nearby[1].name, 'Landhausstr. (Berlin)')
- t.ok(nearby[1].distance > 100)
- t.ok(nearby[1].distance < 200)
+ const res = nearby.find(s => s.id === landhausstr);
+ t.ok(res, `Landhausstr. ${landhausstr} is not among the nearby stops`);
+ t.equal(nearby[1].name, 'Landhausstr. (Berlin)');
+ t.ok(nearby[1].distance > 100);
+ t.ok(nearby[1].distance < 200);
- t.end()
-})
+ t.end();
+});
tap.test('locations', async (t) => {
- const locations = await client.locations('Alexanderplatz', {results: 20})
+ const locations = await client.locations('Alexanderplatz', {results: 20});
- validate(t, locations, 'locations', 'locations')
- t.ok(locations.length <= 20)
+ validate(t, locations, 'locations', 'locations');
+ t.ok(locations.length <= 20);
- t.ok(locations.find(s => s.type === 'stop' || s.type === 'station'))
- t.ok(locations.find(s => s.poi)) // POIs
- t.ok(locations.find(s => !s.name && s.address)) // addresses
+ t.ok(locations.find(s => s.type === 'stop' || s.type === 'station'));
+ t.ok(locations.find(s => s.poi)); // POIs
+ t.ok(locations.find(s => !s.name && s.address)); // addresses
- t.end()
-})
+ t.end();
+});
tap.test('stop', async (t) => {
- const s = await client.stop(spichernstr)
+ const s = await client.stop(spichernstr);
- validate(t, s, ['stop', 'station'], 'stop')
- t.equal(s.id, spichernstr)
+ validate(t, s, ['stop', 'station'], 'stop');
+ t.equal(s.id, spichernstr);
- t.end()
-})
+ t.end();
+});
tap.test('radar', async (t) => {
const res = await client.radar({
north: 52.52411,
west: 13.41002,
south: 52.51942,
- east: 13.41709
+ east: 13.41709,
}, {
- duration: 5 * 60, when
- })
+ duration: 5 * 60, when,
+ });
- validate(t, res, 'radarResult', 'res')
- t.end()
-})
+ validate(t, res, 'radarResult', 'res');
+ t.end();
+});
tap.test('reachableFrom', async (t) => {
const torfstr17 = {
type: 'location',
address: '13353 Berlin-Wedding, Torfstr. 17',
latitude: 52.541797,
- longitude: 13.350042
- }
+ longitude: 13.350042,
+ };
await testReachableFrom({
test: t,
@@ -426,7 +426,7 @@ tap.test('reachableFrom', async (t) => {
address: torfstr17,
when,
maxDuration: 15,
- validate
- })
- t.end()
-})
+ validate,
+ });
+ t.end();
+});
diff --git a/test/e2e/vbn.js b/test/e2e/vbn.js
index e462048b..4d05a928 100644
--- a/test/e2e/vbn.js
+++ b/test/e2e/vbn.js
@@ -1,15 +1,15 @@
-import tap from 'tap'
+import tap from 'tap';
-import {createWhen} from './lib/util.js'
-import {createClient} from '../../index.js'
-import {profile as vbnProfile} from '../../p/vbn/index.js'
-import {createValidateFptfWith as createValidate} from './lib/validate-fptf-with.js'
-import {testJourneysStationToStation} from './lib/journeys-station-to-station.js'
-import {testArrivals} from './lib/arrivals.js'
-import {testReachableFrom} from './lib/reachable-from.js'
+import {createWhen} from './lib/util.js';
+import {createClient} from '../../index.js';
+import {profile as vbnProfile} from '../../p/vbn/index.js';
+import {createValidateFptfWith as createValidate} from './lib/validate-fptf-with.js';
+import {testJourneysStationToStation} from './lib/journeys-station-to-station.js';
+import {testArrivals} from './lib/arrivals.js';
+import {testReachableFrom} from './lib/reachable-from.js';
-const T_MOCK = 1668495600 * 1000 // 2022-11-15T08:00:00+01:00
-const when = createWhen(vbnProfile.timezone, vbnProfile.locale, T_MOCK)
+const T_MOCK = 1668495600 * 1000; // 2022-11-15T08:00:00+01:00
+const when = createWhen(vbnProfile.timezone, vbnProfile.locale, T_MOCK);
const cfg = {
when,
@@ -18,64 +18,64 @@ const cfg = {
minLatitude: 51.817,
maxLatitude: 53.657,
minLongitude: 5.248,
- maxLongitude: 11.719
-}
+ maxLongitude: 11.719,
+};
-const validate = createValidate(cfg)
+const validate = createValidate(cfg);
-const client = createClient(vbnProfile, 'public-transport/hafas-client:test')
+const client = createClient(vbnProfile, 'public-transport/hafas-client:test');
-const oldenburg = '8000291'
-const bremenHumboldtstr = '9013973'
+const oldenburg = '8000291';
+const bremenHumboldtstr = '9013973';
tap.test('journeys – Oldenburg to Bremen Humboldtstr.', async (t) => {
const res = await client.journeys(oldenburg, bremenHumboldtstr, {
results: 4,
departure: when,
- stopovers: true
- })
+ stopovers: true,
+ });
await testJourneysStationToStation({
test: t,
res,
validate,
fromId: oldenburg,
- toId: bremenHumboldtstr
- })
- t.end()
-})
+ toId: bremenHumboldtstr,
+ });
+ t.end();
+});
// todo: via works – with detour
// todo: without detour
tap.test('trip details', async (t) => {
const res = await client.journeys(oldenburg, bremenHumboldtstr, {
- results: 1, departure: when
- })
+ results: 1, departure: when,
+ });
- const p = res.journeys[0].legs.find(l => !l.walking)
- t.ok(p.tripId, 'precondition failed')
- t.ok(p.line.name, 'precondition failed')
+ const p = res.journeys[0].legs.find(l => !l.walking);
+ t.ok(p.tripId, 'precondition failed');
+ t.ok(p.line.name, 'precondition failed');
- const tripRes = await client.trip(p.tripId, {when})
+ const tripRes = await client.trip(p.tripId, {when});
- validate(t, tripRes, 'tripResult', 'res')
- t.end()
-})
+ validate(t, tripRes, 'tripResult', 'res');
+ t.end();
+});
tap.test('arrivals at Bremen Humboldtstr.', async (t) => {
const res = await client.arrivals(bremenHumboldtstr, {
- duration: 10, when
- })
+ duration: 10, when,
+ });
await testArrivals({
test: t,
res,
validate,
id: bremenHumboldtstr,
- })
- t.end()
-})
+ });
+ t.end();
+});
// todo: nearby
@@ -84,14 +84,14 @@ tap.test('radar', async (t) => {
north: 53.090516,
west: 8.750106,
south: 53.062859,
- east: 8.847423
+ east: 8.847423,
}, {
- duration: 5 * 60, when, results: 10
- })
+ duration: 5 * 60, when, results: 10,
+ });
- validate(t, res, 'radarResult', 'res')
- t.end()
-})
+ validate(t, res, 'radarResult', 'res');
+ t.end();
+});
// todo: fails with "HCI Service: location missing or invalid"
tap.test('reachableFrom', async (t) => {
@@ -107,7 +107,7 @@ tap.test('reachableFrom', async (t) => {
},
when,
maxDuration: 15,
- validate
- })
- t.end()
-})
+ validate,
+ });
+ t.end();
+});
diff --git a/test/e2e/vor.js b/test/e2e/vor.js
index d6a90a9b..a29451f2 100644
--- a/test/e2e/vor.js
+++ b/test/e2e/vor.js
@@ -1,12 +1,12 @@
-import tap from 'tap'
+import tap from 'tap';
-import {createWhen} from './lib/util.js'
-import {createClient} from '../../index.js'
-import {profile as vorProfile} from '../../p/vor/index.js'
-import {createValidateFptfWith as createValidate} from './lib/validate-fptf-with.js'
+import {createWhen} from './lib/util.js';
+import {createClient} from '../../index.js';
+import {profile as vorProfile} from '../../p/vor/index.js';
+import {createValidateFptfWith as createValidate} from './lib/validate-fptf-with.js';
-const T_MOCK = 1671260400 * 1000 // 2022-12-17T08:00:00+01:00
-const when = createWhen(vorProfile.timezone, vorProfile.locale, T_MOCK)
+const T_MOCK = 1671260400 * 1000; // 2022-12-17T08:00:00+01:00
+const when = createWhen(vorProfile.timezone, vorProfile.locale, T_MOCK);
const cfg = {
when,
@@ -16,20 +16,20 @@ const cfg = {
maxLongitude: 17.0892,
minLatitude: 45.7206,
minLongitude: 7.8635,
-}
-const validate = createValidate(cfg)
+};
+const validate = createValidate(cfg);
-const client = createClient(vorProfile, 'public-transport/hafas-client:test')
+const client = createClient(vorProfile, 'public-transport/hafas-client:test');
-const stPöltenLinzerTor = '431277900'
+const stPöltenLinzerTor = '431277900';
tap.test('locations named "linzer tor"', async (t) => {
- const locations = await client.locations('linzer tor')
+ const locations = await client.locations('linzer tor');
- validate(t, locations, 'locations', 'locations')
+ validate(t, locations, 'locations', 'locations');
t.ok(locations.some((l) => {
- return l.station && l.station.id === stPöltenLinzerTor || l.id === stPöltenLinzerTor
- }), 'St. Pölten Linzer Tor not found')
+ return l.station && l.station.id === stPöltenLinzerTor || l.id === stPöltenLinzerTor;
+ }), 'St. Pölten Linzer Tor not found');
- t.end()
-})
+ t.end();
+});
diff --git a/test/e2e/vrn.js b/test/e2e/vrn.js
index 4aded9ea..ba9f2d57 100644
--- a/test/e2e/vrn.js
+++ b/test/e2e/vrn.js
@@ -1,21 +1,21 @@
-import tap from 'tap'
-import isRoughlyEqual from 'is-roughly-equal'
+import tap from 'tap';
+import isRoughlyEqual from 'is-roughly-equal';
-import {createWhen} from './lib/util.js'
-import {createClient} from '../../index.js'
-import {profile as vrnProfile} from '../../p/vrn/index.js'
-import {createValidateFptfWith as createValidate} from './lib/validate-fptf-with.js'
-import {testJourneysStationToStation} from './lib/journeys-station-to-station.js'
-import {journeysFailsWithNoProduct} from './lib/journeys-fails-with-no-product.js'
-import {testJourneysStationToAddress} from './lib/journeys-station-to-address.js'
-import {testJourneysStationToPoi} from './lib/journeys-station-to-poi.js'
-import {testEarlierLaterJourneys} from './lib/earlier-later-journeys.js'
-import {testDepartures} from './lib/departures.js'
-import {testDeparturesInDirection} from './lib/departures-in-direction.js'
-import {testArrivals} from './lib/arrivals.js'
+import {createWhen} from './lib/util.js';
+import {createClient} from '../../index.js';
+import {profile as vrnProfile} from '../../p/vrn/index.js';
+import {createValidateFptfWith as createValidate} from './lib/validate-fptf-with.js';
+import {testJourneysStationToStation} from './lib/journeys-station-to-station.js';
+import {journeysFailsWithNoProduct} from './lib/journeys-fails-with-no-product.js';
+import {testJourneysStationToAddress} from './lib/journeys-station-to-address.js';
+import {testJourneysStationToPoi} from './lib/journeys-station-to-poi.js';
+import {testEarlierLaterJourneys} from './lib/earlier-later-journeys.js';
+import {testDepartures} from './lib/departures.js';
+import {testDeparturesInDirection} from './lib/departures-in-direction.js';
+import {testArrivals} from './lib/arrivals.js';
-const T_MOCK = 1668495600 * 1000 // 2022-11-15T08:00:00+01:00
-const when = createWhen(vrnProfile.timezone, vrnProfile.locale, T_MOCK)
+const T_MOCK = 1668495600 * 1000; // 2022-11-15T08:00:00+01:00
+const when = createWhen(vrnProfile.timezone, vrnProfile.locale, T_MOCK);
const cfg = {
when,
@@ -25,31 +25,31 @@ const cfg = {
minLongitude: 6.163,
maxLatitude: 50.440,
maxLongitude: 10.701,
-}
+};
-const validate = createValidate(cfg, {})
+const validate = createValidate(cfg, {});
-const client = createClient(vrnProfile, 'public-transport/hafas-client:test')
+const client = createClient(vrnProfile, 'public-transport/hafas-client:test');
-const ludwigshafen = '8000236'
-const meckesheim = '8003932'
+const ludwigshafen = '8000236';
+const meckesheim = '8003932';
tap.test('journeys – Ludwigshafen to Meckesheim', async (t) => {
const res = await client.journeys(ludwigshafen, meckesheim, {
results: 4,
departure: when,
- stopovers: true
- })
+ stopovers: true,
+ });
await testJourneysStationToStation({
test: t,
res,
validate,
fromId: ludwigshafen,
- toId: meckesheim
- })
- t.end()
-})
+ toId: meckesheim,
+ });
+ t.end();
+});
// todo: journeys, only one product
@@ -61,9 +61,9 @@ tap.test('journeys – fails with no product', async (t) => {
toId: meckesheim,
when,
products: vrnProfile.products,
- })
- t.end()
-})
+ });
+ t.end();
+});
tap.test('Ludwigshafen to Pestalozzistr. 2, Ludwigshafen', async (t) => {
const pestalozzistr2 = {
@@ -71,22 +71,22 @@ tap.test('Ludwigshafen to Pestalozzistr. 2, Ludwigshafen', async (t) => {
id: '980787337',
address: 'Ludwigshafen am Rhein - Mitte, Pestalozzistraße 2',
latitude: 49.474336, longitude: 8.441779,
- }
+ };
const res = await client.journeys(ludwigshafen, pestalozzistr2, {
results: 3,
- departure: when
- })
+ departure: when,
+ });
await testJourneysStationToAddress({
test: t,
res,
validate,
fromId: ludwigshafen,
- to: pestalozzistr2
- })
- t.end()
-})
+ to: pestalozzistr2,
+ });
+ t.end();
+});
tap.test('Ludwigshafen to Südwest-Stadion', async (t) => {
const südweststadion = {
@@ -95,21 +95,21 @@ tap.test('Ludwigshafen to Südwest-Stadion', async (t) => {
poi: true,
name: 'Ludwigshafen am Rhein, Südwest-Stadion (Sport)',
latitude: 49.469248, longitude: 8.440691,
- }
+ };
const res = await client.journeys(ludwigshafen, südweststadion, {
results: 3,
- departure: when
- })
+ departure: when,
+ });
await testJourneysStationToPoi({
test: t,
res,
validate,
fromId: ludwigshafen,
- to: südweststadion
- })
- t.end()
-})
+ to: südweststadion,
+ });
+ t.end();
+});
// todo: via works – with detour
// todo: via works – without detour
@@ -121,43 +121,43 @@ tap.test('earlier/later journeys', async (t) => {
validate,
fromId: ludwigshafen,
toId: meckesheim,
- when
- })
+ when,
+ });
- t.end()
-})
+ t.end();
+});
tap.test('trip details', async (t) => {
const res = await client.journeys(ludwigshafen, meckesheim, {
- results: 1, departure: when
- })
+ results: 1, departure: when,
+ });
- const p = res.journeys[0].legs.find(l => !l.walking)
- t.ok(p.tripId, 'precondition failed')
- t.ok(p.line.name, 'precondition failed')
+ const p = res.journeys[0].legs.find(l => !l.walking);
+ t.ok(p.tripId, 'precondition failed');
+ t.ok(p.line.name, 'precondition failed');
- const tripRes = await client.trip(p.tripId, {when})
+ const tripRes = await client.trip(p.tripId, {when});
- validate(t, tripRes, 'tripResult', 'res')
- t.end()
-})
+ validate(t, tripRes, 'tripResult', 'res');
+ t.end();
+});
tap.test('departures at Meckesheim', async (t) => {
const res = await client.departures(meckesheim, {
duration: 3 * 60, when,
- })
+ });
await testDepartures({
test: t,
res,
validate,
- id: meckesheim
- })
- t.end()
-})
+ id: meckesheim,
+ });
+ t.end();
+});
tap.test('departures at Meckesheim in direction of Reilsheim', async (t) => {
- const reilsheim = '8005015'
+ const reilsheim = '8005015';
await testDeparturesInDirection({
test: t,
fetchDepartures: client.departures,
@@ -166,52 +166,52 @@ tap.test('departures at Meckesheim in direction of Reilsheim', async (t) => {
directionIds: [reilsheim],
when, duration: 30 * 60,
validate,
- })
- t.end()
-})
+ });
+ t.end();
+});
tap.test('arrivals at Meckesheim', async (t) => {
const res = await client.arrivals(meckesheim, {
- duration: 3 * 60, when
- })
+ duration: 3 * 60, when,
+ });
await testArrivals({
test: t,
res,
validate,
- id: meckesheim
- })
- t.end()
-})
+ id: meckesheim,
+ });
+ t.end();
+});
// todo: nearby
tap.test('locations named Ebertpark', async (t) => {
- const ebertpark = '506453'
+ const ebertpark = '506453';
const locations = await client.locations('Ebertpark', {
- results: 20
- })
+ results: 20,
+ });
- validate(t, locations, 'locations', 'locations')
- t.ok(locations.length <= 20)
+ validate(t, locations, 'locations', 'locations');
+ t.ok(locations.length <= 20);
- t.ok(locations.find(s => s.type === 'stop' || s.type === 'station'))
- t.ok(locations.find(s => s.poi)) // POIs
+ t.ok(locations.find(s => s.type === 'stop' || s.type === 'station'));
+ t.ok(locations.find(s => s.poi)); // POIs
t.ok(locations.some((l) => {
- return l.station && l.station.id === ebertpark || l.id === ebertpark
- }))
+ return l.station && l.station.id === ebertpark || l.id === ebertpark;
+ }));
- t.end()
-})
+ t.end();
+});
tap.skip('station Meckesheim', async (t) => {
- const s = await client.stop(meckesheim)
+ const s = await client.stop(meckesheim);
- validate(t, s, ['stop', 'station'], 'station')
- t.equal(s.id, meckesheim)
+ validate(t, s, ['stop', 'station'], 'station');
+ t.equal(s.id, meckesheim);
- t.end()
-})
+ t.end();
+});
tap.test('radar', async (t) => {
const res = await client.radar({
@@ -221,8 +221,8 @@ tap.test('radar', async (t) => {
east: 8.4834,
}, {
duration: 5 * 60, when, results: 10,
- })
+ });
- validate(t, res, 'radarResult', 'res')
- t.end()
-})
+ validate(t, res, 'radarResult', 'res');
+ t.end();
+});
diff --git a/test/e2e/vsn.js b/test/e2e/vsn.js
index ddcee1be..d18e9f6c 100644
--- a/test/e2e/vsn.js
+++ b/test/e2e/vsn.js
@@ -1,19 +1,19 @@
-import tap from 'tap'
-import isRoughlyEqual from 'is-roughly-equal'
+import tap from 'tap';
+import isRoughlyEqual from 'is-roughly-equal';
-import {createWhen} from './lib/util.js'
-import {createClient} from '../../index.js'
-import {profile as vsnProfile} from '../../p/vsn/index.js'
-import {createValidateFptfWith as createValidate} from './lib/validate-fptf-with.js'
-import {testJourneysStationToStation} from './lib/journeys-station-to-station.js'
-import {testJourneysStationToAddress} from './lib/journeys-station-to-address.js'
-import {testJourneysStationToPoi} from './lib/journeys-station-to-poi.js'
-import {testEarlierLaterJourneys} from './lib/earlier-later-journeys.js'
-import {testDepartures} from './lib/departures.js'
-import {testArrivals} from './lib/arrivals.js'
+import {createWhen} from './lib/util.js';
+import {createClient} from '../../index.js';
+import {profile as vsnProfile} from '../../p/vsn/index.js';
+import {createValidateFptfWith as createValidate} from './lib/validate-fptf-with.js';
+import {testJourneysStationToStation} from './lib/journeys-station-to-station.js';
+import {testJourneysStationToAddress} from './lib/journeys-station-to-address.js';
+import {testJourneysStationToPoi} from './lib/journeys-station-to-poi.js';
+import {testEarlierLaterJourneys} from './lib/earlier-later-journeys.js';
+import {testDepartures} from './lib/departures.js';
+import {testArrivals} from './lib/arrivals.js';
-const T_MOCK = 1671260400 * 1000 // 2022-12-17T08:00:00+01:00
-const when = createWhen(vsnProfile.timezone, vsnProfile.locale, T_MOCK)
+const T_MOCK = 1671260400 * 1000; // 2022-12-17T08:00:00+01:00
+const when = createWhen(vsnProfile.timezone, vsnProfile.locale, T_MOCK);
const cfg = {
when,
@@ -22,53 +22,53 @@ const cfg = {
maxLatitude: 54.5,
minLongitude: 6.5,
maxLongitude: 11.5,
-}
+};
-const validate = createValidate(cfg)
+const validate = createValidate(cfg);
-const client = createClient(vsnProfile, 'public-transport/hafas-client:test')
+const client = createClient(vsnProfile, 'public-transport/hafas-client:test');
-const kornmarkt = '9033977'
-const jugendherberge = '9033961'
-const ewaldstrasse = '9033896'
+const kornmarkt = '9033977';
+const jugendherberge = '9033961';
+const ewaldstrasse = '9033896';
tap.test('journeys – Kornmarkt to Ewaldstraße', async (t) => {
const res = await client.journeys(kornmarkt, ewaldstrasse, {
results: 4,
departure: when,
- stopovers: true
- })
+ stopovers: true,
+ });
await testJourneysStationToStation({
test: t,
res,
validate,
fromId: kornmarkt,
- toId: ewaldstrasse
- })
- t.end()
-})
+ toId: ewaldstrasse,
+ });
+ t.end();
+});
tap.test('Ewaldstraße to 37083 Göttingen, Schulweg 22', async (t) => {
const schulweg = {
type: 'location',
address: '37083 Göttingen, Schulweg 22',
latitude: 51.51579,
- longitude: 9.945382
- }
+ longitude: 9.945382,
+ };
const res = await client.journeys(ewaldstrasse, schulweg, {
results: 3,
- departure: when
- })
+ departure: when,
+ });
await testJourneysStationToAddress({
test: t,
res,
validate,
fromId: ewaldstrasse,
- to: schulweg
- })
- t.end()
-})
+ to: schulweg,
+ });
+ t.end();
+});
tap.test('earlier/later journeys', async (t) => {
await testEarlierLaterJourneys({
@@ -77,54 +77,54 @@ tap.test('earlier/later journeys', async (t) => {
validate,
fromId: ewaldstrasse,
toId: kornmarkt,
- when
- })
+ when,
+ });
- t.end()
-})
+ t.end();
+});
tap.test('trip', async (t) => {
- const { journeys } = await client.journeys(jugendherberge, kornmarkt, {
- results: 1, departure: when
- })
+ const {journeys} = await client.journeys(jugendherberge, kornmarkt, {
+ results: 1, departure: when,
+ });
- const p = journeys[0].legs.find(l => !l.walking)
- t.ok(p.tripId, 'precondition failed')
- t.ok(p.line.name, 'precondition failed')
+ const p = journeys[0].legs.find(l => !l.walking);
+ t.ok(p.tripId, 'precondition failed');
+ t.ok(p.line.name, 'precondition failed');
- const tripRes = await client.trip(p.tripId, {when})
+ const tripRes = await client.trip(p.tripId, {when});
- validate(t, tripRes, 'tripResult', 'res')
- t.end()
-})
+ validate(t, tripRes, 'tripResult', 'res');
+ t.end();
+});
tap.test('departures at Kornmarkt.', async (t) => {
const res = await client.departures(kornmarkt, {
- duration: 20, when
- })
+ duration: 20, when,
+ });
await testDepartures({
test: t,
res,
validate,
- id: kornmarkt
- })
- t.end()
-})
+ id: kornmarkt,
+ });
+ t.end();
+});
tap.test('arrivals at Kornmarkt.', async (t) => {
const res = await client.arrivals(kornmarkt, {
- duration: 20, when
- })
+ duration: 20, when,
+ });
await testArrivals({
test: t,
res,
validate,
- id: kornmarkt
- })
- t.end()
-})
+ id: kornmarkt,
+ });
+ t.end();
+});
tap.test('departures with station object', async (t) => {
const res = await client.departures({
@@ -134,46 +134,46 @@ tap.test('departures with station object', async (t) => {
location: {
type: 'location',
latitude: 51.727914,
- longitude: 10.250606
- }
- }, {when})
+ longitude: 10.250606,
+ },
+ }, {when});
- validate(t, res, 'departuresResponse', 'res')
- t.end()
-})
+ validate(t, res, 'departuresResponse', 'res');
+ t.end();
+});
tap.test('locations named Botanischer Garten', async (t) => {
const locations = await client.locations('Botanischer Garten', {
- results: 20
- })
+ results: 20,
+ });
- validate(t, locations, 'locations', 'locations')
- t.ok(locations.length <= 20)
+ validate(t, locations, 'locations', 'locations');
+ t.ok(locations.length <= 20);
- t.ok(locations.find(s => s.type === 'stop' || s.type === 'station'))
- t.ok(locations.find(s => s.poi))
+ t.ok(locations.find(s => s.type === 'stop' || s.type === 'station'));
+ t.ok(locations.find(s => s.poi));
- t.end()
-})
+ t.end();
+});
tap.test('stop Jugendherberge', async (t) => {
- const s = await client.stop(jugendherberge)
+ const s = await client.stop(jugendherberge);
- validate(t, s, ['stop', 'station'], 'stop')
- t.equal(s.id, jugendherberge)
+ validate(t, s, ['stop', 'station'], 'stop');
+ t.equal(s.id, jugendherberge);
- t.end()
-})
+ t.end();
+});
tap.test('radar', async (t) => {
const res = await client.radar({
north: 52,
west: 9.8,
south: 51.51,
- east: 10
+ east: 10,
}, {
- duration: 5 * 60, when, results: 10
- })
- validate(t, res, 'radarResult', 'res')
- t.end()
-})
+ duration: 5 * 60, when, results: 10,
+ });
+ validate(t, res, 'radarResult', 'res');
+ t.end();
+});
diff --git a/test/e2e/vvv.js b/test/e2e/vvv.js
index e1a84abc..1e9b9dc0 100644
--- a/test/e2e/vvv.js
+++ b/test/e2e/vvv.js
@@ -1,12 +1,12 @@
-import tap from 'tap'
+import tap from 'tap';
-import {createWhen} from './lib/util.js'
-import {createClient} from '../../index.js'
-import {profile as vvvProfile} from '../../p/vvv/index.js'
-import {createValidateFptfWith as createValidate} from './lib/validate-fptf-with.js'
+import {createWhen} from './lib/util.js';
+import {createClient} from '../../index.js';
+import {profile as vvvProfile} from '../../p/vvv/index.js';
+import {createValidateFptfWith as createValidate} from './lib/validate-fptf-with.js';
-const T_MOCK = 1671260400 * 1000 // 2022-12-17T08:00:00+01:00
-const when = createWhen(vvvProfile.timezone, vvvProfile.locale, T_MOCK)
+const T_MOCK = 1671260400 * 1000; // 2022-12-17T08:00:00+01:00
+const when = createWhen(vvvProfile.timezone, vvvProfile.locale, T_MOCK);
const cfg = {
when,
@@ -16,20 +16,20 @@ const cfg = {
maxLongitude: 17.0892,
minLatitude: 45.7206,
minLongitude: 7.8635,
-}
-const validate = createValidate(cfg)
+};
+const validate = createValidate(cfg);
-const client = createClient(vvvProfile, 'public-transport/hafas-client:test')
+const client = createClient(vvvProfile, 'public-transport/hafas-client:test');
-const bregenzLandeskrankenhaus = '480195700'
+const bregenzLandeskrankenhaus = '480195700';
tap.test('locations named "bregenz krankenhaus"', async (t) => {
- const locations = await client.locations('bregenz krankenhaus')
+ const locations = await client.locations('bregenz krankenhaus');
- validate(t, locations, 'locations', 'locations')
+ validate(t, locations, 'locations', 'locations');
t.ok(locations.some((l) => {
- return l.station && l.station.id === bregenzLandeskrankenhaus || l.id === bregenzLandeskrankenhaus
- }), 'Bregenz Landeskrankenhaus not found')
+ return l.station && l.station.id === bregenzLandeskrankenhaus || l.id === bregenzLandeskrankenhaus;
+ }), 'Bregenz Landeskrankenhaus not found');
- t.end()
-})
+ t.end();
+});
diff --git a/test/e2e/zvv.js b/test/e2e/zvv.js
index 372e5b97..1f1e617b 100644
--- a/test/e2e/zvv.js
+++ b/test/e2e/zvv.js
@@ -1,20 +1,20 @@
-import tap from 'tap'
-import isRoughlyEqual from 'is-roughly-equal'
+import tap from 'tap';
+import isRoughlyEqual from 'is-roughly-equal';
-import {createWhen} from './lib/util.js'
-import {createClient} from '../../index.js'
-import {profile as zvvProfile} from '../../p/zvv/index.js'
-import {createValidateFptfWith as createValidate} from './lib/validate-fptf-with.js'
-import {testJourneysStationToStation} from './lib/journeys-station-to-station.js'
-import {testJourneysStationToAddress} from './lib/journeys-station-to-address.js'
-import {testJourneysStationToPoi} from './lib/journeys-station-to-poi.js'
-import {testEarlierLaterJourneys} from './lib/earlier-later-journeys.js'
-import {testDepartures} from './lib/departures.js'
-import {testDeparturesInDirection} from './lib/departures-in-direction.js'
-import {testArrivals} from './lib/arrivals.js'
+import {createWhen} from './lib/util.js';
+import {createClient} from '../../index.js';
+import {profile as zvvProfile} from '../../p/zvv/index.js';
+import {createValidateFptfWith as createValidate} from './lib/validate-fptf-with.js';
+import {testJourneysStationToStation} from './lib/journeys-station-to-station.js';
+import {testJourneysStationToAddress} from './lib/journeys-station-to-address.js';
+import {testJourneysStationToPoi} from './lib/journeys-station-to-poi.js';
+import {testEarlierLaterJourneys} from './lib/earlier-later-journeys.js';
+import {testDepartures} from './lib/departures.js';
+import {testDeparturesInDirection} from './lib/departures-in-direction.js';
+import {testArrivals} from './lib/arrivals.js';
-const T_MOCK = 1671260400 * 1000 // 2022-12-17T08:00:00+01:00
-const when = createWhen(zvvProfile.timezone, zvvProfile.locale, T_MOCK)
+const T_MOCK = 1671260400 * 1000; // 2022-12-17T08:00:00+01:00
+const when = createWhen(zvvProfile.timezone, zvvProfile.locale, T_MOCK);
const validate = createValidate({
when,
@@ -23,29 +23,29 @@ const validate = createValidate({
minLongitude: 7.38,
minLatitude: 46.99,
maxLongitude: 9.71,
-}, {})
+}, {});
-const client = createClient(zvvProfile, 'public-transport/hafas-client:test')
+const client = createClient(zvvProfile, 'public-transport/hafas-client:test');
-const bürkliplatz = '8591105'
-const ethUniversitätsspital = '8591123'
+const bürkliplatz = '8591105';
+const ethUniversitätsspital = '8591123';
tap.test('journeys – Bürkliplatz to ETH/Universitätsspital', async (t) => {
const res = await client.journeys(bürkliplatz, ethUniversitätsspital, {
results: 4,
departure: when,
- stopovers: true
- })
+ stopovers: true,
+ });
await testJourneysStationToStation({
test: t,
res,
validate,
fromId: bürkliplatz,
- toId: ethUniversitätsspital
- })
- t.end()
-})
+ toId: ethUniversitätsspital,
+ });
+ t.end();
+});
tap.test('earlier/later journeys', async (t) => {
await testEarlierLaterJourneys({
@@ -54,61 +54,61 @@ tap.test('earlier/later journeys', async (t) => {
validate,
fromId: bürkliplatz,
toId: ethUniversitätsspital,
- when
- })
+ when,
+ });
- t.end()
-})
+ t.end();
+});
tap.test('trip details', async (t) => {
const res = await client.journeys(bürkliplatz, ethUniversitätsspital, {
- results: 1, departure: when
- })
+ results: 1, departure: when,
+ });
- const p = res.journeys[0].legs.find(l => !l.walking)
- t.ok(p.tripId, 'precondition failed')
- t.ok(p.line.name, 'precondition failed')
+ const p = res.journeys[0].legs.find(l => !l.walking);
+ t.ok(p.tripId, 'precondition failed');
+ t.ok(p.line.name, 'precondition failed');
- const tripRes = await client.trip(p.tripId, {when})
+ const tripRes = await client.trip(p.tripId, {when});
- validate(t, tripRes, 'tripResult', 'res')
- t.end()
-})
+ validate(t, tripRes, 'tripResult', 'res');
+ t.end();
+});
tap.test('departures at ETH/Universitätsspital', async (t) => { // todo
- const polyterrasseETH = '8503500'
+ const polyterrasseETH = '8503500';
const res = await client.departures(ethUniversitätsspital, {
duration: 5, when,
- })
+ });
await testDepartures({
test: t,
res,
validate,
ids: [ethUniversitätsspital, polyterrasseETH],
- })
- t.end()
-})
+ });
+ t.end();
+});
// todo: departures in direction
// todo: nearby
tap.test('locations named Rennweg', async (t) => {
- const rennweg = '8591316'
+ const rennweg = '8591316';
const locations = await client.locations('Rennweg', {
results: 20,
- })
+ });
- validate(t, locations, 'locations', 'locations')
- t.ok(locations.length <= 20)
+ validate(t, locations, 'locations', 'locations');
+ t.ok(locations.length <= 20);
- t.ok(locations.find(s => s.type === 'stop' || s.type === 'station'))
+ t.ok(locations.find(s => s.type === 'stop' || s.type === 'station'));
t.ok(locations.some((l) => {
- return l.station && l.station.id === rennweg || l.id === rennweg
- }))
+ return l.station && l.station.id === rennweg || l.id === rennweg;
+ }));
- t.end()
-})
+ t.end();
+});
tap.test('radar', async (t) => {
const res = await client.radar({
@@ -118,8 +118,8 @@ tap.test('radar', async (t) => {
east: 8.568,
}, {
duration: 5 * 60, when, results: 10,
- })
+ });
- validate(t, res, 'radarResult', 'res')
- t.end()
-})
+ validate(t, res, 'radarResult', 'res');
+ t.end();
+});
diff --git a/test/fixtures/bvg-arrivals.js b/test/fixtures/bvg-arrivals.js
index 8603da5d..2d36c306 100644
--- a/test/fixtures/bvg-arrivals.js
+++ b/test/fixtures/bvg-arrivals.js
@@ -145,14 +145,14 @@ const sLandsbergerAllee = {
mode: 'bus',
product: 'bus',
}],
-}
+};
const achtungFalscheFahrplanauskünfte = {
id: '140812',
type: 'warning',
summary: 'Achtung! Falsche Fahrplanauskünfte für S41, S42 für Do (28.10.)',
- text: 'Informationen zum Fahrplan finden Sie hier:\n' +
- 'sbahn.berlin',
+ text: 'Informationen zum Fahrplan finden Sie hier:\n'
+ + 'sbahn.berlin',
icon: {type: 'HIM2', title: null},
priority: 100,
products: {
@@ -162,21 +162,21 @@ const achtungFalscheFahrplanauskünfte = {
bus: true,
ferry: true,
express: true,
- regional: true
+ regional: true,
},
company: 'VBB',
categories: [2],
validFrom: '2021-10-27T18:10:00+02:00',
validUntil: '2021-10-29T02:00:00+02:00',
modified: '2021-10-28T08:50:03+02:00',
-}
+};
const gemeinsamSicherUnterwegs = {
id: '118634',
type: 'warning',
summary: 'Gemeinsam sicher unterwegs - mit Abstand und medizinischer Maske (in Berlin: FFP2)!',
- text: 'An Haltestellen und Bahnhöfen sowie in Fahrzeugen. Maskenmuffel riskieren mindestens 50 Euro.\n' +
- 'Weitere Informationen',
+ text: 'An Haltestellen und Bahnhöfen sowie in Fahrzeugen. Maskenmuffel riskieren mindestens 50 Euro.\n'
+ + 'Weitere Informationen',
icon: {type: 'HIM0', title: null},
priority: 100,
products: {
@@ -186,21 +186,21 @@ const gemeinsamSicherUnterwegs = {
bus: true,
ferry: true,
express: true,
- regional: true
+ regional: true,
},
company: 'VBB',
categories: [0],
validFrom: '2021-04-24T00:00:00+02:00',
validUntil: '2022-12-31T00:00:00+01:00',
modified: '2021-06-12T07:43:36+02:00',
-}
+};
const ausfallS8 = {
id: '140655',
type: 'warning',
summary: 'Ausfall S8 zwischen Frankfurter Allee und Greifswalder Straße.',
- text: 'Bauzeitverlängerung: Weiterhin durchgehend bis zum 29.10.(Do), ca. 1:30 Uhr kein Zugverkehr zwischen Greifswalder Str. und Frankfurter Allee. Zwischen Greifswalder Straße und Ostkreuz ist Ersatzverkehr mit Bussen eingerichtet. Bitte steigen Sie zwischen der S-Bahn und dem Ersatzverkehr am Bahnhof Ostkreuz um, am Bahnhof Frankfurter Allee beträgt der Fußweg zwischen S-Bahnhof und der Haltestelle des Ersatzverkehrs in der Gürtelstraße ca. 300 Meter. Achtung eingeschränkte Fahrradmitnahme! Bitte informieren Sie sich frühzeitig über Ihre Fahrmöglichkeiten. Wir bitten um Entschuldigung.\n' +
- 'S-Bahn Berlin',
+ text: 'Bauzeitverlängerung: Weiterhin durchgehend bis zum 29.10.(Do), ca. 1:30 Uhr kein Zugverkehr zwischen Greifswalder Str. und Frankfurter Allee. Zwischen Greifswalder Straße und Ostkreuz ist Ersatzverkehr mit Bussen eingerichtet. Bitte steigen Sie zwischen der S-Bahn und dem Ersatzverkehr am Bahnhof Ostkreuz um, am Bahnhof Frankfurter Allee beträgt der Fußweg zwischen S-Bahnhof und der Haltestelle des Ersatzverkehrs in der Gürtelstraße ca. 300 Meter. Achtung eingeschränkte Fahrradmitnahme! Bitte informieren Sie sich frühzeitig über Ihre Fahrmöglichkeiten. Wir bitten um Entschuldigung.\n'
+ + 'S-Bahn Berlin',
icon: {type: 'HIM1', title: null},
priority: 100,
products: {
@@ -210,14 +210,14 @@ const ausfallS8 = {
bus: true,
ferry: true,
express: true,
- regional: true
+ regional: true,
},
company: 'S-Bahn Berlin',
categories: [1],
validFrom: '2021-10-28T02:00:00+02:00',
validUntil: '2021-10-29T02:00:00+02:00',
modified: '2021-10-27T09:58:25+02:00',
-}
+};
const ersatzlinieWegenBauarbeiten = {
id: '140433',
@@ -233,14 +233,14 @@ const ersatzlinieWegenBauarbeiten = {
bus: true,
ferry: true,
express: true,
- regional: true
+ regional: true,
},
company: 'BVG',
categories: [1],
validFrom: '2021-10-25T02:00:00+02:00',
validUntil: '2021-11-22T03:00:00+01:00',
modified: '2021-10-22T23:39:21+02:00',
-}
+};
const fehlerImITSysem = {
id: '140805',
@@ -256,21 +256,21 @@ const fehlerImITSysem = {
bus: true,
ferry: true,
express: true,
- regional: true
+ regional: true,
},
company: 'VBB',
categories: [0],
validFrom: '2021-10-27T17:10:00+02:00',
validUntil: '2021-10-29T02:00:00+02:00',
modified: '2021-10-27T17:39:54+02:00',
-}
+};
const bauzeitverlängerung = {
id: '140558',
type: 'warning',
summary: 'Bauarbeiten.',
- text: 'Bauzeitverlängerung: Weiterhin durchgehend bis zum 29.10.(Fr), ca. 1:30 Uhr kein Zugverkehr zwischen Greifswalder Str. und Frankfurter Allee. Zwischen Greifswalder Straße und Ostkreuz ist Ersatzverkehr mit Bussen eingerichtet. Bitte steigen Sie zwischen der S-Bahn und dem Ersatzverkehr am Bahnhof Ostkreuz um, am Bahnhof Frankfurter Allee beträgt der Fußweg zwischen S-Bahnhof und der Haltestelle des Ersatzverkehrs in der Gürtelstraße ca. 300 Meter. Achtung eingeschränkte Fahrradmitnahme! Bitte informieren Sie sich frühzeitig über Ihre Fahrmöglichkeiten. Wir bitten um Entschuldigung.\n' +
- 'Infos Bauzeitverlängerung',
+ text: 'Bauzeitverlängerung: Weiterhin durchgehend bis zum 29.10.(Fr), ca. 1:30 Uhr kein Zugverkehr zwischen Greifswalder Str. und Frankfurter Allee. Zwischen Greifswalder Straße und Ostkreuz ist Ersatzverkehr mit Bussen eingerichtet. Bitte steigen Sie zwischen der S-Bahn und dem Ersatzverkehr am Bahnhof Ostkreuz um, am Bahnhof Frankfurter Allee beträgt der Fußweg zwischen S-Bahnhof und der Haltestelle des Ersatzverkehrs in der Gürtelstraße ca. 300 Meter. Achtung eingeschränkte Fahrradmitnahme! Bitte informieren Sie sich frühzeitig über Ihre Fahrmöglichkeiten. Wir bitten um Entschuldigung.\n'
+ + 'Infos Bauzeitverlängerung',
icon: {type: 'HIM1', title: null},
priority: 1,
products: {
@@ -280,14 +280,14 @@ const bauzeitverlängerung = {
bus: true,
ferry: true,
express: true,
- regional: true
+ regional: true,
},
company: 'VBB',
categories: [1],
validFrom: '2021-10-28T02:00:00+02:00',
validUntil: '2021-10-29T01:30:00+02:00',
modified: '2021-10-27T17:00:45+02:00',
-}
+};
const bvgArrivals = [
{
@@ -316,16 +316,16 @@ const bvgArrivals = [
operator: {
type: 'operator',
id: 'berliner-verkehrsbetriebe',
- name: 'Berliner Verkehrsbetriebe'
+ name: 'Berliner Verkehrsbetriebe',
},
},
remarks: [
{type: 'hint', code: 'bf', text: 'barrierefrei'},
{type: 'hint', code: 'FB', text: 'Fahrradmitnahme möglich'},
achtungFalscheFahrplanauskünfte,
- gemeinsamSicherUnterwegs
+ gemeinsamSicherUnterwegs,
],
- currentTripPosition: {type: 'location', latitude: 52.529859, longitude: 13.460987}
+ currentTripPosition: {type: 'location', latitude: 52.529859, longitude: 13.460987},
},
{
tripId: '1|19013|5|86|28102021',
@@ -353,16 +353,16 @@ const bvgArrivals = [
operator: {
type: 'operator',
id: 'berliner-verkehrsbetriebe',
- name: 'Berliner Verkehrsbetriebe'
+ name: 'Berliner Verkehrsbetriebe',
},
},
remarks: [
{type: 'hint', code: 'bf', text: 'barrierefrei'},
{type: 'hint', code: 'FB', text: 'Fahrradmitnahme möglich'},
achtungFalscheFahrplanauskünfte,
- gemeinsamSicherUnterwegs
+ gemeinsamSicherUnterwegs,
],
- currentTripPosition: {type: 'location', latitude: 52.527639, longitude: 13.452159}
+ currentTripPosition: {type: 'location', latitude: 52.527639, longitude: 13.452159},
},
{
tripId: '1|19067|24|86|28102021',
@@ -390,16 +390,16 @@ const bvgArrivals = [
operator: {
type: 'operator',
id: 'berliner-verkehrsbetriebe',
- name: 'Berliner Verkehrsbetriebe'
+ name: 'Berliner Verkehrsbetriebe',
},
},
remarks: [
{type: 'hint', code: 'bf', text: 'barrierefrei'},
{type: 'hint', code: 'FB', text: 'Fahrradmitnahme möglich'},
achtungFalscheFahrplanauskünfte,
- gemeinsamSicherUnterwegs
+ gemeinsamSicherUnterwegs,
],
- currentTripPosition: {type: 'location', latitude: 52.525949, longitude: 13.446262}
+ currentTripPosition: {type: 'location', latitude: 52.525949, longitude: 13.446262},
},
{
tripId: '1|17032|5|86|28102021',
@@ -427,16 +427,16 @@ const bvgArrivals = [
operator: {
type: 'operator',
id: 'berliner-verkehrsbetriebe',
- name: 'Berliner Verkehrsbetriebe'
+ name: 'Berliner Verkehrsbetriebe',
},
},
remarks: [
{type: 'hint', code: 'bf', text: 'barrierefrei'},
ersatzlinieWegenBauarbeiten,
achtungFalscheFahrplanauskünfte,
- gemeinsamSicherUnterwegs
+ gemeinsamSicherUnterwegs,
],
- currentTripPosition: {type: 'location', latitude: 52.524088, longitude: 13.439943}
+ currentTripPosition: {type: 'location', latitude: 52.524088, longitude: 13.439943},
},
{
tripId: '1|24512|0|86|28102021',
@@ -464,7 +464,7 @@ const bvgArrivals = [
operator: {
type: 'operator',
id: 's-bahn-berlin-gmbh',
- name: 'S-Bahn Berlin GmbH'
+ name: 'S-Bahn Berlin GmbH',
},
},
remarks: [
@@ -472,9 +472,9 @@ const bvgArrivals = [
{type: 'hint', code: 'FB', text: 'Fahrradmitnahme möglich'},
ausfallS8,
achtungFalscheFahrplanauskünfte,
- gemeinsamSicherUnterwegs
+ gemeinsamSicherUnterwegs,
],
- currentTripPosition: {type: 'location', latitude: 52.528915, longitude: 13.45536}
+ currentTripPosition: {type: 'location', latitude: 52.528915, longitude: 13.45536},
},
{
tripId: '1|52562|17|86|28102021',
@@ -502,7 +502,7 @@ const bvgArrivals = [
operator: {
type: 'operator',
id: 's-bahn-berlin-gmbh',
- name: 'S-Bahn Berlin GmbH'
+ name: 'S-Bahn Berlin GmbH',
},
},
remarks: [
@@ -511,9 +511,9 @@ const bvgArrivals = [
fehlerImITSysem,
bauzeitverlängerung,
achtungFalscheFahrplanauskünfte,
- gemeinsamSicherUnterwegs
+ gemeinsamSicherUnterwegs,
],
- currentTripPosition: {type: 'location', latitude: 52.52638, longitude: 13.458002}
+ currentTripPosition: {type: 'location', latitude: 52.52638, longitude: 13.458002},
},
{
tripId: '1|53738|6|86|28102021',
@@ -541,7 +541,7 @@ const bvgArrivals = [
operator: {
type: 'operator',
id: 's-bahn-berlin-gmbh',
- name: 'S-Bahn Berlin GmbH'
+ name: 'S-Bahn Berlin GmbH',
},
},
remarks: [
@@ -550,9 +550,9 @@ const bvgArrivals = [
fehlerImITSysem,
bauzeitverlängerung,
achtungFalscheFahrplanauskünfte,
- gemeinsamSicherUnterwegs
+ gemeinsamSicherUnterwegs,
],
- currentTripPosition: {type: 'location', latitude: 52.493426, longitude: 13.461283}
+ currentTripPosition: {type: 'location', latitude: 52.493426, longitude: 13.461283},
},
{
tripId: '1|17078|26|86|28102021',
@@ -580,16 +580,16 @@ const bvgArrivals = [
operator: {
type: 'operator',
id: 'berliner-verkehrsbetriebe',
- name: 'Berliner Verkehrsbetriebe'
+ name: 'Berliner Verkehrsbetriebe',
},
},
remarks: [
{type: 'hint', code: 'bf', text: 'barrierefrei'},
ersatzlinieWegenBauarbeiten,
achtungFalscheFahrplanauskünfte,
- gemeinsamSicherUnterwegs
+ gemeinsamSicherUnterwegs,
],
- currentTripPosition: {type: 'location', latitude: 52.525949, longitude: 13.446262}
+ currentTripPosition: {type: 'location', latitude: 52.525949, longitude: 13.446262},
},
{
tripId: '1|53354|9|86|28102021',
@@ -617,7 +617,7 @@ const bvgArrivals = [
operator: {
type: 'operator',
id: 's-bahn-berlin-gmbh',
- name: 'S-Bahn Berlin GmbH'
+ name: 'S-Bahn Berlin GmbH',
},
},
remarks: [
@@ -626,9 +626,9 @@ const bvgArrivals = [
fehlerImITSysem,
bauzeitverlängerung,
achtungFalscheFahrplanauskünfte,
- gemeinsamSicherUnterwegs
+ gemeinsamSicherUnterwegs,
],
- currentTripPosition: {type: 'location', latitude: 52.523513, longitude: 13.466003}
+ currentTripPosition: {type: 'location', latitude: 52.523513, longitude: 13.466003},
},
{
tripId: '1|18606|6|86|28102021',
@@ -656,16 +656,16 @@ const bvgArrivals = [
operator: {
type: 'operator',
id: 'berliner-verkehrsbetriebe',
- name: 'Berliner Verkehrsbetriebe'
+ name: 'Berliner Verkehrsbetriebe',
},
},
remarks: [
{type: 'hint', code: 'bf', text: 'barrierefrei'},
{type: 'hint', code: 'FB', text: 'Fahrradmitnahme möglich'},
achtungFalscheFahrplanauskünfte,
- gemeinsamSicherUnterwegs
+ gemeinsamSicherUnterwegs,
],
- currentTripPosition: {type: 'location', latitude: 52.530803, longitude: 13.461661}
+ currentTripPosition: {type: 'location', latitude: 52.530803, longitude: 13.461661},
},
{
tripId: '1|52010|0|86|28102021',
@@ -693,16 +693,16 @@ const bvgArrivals = [
operator: {
type: 'operator',
id: 's-bahn-berlin-gmbh',
- name: 'S-Bahn Berlin GmbH'
+ name: 'S-Bahn Berlin GmbH',
},
},
remarks: [
{type: 'hint', code: 'bf', text: 'barrierefrei'},
{type: 'hint', code: 'FB', text: 'Fahrradmitnahme möglich'},
achtungFalscheFahrplanauskünfte,
- gemeinsamSicherUnterwegs
+ gemeinsamSicherUnterwegs,
],
- currentTripPosition: {type: 'location', latitude: 52.54479, longitude: 13.425884}
+ currentTripPosition: {type: 'location', latitude: 52.54479, longitude: 13.425884},
},
{
tripId: '1|53328|1|86|28102021',
@@ -730,16 +730,16 @@ const bvgArrivals = [
operator: {
type: 'operator',
id: 's-bahn-berlin-gmbh',
- name: 'S-Bahn Berlin GmbH'
+ name: 'S-Bahn Berlin GmbH',
},
},
remarks: [
{type: 'hint', code: 'bf', text: 'barrierefrei'},
{type: 'hint', code: 'FB', text: 'Fahrradmitnahme möglich'},
achtungFalscheFahrplanauskünfte,
- gemeinsamSicherUnterwegs
+ gemeinsamSicherUnterwegs,
],
- currentTripPosition: {type: 'location', latitude: 52.492473, longitude: 13.460636}
+ currentTripPosition: {type: 'location', latitude: 52.492473, longitude: 13.460636},
},
{
tripId: '1|18731|27|86|28102021',
@@ -767,16 +767,16 @@ const bvgArrivals = [
operator: {
type: 'operator',
id: 'berliner-verkehrsbetriebe',
- name: 'Berliner Verkehrsbetriebe'
+ name: 'Berliner Verkehrsbetriebe',
},
},
remarks: [
{type: 'hint', code: 'bf', text: 'barrierefrei'},
{type: 'hint', code: 'FB', text: 'Fahrradmitnahme möglich'},
achtungFalscheFahrplanauskünfte,
- gemeinsamSicherUnterwegs
+ gemeinsamSicherUnterwegs,
],
- currentTripPosition: {type: 'location', latitude: 52.524016, longitude: 13.439745}
+ currentTripPosition: {type: 'location', latitude: 52.524016, longitude: 13.439745},
},
{
tripId: '1|24642|3|86|28102021',
@@ -806,7 +806,7 @@ const bvgArrivals = [
operator: {
type: 'operator',
id: 's-bahn-berlin-gmbh',
- name: 'S-Bahn Berlin GmbH'
+ name: 'S-Bahn Berlin GmbH',
},
},
remarks: [
@@ -818,15 +818,15 @@ const bvgArrivals = [
{
type: 'status',
code: 'text.realtime.journey.cancelled',
- text: 'S8: Fällt aus'
+ text: 'S8: Fällt aus',
},
{
type: 'status',
code: 'text.realtime.stop.cancelled',
- text: 'Halt entfällt'
- }
+ text: 'Halt entfällt',
+ },
],
- cancelled: true
+ cancelled: true,
},
{
tripId: '1|19013|6|86|28102021',
@@ -854,16 +854,16 @@ const bvgArrivals = [
operator: {
type: 'operator',
id: 'berliner-verkehrsbetriebe',
- name: 'Berliner Verkehrsbetriebe'
+ name: 'Berliner Verkehrsbetriebe',
},
},
remarks: [
{type: 'hint', code: 'bf', text: 'barrierefrei'},
{type: 'hint', code: 'FB', text: 'Fahrradmitnahme möglich'},
achtungFalscheFahrplanauskünfte,
- gemeinsamSicherUnterwegs
+ gemeinsamSicherUnterwegs,
],
- currentTripPosition: {type: 'location', latitude: 52.525499, longitude: 13.509529}
+ currentTripPosition: {type: 'location', latitude: 52.525499, longitude: 13.509529},
},
{
tripId: '1|19067|25|86|28102021',
@@ -891,16 +891,16 @@ const bvgArrivals = [
operator: {
type: 'operator',
id: 'berliner-verkehrsbetriebe',
- name: 'Berliner Verkehrsbetriebe'
+ name: 'Berliner Verkehrsbetriebe',
},
},
remarks: [
{type: 'hint', code: 'bf', text: 'barrierefrei'},
{type: 'hint', code: 'FB', text: 'Fahrradmitnahme möglich'},
achtungFalscheFahrplanauskünfte,
- gemeinsamSicherUnterwegs
+ gemeinsamSicherUnterwegs,
],
- currentTripPosition: {type: 'location', latitude: 52.524385, longitude: 13.421965}
+ currentTripPosition: {type: 'location', latitude: 52.524385, longitude: 13.421965},
},
{
tripId: '1|17032|6|86|28102021',
@@ -928,16 +928,16 @@ const bvgArrivals = [
operator: {
type: 'operator',
id: 'berliner-verkehrsbetriebe',
- name: 'Berliner Verkehrsbetriebe'
+ name: 'Berliner Verkehrsbetriebe',
},
},
remarks: [
{type: 'hint', code: 'bf', text: 'barrierefrei'},
ersatzlinieWegenBauarbeiten,
achtungFalscheFahrplanauskünfte,
- gemeinsamSicherUnterwegs
+ gemeinsamSicherUnterwegs,
],
- currentTripPosition: {type: 'location', latitude: 52.526749, longitude: 13.482327}
+ currentTripPosition: {type: 'location', latitude: 52.526749, longitude: 13.482327},
},
{
tripId: '1|24781|1|86|28102021',
@@ -967,7 +967,7 @@ const bvgArrivals = [
operator: {
type: 'operator',
id: 's-bahn-berlin-gmbh',
- name: 'S-Bahn Berlin GmbH'
+ name: 'S-Bahn Berlin GmbH',
},
},
remarks: [
@@ -977,8 +977,8 @@ const bvgArrivals = [
id: '140567',
type: 'warning',
summary: 'Bauarbeiten.',
- text: 'Diese Fahrt fällt heute leider aus, bitte auf die Linie S8 ausweichen. Wegen Bauzeitverlängerung fahren keine Züge zwischen Frankfurter Allee und Greifswalder Straße, hier fahren Busse. Wir bitten um Entschuldigung\n' +
- 'Infos Bauzeitverlängerung',
+ text: 'Diese Fahrt fällt heute leider aus, bitte auf die Linie S8 ausweichen. Wegen Bauzeitverlängerung fahren keine Züge zwischen Frankfurter Allee und Greifswalder Straße, hier fahren Busse. Wir bitten um Entschuldigung\n'
+ + 'Infos Bauzeitverlängerung',
icon: {type: 'HIM1', title: null},
priority: 50,
products: {
@@ -988,28 +988,28 @@ const bvgArrivals = [
bus: true,
ferry: true,
express: true,
- regional: true
+ regional: true,
},
company: 'VBB',
categories: [1],
validFrom: '2021-10-26T06:17:00+02:00',
validUntil: '2021-10-29T02:00:00+02:00',
- modified: '2021-10-27T13:00:52+02:00'
+ modified: '2021-10-27T13:00:52+02:00',
},
achtungFalscheFahrplanauskünfte,
gemeinsamSicherUnterwegs,
{
type: 'status',
code: 'text.realtime.journey.cancelled',
- text: 'S85: Fällt aus'
+ text: 'S85: Fällt aus',
},
{
type: 'status',
code: 'text.realtime.stop.cancelled',
- text: 'Halt entfällt'
- }
+ text: 'Halt entfällt',
+ },
],
- cancelled: true
+ cancelled: true,
},
{
tripId: '1|52562|18|86|28102021',
@@ -1037,7 +1037,7 @@ const bvgArrivals = [
operator: {
type: 'operator',
id: 's-bahn-berlin-gmbh',
- name: 'S-Bahn Berlin GmbH'
+ name: 'S-Bahn Berlin GmbH',
},
},
remarks: [
@@ -1046,9 +1046,9 @@ const bvgArrivals = [
fehlerImITSysem,
bauzeitverlängerung,
achtungFalscheFahrplanauskünfte,
- gemeinsamSicherUnterwegs
+ gemeinsamSicherUnterwegs,
],
- currentTripPosition: {type: 'location', latitude: 52.548898, longitude: 13.386934}
+ currentTripPosition: {type: 'location', latitude: 52.548898, longitude: 13.386934},
},
{
tripId: '1|53738|8|86|28102021',
@@ -1076,7 +1076,7 @@ const bvgArrivals = [
operator: {
type: 'operator',
id: 's-bahn-berlin-gmbh',
- name: 'S-Bahn Berlin GmbH'
+ name: 'S-Bahn Berlin GmbH',
},
},
remarks: [
@@ -1085,9 +1085,9 @@ const bvgArrivals = [
fehlerImITSysem,
bauzeitverlängerung,
achtungFalscheFahrplanauskünfte,
- gemeinsamSicherUnterwegs
+ gemeinsamSicherUnterwegs,
],
- currentTripPosition: {type: 'location', latitude: 52.48752, longitude: 13.459063}
+ currentTripPosition: {type: 'location', latitude: 52.48752, longitude: 13.459063},
},
{
tripId: '1|53738|9|86|28102021',
@@ -1115,7 +1115,7 @@ const bvgArrivals = [
operator: {
type: 'operator',
id: 's-bahn-berlin-gmbh',
- name: 'S-Bahn Berlin GmbH'
+ name: 'S-Bahn Berlin GmbH',
},
},
remarks: [
@@ -1124,9 +1124,9 @@ const bvgArrivals = [
fehlerImITSysem,
bauzeitverlängerung,
achtungFalscheFahrplanauskünfte,
- gemeinsamSicherUnterwegs
+ gemeinsamSicherUnterwegs,
],
- currentTripPosition: {type: 'location', latitude: 52.471834, longitude: 13.37905}
+ currentTripPosition: {type: 'location', latitude: 52.471834, longitude: 13.37905},
},
{
tripId: '1|53738|10|86|28102021',
@@ -1154,7 +1154,7 @@ const bvgArrivals = [
operator: {
type: 'operator',
id: 's-bahn-berlin-gmbh',
- name: 'S-Bahn Berlin GmbH'
+ name: 'S-Bahn Berlin GmbH',
},
},
remarks: [
@@ -1163,9 +1163,9 @@ const bvgArrivals = [
fehlerImITSysem,
bauzeitverlängerung,
achtungFalscheFahrplanauskünfte,
- gemeinsamSicherUnterwegs
+ gemeinsamSicherUnterwegs,
],
- currentTripPosition: {type: 'location', latitude: 52.480652, longitude: 13.45785}
+ currentTripPosition: {type: 'location', latitude: 52.480652, longitude: 13.45785},
},
{
tripId: '1|53738|11|86|28102021',
@@ -1193,7 +1193,7 @@ const bvgArrivals = [
operator: {
type: 'operator',
id: 's-bahn-berlin-gmbh',
- name: 'S-Bahn Berlin GmbH'
+ name: 'S-Bahn Berlin GmbH',
},
},
remarks: [
@@ -1202,9 +1202,9 @@ const bvgArrivals = [
fehlerImITSysem,
bauzeitverlängerung,
achtungFalscheFahrplanauskünfte,
- gemeinsamSicherUnterwegs
+ gemeinsamSicherUnterwegs,
],
- currentTripPosition: {type: 'location', latitude: 52.477227, longitude: 13.457068}
+ currentTripPosition: {type: 'location', latitude: 52.477227, longitude: 13.457068},
},
{
tripId: '1|53738|12|86|28102021',
@@ -1232,7 +1232,7 @@ const bvgArrivals = [
operator: {
type: 'operator',
id: 's-bahn-berlin-gmbh',
- name: 'S-Bahn Berlin GmbH'
+ name: 'S-Bahn Berlin GmbH',
},
},
remarks: [
@@ -1241,12 +1241,12 @@ const bvgArrivals = [
fehlerImITSysem,
bauzeitverlängerung,
achtungFalscheFahrplanauskünfte,
- gemeinsamSicherUnterwegs
+ gemeinsamSicherUnterwegs,
],
currentTripPosition: {type: 'location', latitude: 52.473811, longitude: 13.456142},
},
-]
+];
export {
bvgArrivals,
-}
+};
diff --git a/test/fixtures/bvg-journey.js b/test/fixtures/bvg-journey.js
index 3b67ca4f..25fb8789 100644
--- a/test/fixtures/bvg-journey.js
+++ b/test/fixtures/bvg-journey.js
@@ -7,7 +7,7 @@ const bvgJourney = {
latitude: 52.521769,
longitude: 13.395231,
name: 'Berlin, Bodemuseum',
- poi: true
+ poi: true,
},
destination: {
type: 'stop',
@@ -17,7 +17,7 @@ const bvgJourney = {
type: 'location',
id: '900100007',
latitude: 52.525158,
- longitude: 13.393064
+ longitude: 13.393064,
},
products: {
suburban: true,
@@ -26,8 +26,8 @@ const bvgJourney = {
bus: false,
ferry: false,
express: false,
- regional: false
- }
+ regional: false,
+ },
},
arrival: '2019-08-18T14:16:00+02:00',
plannedArrival: '2019-08-18T14:16:00+02:00',
@@ -37,7 +37,7 @@ const bvgJourney = {
departureDelay: null,
public: true,
walking: true,
- distance: 568
+ distance: 568,
}, {
origin: {
type: 'stop',
@@ -47,7 +47,7 @@ const bvgJourney = {
type: 'location',
id: '900100007',
latitude: 52.525158,
- longitude: 13.393064
+ longitude: 13.393064,
},
products: {
suburban: true,
@@ -56,8 +56,8 @@ const bvgJourney = {
bus: false,
ferry: false,
express: false,
- regional: false
- }
+ regional: false,
+ },
},
destination: {
type: 'stop',
@@ -67,7 +67,7 @@ const bvgJourney = {
type: 'location',
id: '900058101',
latitude: 52.475465,
- longitude: 13.365575
+ longitude: 13.365575,
},
products: {
suburban: true,
@@ -76,8 +76,8 @@ const bvgJourney = {
bus: true,
ferry: false,
express: true,
- regional: true
- }
+ regional: true,
+ },
},
arrival: '2019-08-18T14:29:00+02:00',
plannedArrival: '2019-08-18T14:29:00+02:00',
@@ -101,7 +101,7 @@ const bvgJourney = {
type: 'location',
id: '900100007',
latitude: 52.525158,
- longitude: 13.393064
+ longitude: 13.393064,
},
products: {
suburban: true,
@@ -110,16 +110,16 @@ const bvgJourney = {
bus: false,
ferry: false,
express: false,
- regional: false
- }
+ regional: false,
+ },
},
geometry: {
type: 'Point',
coordinates: [
13.39306,
- 52.52516
- ]
- }
+ 52.52516,
+ ],
+ },
},
{
type: 'Feature',
@@ -128,9 +128,9 @@ const bvgJourney = {
type: 'Point',
coordinates: [
13.39176,
- 52.52284
- ]
- }
+ 52.52284,
+ ],
+ },
},
{
type: 'Feature',
@@ -139,9 +139,9 @@ const bvgJourney = {
type: 'Point',
coordinates: [
13.39023,
- 52.52216
- ]
- }
+ 52.52216,
+ ],
+ },
},
{
type: 'Feature',
@@ -150,9 +150,9 @@ const bvgJourney = {
type: 'Point',
coordinates: [
13.38866,
- 52.52195
- ]
- }
+ 52.52195,
+ ],
+ },
},
{
type: 'Feature',
@@ -161,9 +161,9 @@ const bvgJourney = {
type: 'Point',
coordinates: [
13.38798,
- 52.52174
- ]
- }
+ 52.52174,
+ ],
+ },
},
{
type: 'Feature',
@@ -172,9 +172,9 @@ const bvgJourney = {
type: 'Point',
coordinates: [
13.38744,
- 52.52141
- ]
- }
+ 52.52141,
+ ],
+ },
},
{
type: 'Feature',
@@ -183,9 +183,9 @@ const bvgJourney = {
type: 'Point',
coordinates: [
13.38651,
- 52.5206
- ]
- }
+ 52.5206,
+ ],
+ },
},
{
type: 'Feature',
@@ -197,7 +197,7 @@ const bvgJourney = {
type: 'location',
id: '900100001',
latitude: 52.520268,
- longitude: 13.387149
+ longitude: 13.387149,
},
products: {
suburban: true,
@@ -206,16 +206,16 @@ const bvgJourney = {
bus: true,
ferry: false,
express: false,
- regional: true
- }
+ regional: true,
+ },
},
geometry: {
type: 'Point',
coordinates: [
13.38715,
- 52.52027
- ]
- }
+ 52.52027,
+ ],
+ },
},
{
type: 'Feature',
@@ -224,9 +224,9 @@ const bvgJourney = {
type: 'Point',
coordinates: [
13.38635,
- 52.52049
- ]
- }
+ 52.52049,
+ ],
+ },
},
{
type: 'Feature',
@@ -235,9 +235,9 @@ const bvgJourney = {
type: 'Point',
coordinates: [
13.38537,
- 52.51974
- ]
- }
+ 52.51974,
+ ],
+ },
},
{
type: 'Feature',
@@ -246,9 +246,9 @@ const bvgJourney = {
type: 'Point',
coordinates: [
13.38567,
- 52.51785
- ]
- }
+ 52.51785,
+ ],
+ },
},
{
type: 'Feature',
@@ -257,9 +257,9 @@ const bvgJourney = {
type: 'Point',
coordinates: [
13.3855,
- 52.51745
- ]
- }
+ 52.51745,
+ ],
+ },
},
{
type: 'Feature',
@@ -268,9 +268,9 @@ const bvgJourney = {
type: 'Point',
coordinates: [
13.38497,
- 52.51691
- ]
- }
+ 52.51691,
+ ],
+ },
},
{
type: 'Feature',
@@ -279,9 +279,9 @@ const bvgJourney = {
type: 'Point',
coordinates: [
13.38444,
- 52.51665
- ]
- }
+ 52.51665,
+ ],
+ },
},
{
type: 'Feature',
@@ -290,9 +290,9 @@ const bvgJourney = {
type: 'Point',
coordinates: [
13.38399,
- 52.51657
- ]
- }
+ 52.51657,
+ ],
+ },
},
{
type: 'Feature',
@@ -304,7 +304,7 @@ const bvgJourney = {
type: 'location',
id: '900100025',
latitude: 52.51651,
- longitude: 13.381936
+ longitude: 13.381936,
},
products: {
suburban: true,
@@ -313,16 +313,16 @@ const bvgJourney = {
bus: true,
ferry: false,
express: false,
- regional: false
- }
+ regional: false,
+ },
},
geometry: {
type: 'Point',
coordinates: [
13.38194,
- 52.51651
- ]
- }
+ 52.51651,
+ ],
+ },
},
{
type: 'Feature',
@@ -331,9 +331,9 @@ const bvgJourney = {
type: 'Point',
coordinates: [
13.38178,
- 52.51643
- ]
- }
+ 52.51643,
+ ],
+ },
},
{
type: 'Feature',
@@ -342,9 +342,9 @@ const bvgJourney = {
type: 'Point',
coordinates: [
13.37888,
- 52.51623
- ]
- }
+ 52.51623,
+ ],
+ },
},
{
type: 'Feature',
@@ -353,9 +353,9 @@ const bvgJourney = {
type: 'Point',
coordinates: [
13.37831,
- 52.51609
- ]
- }
+ 52.51609,
+ ],
+ },
},
{
type: 'Feature',
@@ -364,9 +364,9 @@ const bvgJourney = {
type: 'Point',
coordinates: [
13.37768,
- 52.51576
- ]
- }
+ 52.51576,
+ ],
+ },
},
{
type: 'Feature',
@@ -375,9 +375,9 @@ const bvgJourney = {
type: 'Point',
coordinates: [
13.37714,
- 52.51313
- ]
- }
+ 52.51313,
+ ],
+ },
},
{
type: 'Feature',
@@ -386,9 +386,9 @@ const bvgJourney = {
type: 'Point',
coordinates: [
13.37669,
- 52.51024
- ]
- }
+ 52.51024,
+ ],
+ },
},
{
type: 'Feature',
@@ -397,9 +397,9 @@ const bvgJourney = {
type: 'Point',
coordinates: [
13.3767,
- 52.50949
- ]
- }
+ 52.50949,
+ ],
+ },
},
{
type: 'Feature',
@@ -411,7 +411,7 @@ const bvgJourney = {
type: 'location',
id: '900100020',
latitude: 52.509337,
- longitude: 13.376452
+ longitude: 13.376452,
},
products: {
suburban: true,
@@ -420,16 +420,16 @@ const bvgJourney = {
bus: false,
ferry: false,
express: false,
- regional: true
- }
+ regional: true,
+ },
},
geometry: {
type: 'Point',
coordinates: [
13.37645,
- 52.50934
- ]
- }
+ 52.50934,
+ ],
+ },
},
{
type: 'Feature',
@@ -438,9 +438,9 @@ const bvgJourney = {
type: 'Point',
coordinates: [
13.37686,
- 52.50873
- ]
- }
+ 52.50873,
+ ],
+ },
},
{
type: 'Feature',
@@ -452,7 +452,7 @@ const bvgJourney = {
type: 'location',
id: '900012101',
latitude: 52.504537,
- longitude: 13.38208
+ longitude: 13.38208,
},
products: {
suburban: true,
@@ -461,16 +461,16 @@ const bvgJourney = {
bus: true,
ferry: false,
express: false,
- regional: false
- }
+ regional: false,
+ },
},
geometry: {
type: 'Point',
coordinates: [
13.38208,
- 52.50454
- ]
- }
+ 52.50454,
+ ],
+ },
},
{
type: 'Feature',
@@ -479,9 +479,9 @@ const bvgJourney = {
type: 'Point',
coordinates: [
13.38181,
- 52.5046
- ]
- }
+ 52.5046,
+ ],
+ },
},
{
type: 'Feature',
@@ -490,9 +490,9 @@ const bvgJourney = {
type: 'Point',
coordinates: [
13.37956,
- 52.50099
- ]
- }
+ 52.50099,
+ ],
+ },
},
{
type: 'Feature',
@@ -501,9 +501,9 @@ const bvgJourney = {
type: 'Point',
coordinates: [
13.37902,
- 52.50004
- ]
- }
+ 52.50004,
+ ],
+ },
},
{
type: 'Feature',
@@ -512,9 +512,9 @@ const bvgJourney = {
type: 'Point',
coordinates: [
13.37814,
- 52.49942
- ]
- }
+ 52.49942,
+ ],
+ },
},
{
type: 'Feature',
@@ -523,9 +523,9 @@ const bvgJourney = {
type: 'Point',
coordinates: [
13.37639,
- 52.4987
- ]
- }
+ 52.4987,
+ ],
+ },
},
{
type: 'Feature',
@@ -534,9 +534,9 @@ const bvgJourney = {
type: 'Point',
coordinates: [
13.37493,
- 52.49795
- ]
- }
+ 52.49795,
+ ],
+ },
},
{
type: 'Feature',
@@ -545,9 +545,9 @@ const bvgJourney = {
type: 'Point',
coordinates: [
13.37338,
- 52.49679
- ]
- }
+ 52.49679,
+ ],
+ },
},
{
type: 'Feature',
@@ -556,9 +556,9 @@ const bvgJourney = {
type: 'Point',
coordinates: [
13.37287,
- 52.49597
- ]
- }
+ 52.49597,
+ ],
+ },
},
{
type: 'Feature',
@@ -567,9 +567,9 @@ const bvgJourney = {
type: 'Point',
coordinates: [
13.37242,
- 52.49468
- ]
- }
+ 52.49468,
+ ],
+ },
},
{
type: 'Feature',
@@ -581,7 +581,7 @@ const bvgJourney = {
type: 'location',
id: '900058103',
latitude: 52.49232,
- longitude: 13.372227
+ longitude: 13.372227,
},
products: {
suburban: true,
@@ -590,16 +590,16 @@ const bvgJourney = {
bus: true,
ferry: false,
express: false,
- regional: false
- }
+ regional: false,
+ },
},
geometry: {
type: 'Point',
coordinates: [
13.37223,
- 52.49232
- ]
- }
+ 52.49232,
+ ],
+ },
},
{
type: 'Feature',
@@ -608,9 +608,9 @@ const bvgJourney = {
type: 'Point',
coordinates: [
13.37207,
- 52.49233
- ]
- }
+ 52.49233,
+ ],
+ },
},
{
type: 'Feature',
@@ -619,9 +619,9 @@ const bvgJourney = {
type: 'Point',
coordinates: [
13.37186,
- 52.48857
- ]
- }
+ 52.48857,
+ ],
+ },
},
{
type: 'Feature',
@@ -630,9 +630,9 @@ const bvgJourney = {
type: 'Point',
coordinates: [
13.37121,
- 52.48667
- ]
- }
+ 52.48667,
+ ],
+ },
},
{
type: 'Feature',
@@ -641,9 +641,9 @@ const bvgJourney = {
type: 'Point',
coordinates: [
13.36503,
- 52.47612
- ]
- }
+ 52.47612,
+ ],
+ },
},
{
type: 'Feature',
@@ -652,9 +652,9 @@ const bvgJourney = {
type: 'Point',
coordinates: [
13.36524,
- 52.476
- ]
- }
+ 52.476,
+ ],
+ },
},
{
type: 'Feature',
@@ -666,7 +666,7 @@ const bvgJourney = {
type: 'location',
id: '900058101',
latitude: 52.475465,
- longitude: 13.365575
+ longitude: 13.365575,
},
products: {
suburban: true,
@@ -675,18 +675,18 @@ const bvgJourney = {
bus: true,
ferry: false,
express: true,
- regional: true
- }
+ regional: true,
+ },
},
geometry: {
type: 'Point',
coordinates: [
13.36558,
- 52.47547
- ]
- }
- }
- ]
+ 52.47547,
+ ],
+ },
+ },
+ ],
},
tripId: '1|32794|20|86|18082019',
line: {
@@ -702,7 +702,7 @@ const bvgJourney = {
operator: {
type: 'operator',
id: 's-bahn-berlin-gmbh',
- name: 'S-Bahn Berlin GmbH'
+ name: 'S-Bahn Berlin GmbH',
},
},
direction: 'S Blankenfelde (TF) Bhf',
@@ -719,7 +719,7 @@ const bvgJourney = {
type: 'location',
id: '900100007',
latitude: 52.525158,
- longitude: 13.393064
+ longitude: 13.393064,
},
products: {
suburban: true,
@@ -728,8 +728,8 @@ const bvgJourney = {
bus: false,
ferry: false,
express: false,
- regional: false
- }
+ regional: false,
+ },
},
arrival: null,
plannedArrival: null,
@@ -753,7 +753,7 @@ const bvgJourney = {
type: 'location',
id: '900100001',
latitude: 52.520268,
- longitude: 13.387149
+ longitude: 13.387149,
},
products: {
suburban: true,
@@ -762,8 +762,8 @@ const bvgJourney = {
bus: true,
ferry: false,
express: false,
- regional: true
- }
+ regional: true,
+ },
},
arrival: '2019-08-18T14:18:00+02:00',
plannedArrival: '2019-08-18T14:18:00+02:00',
@@ -787,7 +787,7 @@ const bvgJourney = {
type: 'location',
id: '900100025',
latitude: 52.51651,
- longitude: 13.381936
+ longitude: 13.381936,
},
products: {
suburban: true,
@@ -796,8 +796,8 @@ const bvgJourney = {
bus: true,
ferry: false,
express: false,
- regional: false
- }
+ regional: false,
+ },
},
arrival: '2019-08-18T14:19:00+02:00',
plannedArrival: '2019-08-18T14:19:00+02:00',
@@ -821,7 +821,7 @@ const bvgJourney = {
type: 'location',
id: '900100020',
latitude: 52.509337,
- longitude: 13.376452
+ longitude: 13.376452,
},
products: {
suburban: true,
@@ -830,8 +830,8 @@ const bvgJourney = {
bus: false,
ferry: false,
express: false,
- regional: true
- }
+ regional: true,
+ },
},
arrival: '2019-08-18T14:21:00+02:00',
plannedArrival: '2019-08-18T14:21:00+02:00',
@@ -855,7 +855,7 @@ const bvgJourney = {
type: 'location',
id: '900012101',
latitude: 52.504537,
- longitude: 13.38208
+ longitude: 13.38208,
},
products: {
suburban: true,
@@ -864,8 +864,8 @@ const bvgJourney = {
bus: true,
ferry: false,
express: false,
- regional: false
- }
+ regional: false,
+ },
},
arrival: '2019-08-18T14:24:00+02:00',
plannedArrival: '2019-08-18T14:24:00+02:00',
@@ -889,7 +889,7 @@ const bvgJourney = {
type: 'location',
id: '900058103',
latitude: 52.49232,
- longitude: 13.372227
+ longitude: 13.372227,
},
products: {
suburban: true,
@@ -898,8 +898,8 @@ const bvgJourney = {
bus: true,
ferry: false,
express: false,
- regional: false
- }
+ regional: false,
+ },
},
arrival: '2019-08-18T14:26:00+02:00',
plannedArrival: '2019-08-18T14:26:00+02:00',
@@ -923,7 +923,7 @@ const bvgJourney = {
type: 'location',
id: '900058101',
latitude: 52.475465,
- longitude: 13.365575
+ longitude: 13.365575,
},
products: {
suburban: true,
@@ -932,8 +932,8 @@ const bvgJourney = {
bus: true,
ferry: false,
express: true,
- regional: true
- }
+ regional: true,
+ },
},
arrival: '2019-08-18T14:29:00+02:00',
plannedArrival: '2019-08-18T14:29:00+02:00',
@@ -952,23 +952,23 @@ const bvgJourney = {
{
type: 'hint',
code: 'bf',
- text: 'barrier-free'
+ text: 'barrier-free',
},
{
type: 'hint',
code: 'FB',
- text: 'Bicycle conveyance'
- }
+ text: 'Bicycle conveyance',
+ },
],
cycle: {
min: 300,
max: 600,
- nr: 19
- }
+ nr: 19,
+ },
}],
refreshToken: '¶HKI¶G@F$A=4@O=Berlin, Bodemuseum@X=13395231@Y=52521769@L=900980968@a=128@$A=1@O=S Oranienburger Str. (Berlin)@L=900100007@a=128@$201908181406$201908181416$$$1$§T$A=1@O=S Oranienburger Str. (Berlin)@L=900100007@a=128@$A=1@O=S Südkreuz Bhf (Berlin)@L=900058101@a=128@$201908181416$201908181429$ S2$$1$¶GP¶ft@0@2000@120@-1@100@1@1000@0@@@@@false@0@-1@$f@$f@$f@$f@$f@$§bt@0@2000@120@-1@100@1@1000@0@@@@@false@0@-1@$f@$f@$f@$f@$f@$§tf@$f@$f@$f@$f@$f@$§',
cycle: {
- min: 300
+ min: 300,
},
scheduledDays: Object.assign(Object.create(null), {
'2019-08-11': true,
@@ -1100,8 +1100,8 @@ const bvgJourney = {
'2019-12-15': false,
'2019-12-16': false,
}),
-}
+};
export {
bvgJourney,
-}
+};
diff --git a/test/fixtures/bvg-radar.js b/test/fixtures/bvg-radar.js
index fbf850fd..127bf146 100644
--- a/test/fixtures/bvg-radar.js
+++ b/test/fixtures/bvg-radar.js
@@ -14,7 +14,7 @@ const bvgRadar = [
location: {
type: 'location',
latitude: 52.52211,
- longitude: 13.414728
+ longitude: 13.414728,
},
nextStopovers: [
{
@@ -26,7 +26,7 @@ const bvgRadar = [
type: 'location',
id: '900100002',
latitude: 52.522605,
- longitude: 13.402359
+ longitude: 13.402359,
},
products: {
suburban: true,
@@ -35,8 +35,8 @@ const bvgRadar = [
bus: true,
ferry: false,
express: false,
- regional: false
- }
+ regional: false,
+ },
},
arrival: null,
plannedArrival: null,
@@ -60,7 +60,7 @@ const bvgRadar = [
type: 'location',
id: '900100026',
latitude: 52.521059,
- longitude: 13.41125
+ longitude: 13.41125,
},
products: {
suburban: false,
@@ -69,8 +69,8 @@ const bvgRadar = [
bus: false,
ferry: false,
express: false,
- regional: false
- }
+ regional: false,
+ },
},
arrival: '2019-08-19T20:30:00+02:00',
plannedArrival: '2019-08-19T20:29:00+02:00',
@@ -94,7 +94,7 @@ const bvgRadar = [
type: 'location',
id: '900100005',
latitude: 52.522389,
- longitude: 13.414495
+ longitude: 13.414495,
},
products: {
suburban: false,
@@ -103,8 +103,8 @@ const bvgRadar = [
bus: false,
ferry: false,
express: false,
- regional: false
- }
+ regional: false,
+ },
},
arrival: '2019-08-19T20:34:00+02:00',
plannedArrival: '2019-08-19T20:31:00+02:00',
@@ -128,7 +128,7 @@ const bvgRadar = [
type: 'location',
id: '900151003',
latitude: 52.57236,
- longitude: 13.495164
+ longitude: 13.495164,
},
products: {
suburban: false,
@@ -137,8 +137,8 @@ const bvgRadar = [
bus: false,
ferry: false,
express: false,
- regional: false
- }
+ regional: false,
+ },
},
arrival: '2019-08-19T21:01:00+02:00',
plannedArrival: '2019-08-19T20:58:00+02:00',
@@ -152,7 +152,7 @@ const bvgRadar = [
departurePlatform: null,
plannedDeparturePlatform: null,
departurePrognosisType: null,
- }
+ },
],
frames: [
{
@@ -164,7 +164,7 @@ const bvgRadar = [
type: 'location',
id: '900100026',
latitude: 52.521059,
- longitude: 13.41125
+ longitude: 13.41125,
},
products: {
suburban: false,
@@ -173,8 +173,8 @@ const bvgRadar = [
bus: false,
ferry: false,
express: false,
- regional: false
- }
+ regional: false,
+ },
},
destination: {
type: 'stop',
@@ -184,7 +184,7 @@ const bvgRadar = [
type: 'location',
id: '900100005',
latitude: 52.522389,
- longitude: 13.414495
+ longitude: 13.414495,
},
products: {
suburban: false,
@@ -193,10 +193,10 @@ const bvgRadar = [
bus: false,
ferry: false,
express: false,
- regional: false
- }
+ regional: false,
+ },
},
- t: 0
+ t: 0,
},
{
origin: {
@@ -207,7 +207,7 @@ const bvgRadar = [
type: 'location',
id: '900100026',
latitude: 52.521059,
- longitude: 13.41125
+ longitude: 13.41125,
},
products: {
suburban: false,
@@ -216,8 +216,8 @@ const bvgRadar = [
bus: false,
ferry: false,
express: false,
- regional: false
- }
+ regional: false,
+ },
},
destination: {
type: 'stop',
@@ -227,7 +227,7 @@ const bvgRadar = [
type: 'location',
id: '900100005',
latitude: 52.522389,
- longitude: 13.414495
+ longitude: 13.414495,
},
products: {
suburban: false,
@@ -236,10 +236,10 @@ const bvgRadar = [
bus: false,
ferry: false,
express: false,
- regional: false
- }
+ regional: false,
+ },
},
- t: 10000
+ t: 10000,
},
{
origin: {
@@ -250,7 +250,7 @@ const bvgRadar = [
type: 'location',
id: '900100026',
latitude: 52.521059,
- longitude: 13.41125
+ longitude: 13.41125,
},
products: {
suburban: false,
@@ -259,8 +259,8 @@ const bvgRadar = [
bus: false,
ferry: false,
express: false,
- regional: false
- }
+ regional: false,
+ },
},
destination: {
type: 'stop',
@@ -270,7 +270,7 @@ const bvgRadar = [
type: 'location',
id: '900100005',
latitude: 52.522389,
- longitude: 13.414495
+ longitude: 13.414495,
},
products: {
suburban: false,
@@ -279,10 +279,10 @@ const bvgRadar = [
bus: false,
ferry: false,
express: false,
- regional: false
- }
+ regional: false,
+ },
},
- t: 20000
+ t: 20000,
},
{
origin: {
@@ -293,7 +293,7 @@ const bvgRadar = [
type: 'location',
id: '900100026',
latitude: 52.521059,
- longitude: 13.41125
+ longitude: 13.41125,
},
products: {
suburban: false,
@@ -302,8 +302,8 @@ const bvgRadar = [
bus: false,
ferry: false,
express: false,
- regional: false
- }
+ regional: false,
+ },
},
destination: {
type: 'stop',
@@ -313,7 +313,7 @@ const bvgRadar = [
type: 'location',
id: '900100005',
latitude: 52.522389,
- longitude: 13.414495
+ longitude: 13.414495,
},
products: {
suburban: false,
@@ -322,11 +322,11 @@ const bvgRadar = [
bus: false,
ferry: false,
express: false,
- regional: false
- }
+ regional: false,
+ },
},
- t: 30000
- }
+ t: 30000,
+ },
],
polyline: {
type: 'FeatureCollection',
@@ -338,9 +338,9 @@ const bvgRadar = [
type: 'Point',
coordinates: [
13.41473,
- 52.52211
- ]
- }
+ 52.52211,
+ ],
+ },
},
{
type: 'Feature',
@@ -349,9 +349,9 @@ const bvgRadar = [
type: 'Point',
coordinates: [
13.4149,
- 52.52222
- ]
- }
+ 52.52222,
+ ],
+ },
},
{
type: 'Feature',
@@ -360,9 +360,9 @@ const bvgRadar = [
type: 'Point',
coordinates: [
13.41507,
- 52.52234
- ]
- }
+ 52.52234,
+ ],
+ },
},
{
type: 'Feature',
@@ -371,12 +371,12 @@ const bvgRadar = [
type: 'Point',
coordinates: [
13.4151,
- 52.52236
- ]
- }
- }
- ]
- }
+ 52.52236,
+ ],
+ },
+ },
+ ],
+ },
},
{
direction: 'S Spandau Bhf (Berlin)',
@@ -393,7 +393,7 @@ const bvgRadar = [
location: {
type: 'location',
latitude: 52.521877,
- longitude: 13.410899
+ longitude: 13.410899,
},
nextStopovers: [
{
@@ -405,7 +405,7 @@ const bvgRadar = [
type: 'location',
id: '900260005',
latitude: 52.390796,
- longitude: 13.51352
+ longitude: 13.51352,
},
products: {
suburban: true,
@@ -414,8 +414,8 @@ const bvgRadar = [
bus: true,
ferry: false,
express: false,
- regional: true
- }
+ regional: true,
+ },
},
arrival: null,
plannedArrival: null,
@@ -439,7 +439,7 @@ const bvgRadar = [
type: 'location',
id: '900100003',
latitude: 52.521508,
- longitude: 13.411267
+ longitude: 13.411267,
},
products: {
suburban: true,
@@ -448,8 +448,8 @@ const bvgRadar = [
bus: true,
ferry: false,
express: false,
- regional: true
- }
+ regional: true,
+ },
},
arrival: '2019-08-19T20:32:00+02:00',
plannedArrival: '2019-08-19T20:32:00+02:00',
@@ -473,7 +473,7 @@ const bvgRadar = [
type: 'location',
id: '900100002',
latitude: 52.522605,
- longitude: 13.402359
+ longitude: 13.402359,
},
products: {
suburban: true,
@@ -482,8 +482,8 @@ const bvgRadar = [
bus: true,
ferry: false,
express: false,
- regional: false
- }
+ regional: false,
+ },
},
arrival: '2019-08-19T20:34:00+02:00',
plannedArrival: '2019-08-19T20:34:00+02:00',
@@ -507,7 +507,7 @@ const bvgRadar = [
type: 'location',
id: '900029101',
latitude: 52.534794,
- longitude: 13.197477
+ longitude: 13.197477,
},
products: {
suburban: true,
@@ -516,8 +516,8 @@ const bvgRadar = [
bus: false,
ferry: false,
express: true,
- regional: true
- }
+ regional: true,
+ },
},
arrival: '2019-08-19T21:07:00+02:00',
plannedArrival: '2019-08-19T21:07:00+02:00',
@@ -531,7 +531,7 @@ const bvgRadar = [
departurePlatform: null,
plannedDeparturePlatform: null,
departurePrognosisType: null,
- }
+ },
],
frames: [
{
@@ -543,7 +543,7 @@ const bvgRadar = [
type: 'location',
id: '900100003',
latitude: 52.521508,
- longitude: 13.411267
+ longitude: 13.411267,
},
products: {
suburban: true,
@@ -552,8 +552,8 @@ const bvgRadar = [
bus: true,
ferry: false,
express: false,
- regional: true
- }
+ regional: true,
+ },
},
destination: {
type: 'stop',
@@ -563,7 +563,7 @@ const bvgRadar = [
type: 'location',
id: '900100002',
latitude: 52.522605,
- longitude: 13.402359
+ longitude: 13.402359,
},
products: {
suburban: true,
@@ -572,10 +572,10 @@ const bvgRadar = [
bus: true,
ferry: false,
express: false,
- regional: false
- }
+ regional: false,
+ },
},
- t: 0
+ t: 0,
},
{
origin: {
@@ -586,7 +586,7 @@ const bvgRadar = [
type: 'location',
id: '900100003',
latitude: 52.521508,
- longitude: 13.411267
+ longitude: 13.411267,
},
products: {
suburban: true,
@@ -595,8 +595,8 @@ const bvgRadar = [
bus: true,
ferry: false,
express: false,
- regional: true
- }
+ regional: true,
+ },
},
destination: {
type: 'stop',
@@ -606,7 +606,7 @@ const bvgRadar = [
type: 'location',
id: '900100002',
latitude: 52.522605,
- longitude: 13.402359
+ longitude: 13.402359,
},
products: {
suburban: true,
@@ -615,10 +615,10 @@ const bvgRadar = [
bus: true,
ferry: false,
express: false,
- regional: false
- }
+ regional: false,
+ },
},
- t: 10000
+ t: 10000,
},
{
origin: {
@@ -629,7 +629,7 @@ const bvgRadar = [
type: 'location',
id: '900100003',
latitude: 52.521508,
- longitude: 13.411267
+ longitude: 13.411267,
},
products: {
suburban: true,
@@ -638,8 +638,8 @@ const bvgRadar = [
bus: true,
ferry: false,
express: false,
- regional: true
- }
+ regional: true,
+ },
},
destination: {
type: 'stop',
@@ -649,7 +649,7 @@ const bvgRadar = [
type: 'location',
id: '900100002',
latitude: 52.522605,
- longitude: 13.402359
+ longitude: 13.402359,
},
products: {
suburban: true,
@@ -658,10 +658,10 @@ const bvgRadar = [
bus: true,
ferry: false,
express: false,
- regional: false
- }
+ regional: false,
+ },
},
- t: 20000
+ t: 20000,
},
{
origin: {
@@ -672,7 +672,7 @@ const bvgRadar = [
type: 'location',
id: '900100003',
latitude: 52.521508,
- longitude: 13.411267
+ longitude: 13.411267,
},
products: {
suburban: true,
@@ -681,8 +681,8 @@ const bvgRadar = [
bus: true,
ferry: false,
express: false,
- regional: true
- }
+ regional: true,
+ },
},
destination: {
type: 'stop',
@@ -692,7 +692,7 @@ const bvgRadar = [
type: 'location',
id: '900100002',
latitude: 52.522605,
- longitude: 13.402359
+ longitude: 13.402359,
},
products: {
suburban: true,
@@ -701,11 +701,11 @@ const bvgRadar = [
bus: true,
ferry: false,
express: false,
- regional: false
- }
+ regional: false,
+ },
},
- t: 30000
- }
+ t: 30000,
+ },
],
polyline: {
type: 'FeatureCollection',
@@ -717,9 +717,9 @@ const bvgRadar = [
type: 'Point',
coordinates: [
13.4109,
- 52.52188
- ]
- }
+ 52.52188,
+ ],
+ },
},
{
type: 'Feature',
@@ -728,9 +728,9 @@ const bvgRadar = [
type: 'Point',
coordinates: [
13.40921,
- 52.52268
- ]
- }
+ 52.52268,
+ ],
+ },
},
{
type: 'Feature',
@@ -739,9 +739,9 @@ const bvgRadar = [
type: 'Point',
coordinates: [
13.40738,
- 52.5233
- ]
- }
+ 52.5233,
+ ],
+ },
},
{
type: 'Feature',
@@ -750,12 +750,12 @@ const bvgRadar = [
type: 'Point',
coordinates: [
13.40532,
- 52.52338
- ]
- }
- }
- ]
- }
+ 52.52338,
+ ],
+ },
+ },
+ ],
+ },
},
{
direction: 'S+U Hermannstr. (Berlin)',
@@ -772,7 +772,7 @@ const bvgRadar = [
location: {
type: 'location',
latitude: 52.52096,
- longitude: 13.412652
+ longitude: 13.412652,
},
nextStopovers: [
{
@@ -784,7 +784,7 @@ const bvgRadar = [
type: 'location',
id: '900085104',
latitude: 52.574536,
- longitude: 13.347534
+ longitude: 13.347534,
},
products: {
suburban: false,
@@ -793,8 +793,8 @@ const bvgRadar = [
bus: true,
ferry: false,
express: false,
- regional: false
- }
+ regional: false,
+ },
},
arrival: null,
plannedArrival: null,
@@ -818,7 +818,7 @@ const bvgRadar = [
type: 'location',
id: '900100705',
latitude: 52.521616,
- longitude: 13.412121
+ longitude: 13.412121,
},
products: {
suburban: false,
@@ -827,8 +827,8 @@ const bvgRadar = [
bus: false,
ferry: false,
express: false,
- regional: false
- }
+ regional: false,
+ },
},
arrival: '2019-08-19T20:33:00+02:00',
plannedArrival: '2019-08-19T20:33:00+02:00',
@@ -852,7 +852,7 @@ const bvgRadar = [
type: 'location',
id: '900100004',
latitude: 52.515503,
- longitude: 13.418027
+ longitude: 13.418027,
},
products: {
suburban: true,
@@ -861,8 +861,8 @@ const bvgRadar = [
bus: true,
ferry: false,
express: false,
- regional: false
- }
+ regional: false,
+ },
},
arrival: '2019-08-19T20:35:00+02:00',
plannedArrival: '2019-08-19T20:35:00+02:00',
@@ -886,7 +886,7 @@ const bvgRadar = [
type: 'location',
id: '900079221',
latitude: 52.467177,
- longitude: 13.4317
+ longitude: 13.4317,
},
products: {
suburban: true,
@@ -895,8 +895,8 @@ const bvgRadar = [
bus: true,
ferry: false,
express: false,
- regional: false
- }
+ regional: false,
+ },
},
arrival: '2019-08-19T20:47:00+02:00',
plannedArrival: '2019-08-19T20:47:00+02:00',
@@ -910,7 +910,7 @@ const bvgRadar = [
departurePlatform: null,
plannedDeparturePlatform: null,
departurePrognosisType: null,
- }
+ },
],
frames: [
{
@@ -922,7 +922,7 @@ const bvgRadar = [
type: 'location',
id: '900100705',
latitude: 52.521616,
- longitude: 13.412121
+ longitude: 13.412121,
},
products: {
suburban: false,
@@ -931,8 +931,8 @@ const bvgRadar = [
bus: false,
ferry: false,
express: false,
- regional: false
- }
+ regional: false,
+ },
},
destination: {
type: 'stop',
@@ -942,7 +942,7 @@ const bvgRadar = [
type: 'location',
id: '900100004',
latitude: 52.515503,
- longitude: 13.418027
+ longitude: 13.418027,
},
products: {
suburban: true,
@@ -951,10 +951,10 @@ const bvgRadar = [
bus: true,
ferry: false,
express: false,
- regional: false
- }
+ regional: false,
+ },
},
- t: 0
+ t: 0,
},
{
origin: {
@@ -965,7 +965,7 @@ const bvgRadar = [
type: 'location',
id: '900100705',
latitude: 52.521616,
- longitude: 13.412121
+ longitude: 13.412121,
},
products: {
suburban: false,
@@ -974,8 +974,8 @@ const bvgRadar = [
bus: false,
ferry: false,
express: false,
- regional: false
- }
+ regional: false,
+ },
},
destination: {
type: 'stop',
@@ -985,7 +985,7 @@ const bvgRadar = [
type: 'location',
id: '900100004',
latitude: 52.515503,
- longitude: 13.418027
+ longitude: 13.418027,
},
products: {
suburban: true,
@@ -994,10 +994,10 @@ const bvgRadar = [
bus: true,
ferry: false,
express: false,
- regional: false
- }
+ regional: false,
+ },
},
- t: 10000
+ t: 10000,
},
{
origin: {
@@ -1008,7 +1008,7 @@ const bvgRadar = [
type: 'location',
id: '900100705',
latitude: 52.521616,
- longitude: 13.412121
+ longitude: 13.412121,
},
products: {
suburban: false,
@@ -1017,8 +1017,8 @@ const bvgRadar = [
bus: false,
ferry: false,
express: false,
- regional: false
- }
+ regional: false,
+ },
},
destination: {
type: 'stop',
@@ -1028,7 +1028,7 @@ const bvgRadar = [
type: 'location',
id: '900100004',
latitude: 52.515503,
- longitude: 13.418027
+ longitude: 13.418027,
},
products: {
suburban: true,
@@ -1037,10 +1037,10 @@ const bvgRadar = [
bus: true,
ferry: false,
express: false,
- regional: false
- }
+ regional: false,
+ },
},
- t: 20000
+ t: 20000,
},
{
origin: {
@@ -1051,7 +1051,7 @@ const bvgRadar = [
type: 'location',
id: '900100705',
latitude: 52.521616,
- longitude: 13.412121
+ longitude: 13.412121,
},
products: {
suburban: false,
@@ -1060,8 +1060,8 @@ const bvgRadar = [
bus: false,
ferry: false,
express: false,
- regional: false
- }
+ regional: false,
+ },
},
destination: {
type: 'stop',
@@ -1071,7 +1071,7 @@ const bvgRadar = [
type: 'location',
id: '900100004',
latitude: 52.515503,
- longitude: 13.418027
+ longitude: 13.418027,
},
products: {
suburban: true,
@@ -1080,11 +1080,11 @@ const bvgRadar = [
bus: true,
ferry: false,
express: false,
- regional: false
- }
+ regional: false,
+ },
},
- t: 30000
- }
+ t: 30000,
+ },
],
polyline: {
type: 'FeatureCollection',
@@ -1096,9 +1096,9 @@ const bvgRadar = [
type: 'Point',
coordinates: [
13.41265,
- 52.52096
- ]
- }
+ 52.52096,
+ ],
+ },
},
{
type: 'Feature',
@@ -1107,9 +1107,9 @@ const bvgRadar = [
type: 'Point',
coordinates: [
13.41286,
- 52.5208
- ]
- }
+ 52.5208,
+ ],
+ },
},
{
type: 'Feature',
@@ -1118,9 +1118,9 @@ const bvgRadar = [
type: 'Point',
coordinates: [
13.41352,
- 52.52026
- ]
- }
+ 52.52026,
+ ],
+ },
},
{
type: 'Feature',
@@ -1129,12 +1129,12 @@ const bvgRadar = [
type: 'Point',
coordinates: [
13.41423,
- 52.51976
- ]
- }
- }
- ]
- }
+ 52.51976,
+ ],
+ },
+ },
+ ],
+ },
},
{
direction: 'S+U Alexanderplatz',
@@ -1151,7 +1151,7 @@ const bvgRadar = [
location: {
type: 'location',
latitude: 52.522182,
- longitude: 13.415394
+ longitude: 13.415394,
},
nextStopovers: [
{
@@ -1163,7 +1163,7 @@ const bvgRadar = [
type: 'location',
id: '900175004',
latitude: 52.521436,
- longitude: 13.588759
+ longitude: 13.588759,
},
products: {
suburban: false,
@@ -1172,8 +1172,8 @@ const bvgRadar = [
bus: true,
ferry: false,
express: false,
- regional: false
- }
+ regional: false,
+ },
},
arrival: null,
plannedArrival: null,
@@ -1197,7 +1197,7 @@ const bvgRadar = [
type: 'location',
id: '900100017',
latitude: 52.520313,
- longitude: 13.421893
+ longitude: 13.421893,
},
products: {
suburban: false,
@@ -1206,8 +1206,8 @@ const bvgRadar = [
bus: true,
ferry: false,
express: false,
- regional: false
- }
+ regional: false,
+ },
},
arrival: '2019-08-19T20:31:00+02:00',
plannedArrival: '2019-08-19T20:32:00+02:00',
@@ -1231,7 +1231,7 @@ const bvgRadar = [
type: 'location',
id: '900100704',
latitude: 52.521607,
- longitude: 13.41311
+ longitude: 13.41311,
},
products: {
suburban: false,
@@ -1240,8 +1240,8 @@ const bvgRadar = [
bus: false,
ferry: false,
express: false,
- regional: false
- }
+ regional: false,
+ },
},
arrival: '2019-08-19T20:34:00+02:00',
plannedArrival: '2019-08-19T20:34:00+02:00',
@@ -1265,7 +1265,7 @@ const bvgRadar = [
type: 'location',
id: '900100704',
latitude: 52.521607,
- longitude: 13.41311
+ longitude: 13.41311,
},
products: {
suburban: false,
@@ -1274,8 +1274,8 @@ const bvgRadar = [
bus: false,
ferry: false,
express: false,
- regional: false
- }
+ regional: false,
+ },
},
arrival: '2019-08-19T20:34:00+02:00',
plannedArrival: '2019-08-19T20:34:00+02:00',
@@ -1289,7 +1289,7 @@ const bvgRadar = [
departurePlatform: null,
plannedDeparturePlatform: null,
departurePrognosisType: null,
- }
+ },
],
frames: [
{
@@ -1301,7 +1301,7 @@ const bvgRadar = [
type: 'location',
id: '900100017',
latitude: 52.520313,
- longitude: 13.421893
+ longitude: 13.421893,
},
products: {
suburban: false,
@@ -1310,8 +1310,8 @@ const bvgRadar = [
bus: true,
ferry: false,
express: false,
- regional: false
- }
+ regional: false,
+ },
},
destination: {
type: 'stop',
@@ -1321,7 +1321,7 @@ const bvgRadar = [
type: 'location',
id: '900100704',
latitude: 52.521607,
- longitude: 13.41311
+ longitude: 13.41311,
},
products: {
suburban: false,
@@ -1330,10 +1330,10 @@ const bvgRadar = [
bus: false,
ferry: false,
express: false,
- regional: false
- }
+ regional: false,
+ },
},
- t: 0
+ t: 0,
},
{
origin: {
@@ -1344,7 +1344,7 @@ const bvgRadar = [
type: 'location',
id: '900100017',
latitude: 52.520313,
- longitude: 13.421893
+ longitude: 13.421893,
},
products: {
suburban: false,
@@ -1353,8 +1353,8 @@ const bvgRadar = [
bus: true,
ferry: false,
express: false,
- regional: false
- }
+ regional: false,
+ },
},
destination: {
type: 'stop',
@@ -1364,7 +1364,7 @@ const bvgRadar = [
type: 'location',
id: '900100704',
latitude: 52.521607,
- longitude: 13.41311
+ longitude: 13.41311,
},
products: {
suburban: false,
@@ -1373,10 +1373,10 @@ const bvgRadar = [
bus: false,
ferry: false,
express: false,
- regional: false
- }
+ regional: false,
+ },
},
- t: 10000
+ t: 10000,
},
{
origin: {
@@ -1387,7 +1387,7 @@ const bvgRadar = [
type: 'location',
id: '900100017',
latitude: 52.520313,
- longitude: 13.421893
+ longitude: 13.421893,
},
products: {
suburban: false,
@@ -1396,8 +1396,8 @@ const bvgRadar = [
bus: true,
ferry: false,
express: false,
- regional: false
- }
+ regional: false,
+ },
},
destination: {
type: 'stop',
@@ -1407,7 +1407,7 @@ const bvgRadar = [
type: 'location',
id: '900100704',
latitude: 52.521607,
- longitude: 13.41311
+ longitude: 13.41311,
},
products: {
suburban: false,
@@ -1416,10 +1416,10 @@ const bvgRadar = [
bus: false,
ferry: false,
express: false,
- regional: false
- }
+ regional: false,
+ },
},
- t: 20000
+ t: 20000,
},
{
origin: {
@@ -1430,7 +1430,7 @@ const bvgRadar = [
type: 'location',
id: '900100017',
latitude: 52.520313,
- longitude: 13.421893
+ longitude: 13.421893,
},
products: {
suburban: false,
@@ -1439,8 +1439,8 @@ const bvgRadar = [
bus: true,
ferry: false,
express: false,
- regional: false
- }
+ regional: false,
+ },
},
destination: {
type: 'stop',
@@ -1450,7 +1450,7 @@ const bvgRadar = [
type: 'location',
id: '900100704',
latitude: 52.521607,
- longitude: 13.41311
+ longitude: 13.41311,
},
products: {
suburban: false,
@@ -1459,11 +1459,11 @@ const bvgRadar = [
bus: false,
ferry: false,
express: false,
- regional: false
- }
+ regional: false,
+ },
},
- t: 30000
- }
+ t: 30000,
+ },
],
polyline: {
type: 'FeatureCollection',
@@ -1475,9 +1475,9 @@ const bvgRadar = [
type: 'Point',
coordinates: [
13.41539,
- 52.52218
- ]
- }
+ 52.52218,
+ ],
+ },
},
{
type: 'Feature',
@@ -1486,9 +1486,9 @@ const bvgRadar = [
type: 'Point',
coordinates: [
13.41487,
- 52.52201
- ]
- }
+ 52.52201,
+ ],
+ },
},
{
type: 'Feature',
@@ -1497,9 +1497,9 @@ const bvgRadar = [
type: 'Point',
coordinates: [
13.41439,
- 52.5218
- ]
- }
+ 52.5218,
+ ],
+ },
},
{
type: 'Feature',
@@ -1508,12 +1508,12 @@ const bvgRadar = [
type: 'Point',
coordinates: [
13.41389,
- 52.52159
- ]
- }
- }
- ]
- }
+ 52.52159,
+ ],
+ },
+ },
+ ],
+ },
},
{
direction: 'S+U Pankow (Berlin)',
@@ -1530,7 +1530,7 @@ const bvgRadar = [
location: {
type: 'location',
latitude: 52.520043,
- longitude: 13.413506
+ longitude: 13.413506,
},
nextStopovers: [
{
@@ -1542,7 +1542,7 @@ const bvgRadar = [
type: 'location',
id: '900026201',
latitude: 52.509795,
- longitude: 13.272977
+ longitude: 13.272977,
},
products: {
suburban: false,
@@ -1551,8 +1551,8 @@ const bvgRadar = [
bus: true,
ferry: false,
express: false,
- regional: false
- }
+ regional: false,
+ },
},
arrival: null,
plannedArrival: null,
@@ -1576,7 +1576,7 @@ const bvgRadar = [
type: 'location',
id: '900100015',
latitude: 52.517229,
- longitude: 13.412454
+ longitude: 13.412454,
},
products: {
suburban: false,
@@ -1585,8 +1585,8 @@ const bvgRadar = [
bus: false,
ferry: false,
express: false,
- regional: false
- }
+ regional: false,
+ },
},
arrival: '2019-08-19T20:32:00+02:00',
plannedArrival: '2019-08-19T20:31:00+02:00',
@@ -1610,7 +1610,7 @@ const bvgRadar = [
type: 'location',
id: '900100703',
latitude: 52.522075,
- longitude: 13.413596
+ longitude: 13.413596,
},
products: {
suburban: false,
@@ -1619,8 +1619,8 @@ const bvgRadar = [
bus: false,
ferry: false,
express: false,
- regional: false
- }
+ regional: false,
+ },
},
arrival: '2019-08-19T20:34:00+02:00',
plannedArrival: '2019-08-19T20:33:00+02:00',
@@ -1644,7 +1644,7 @@ const bvgRadar = [
type: 'location',
id: '900130002',
latitude: 52.567281,
- longitude: 13.412283
+ longitude: 13.412283,
},
products: {
suburban: true,
@@ -1653,8 +1653,8 @@ const bvgRadar = [
bus: true,
ferry: false,
express: false,
- regional: false
- }
+ regional: false,
+ },
},
arrival: '2019-08-19T20:46:00+02:00',
plannedArrival: '2019-08-19T20:45:00+02:00',
@@ -1668,7 +1668,7 @@ const bvgRadar = [
departurePlatform: null,
plannedDeparturePlatform: null,
departurePrognosisType: null,
- }
+ },
],
frames: [
{
@@ -1680,7 +1680,7 @@ const bvgRadar = [
type: 'location',
id: '900100015',
latitude: 52.517229,
- longitude: 13.412454
+ longitude: 13.412454,
},
products: {
suburban: false,
@@ -1689,8 +1689,8 @@ const bvgRadar = [
bus: false,
ferry: false,
express: false,
- regional: false
- }
+ regional: false,
+ },
},
destination: {
type: 'stop',
@@ -1700,7 +1700,7 @@ const bvgRadar = [
type: 'location',
id: '900100703',
latitude: 52.522075,
- longitude: 13.413596
+ longitude: 13.413596,
},
products: {
suburban: false,
@@ -1709,10 +1709,10 @@ const bvgRadar = [
bus: false,
ferry: false,
express: false,
- regional: false
- }
+ regional: false,
+ },
},
- t: 0
+ t: 0,
},
{
origin: {
@@ -1723,7 +1723,7 @@ const bvgRadar = [
type: 'location',
id: '900100015',
latitude: 52.517229,
- longitude: 13.412454
+ longitude: 13.412454,
},
products: {
suburban: false,
@@ -1732,8 +1732,8 @@ const bvgRadar = [
bus: false,
ferry: false,
express: false,
- regional: false
- }
+ regional: false,
+ },
},
destination: {
type: 'stop',
@@ -1743,7 +1743,7 @@ const bvgRadar = [
type: 'location',
id: '900100703',
latitude: 52.522075,
- longitude: 13.413596
+ longitude: 13.413596,
},
products: {
suburban: false,
@@ -1752,10 +1752,10 @@ const bvgRadar = [
bus: false,
ferry: false,
express: false,
- regional: false
- }
+ regional: false,
+ },
},
- t: 10000
+ t: 10000,
},
{
origin: {
@@ -1766,7 +1766,7 @@ const bvgRadar = [
type: 'location',
id: '900100015',
latitude: 52.517229,
- longitude: 13.412454
+ longitude: 13.412454,
},
products: {
suburban: false,
@@ -1775,8 +1775,8 @@ const bvgRadar = [
bus: false,
ferry: false,
express: false,
- regional: false
- }
+ regional: false,
+ },
},
destination: {
type: 'stop',
@@ -1786,7 +1786,7 @@ const bvgRadar = [
type: 'location',
id: '900100703',
latitude: 52.522075,
- longitude: 13.413596
+ longitude: 13.413596,
},
products: {
suburban: false,
@@ -1795,10 +1795,10 @@ const bvgRadar = [
bus: false,
ferry: false,
express: false,
- regional: false
- }
+ regional: false,
+ },
},
- t: 20000
+ t: 20000,
},
{
origin: {
@@ -1809,7 +1809,7 @@ const bvgRadar = [
type: 'location',
id: '900100015',
latitude: 52.517229,
- longitude: 13.412454
+ longitude: 13.412454,
},
products: {
suburban: false,
@@ -1818,8 +1818,8 @@ const bvgRadar = [
bus: false,
ferry: false,
express: false,
- regional: false
- }
+ regional: false,
+ },
},
destination: {
type: 'stop',
@@ -1829,7 +1829,7 @@ const bvgRadar = [
type: 'location',
id: '900100703',
latitude: 52.522075,
- longitude: 13.413596
+ longitude: 13.413596,
},
products: {
suburban: false,
@@ -1838,11 +1838,11 @@ const bvgRadar = [
bus: false,
ferry: false,
express: false,
- regional: false
- }
+ regional: false,
+ },
},
- t: 30000
- }
+ t: 30000,
+ },
],
polyline: {
type: 'FeatureCollection',
@@ -1854,9 +1854,9 @@ const bvgRadar = [
type: 'Point',
coordinates: [
13.41351,
- 52.52005
- ]
- }
+ 52.52005,
+ ],
+ },
},
{
type: 'Feature',
@@ -1865,9 +1865,9 @@ const bvgRadar = [
type: 'Point',
coordinates: [
13.41429,
- 52.52035
- ]
- }
+ 52.52035,
+ ],
+ },
},
{
type: 'Feature',
@@ -1876,9 +1876,9 @@ const bvgRadar = [
type: 'Point',
coordinates: [
13.41473,
- 52.52084
- ]
- }
+ 52.52084,
+ ],
+ },
},
{
type: 'Feature',
@@ -1887,12 +1887,12 @@ const bvgRadar = [
type: 'Point',
coordinates: [
13.41453,
- 52.52139
- ]
- }
- }
- ]
- }
+ 52.52139,
+ ],
+ },
+ },
+ ],
+ },
},
{
direction: 'Hellersdorf, Riesaer Str.',
@@ -1909,7 +1909,7 @@ const bvgRadar = [
location: {
type: 'location',
latitude: 52.522353,
- longitude: 13.415097
+ longitude: 13.415097,
},
nextStopovers: [
{
@@ -1921,7 +1921,7 @@ const bvgRadar = [
type: 'location',
id: '900100002',
latitude: 52.522605,
- longitude: 13.402359
+ longitude: 13.402359,
},
products: {
suburban: true,
@@ -1930,8 +1930,8 @@ const bvgRadar = [
bus: true,
ferry: false,
express: false,
- regional: false
- }
+ regional: false,
+ },
},
arrival: null,
plannedArrival: null,
@@ -1955,7 +1955,7 @@ const bvgRadar = [
type: 'location',
id: '900100005',
latitude: 52.522389,
- longitude: 13.414495
+ longitude: 13.414495,
},
products: {
suburban: false,
@@ -1964,8 +1964,8 @@ const bvgRadar = [
bus: false,
ferry: false,
express: false,
- regional: false
- }
+ regional: false,
+ },
},
arrival: '2019-08-19T20:33:00+02:00',
plannedArrival: '2019-08-19T20:30:00+02:00',
@@ -1989,7 +1989,7 @@ const bvgRadar = [
type: 'location',
id: '900100040',
latitude: 52.525185,
- longitude: 13.419942
+ longitude: 13.419942,
},
products: {
suburban: false,
@@ -1998,8 +1998,8 @@ const bvgRadar = [
bus: true,
ferry: false,
express: false,
- regional: false
- }
+ regional: false,
+ },
},
arrival: '2019-08-19T20:36:00+02:00',
plannedArrival: '2019-08-19T20:33:00+02:00',
@@ -2023,7 +2023,7 @@ const bvgRadar = [
type: 'location',
id: '900175013',
latitude: 52.529401,
- longitude: 13.624186
+ longitude: 13.624186,
},
products: {
suburban: false,
@@ -2032,8 +2032,8 @@ const bvgRadar = [
bus: true,
ferry: false,
express: false,
- regional: false
- }
+ regional: false,
+ },
},
arrival: '2019-08-19T21:22:00+02:00',
plannedArrival: '2019-08-19T21:19:00+02:00',
@@ -2047,7 +2047,7 @@ const bvgRadar = [
departurePlatform: null,
plannedDeparturePlatform: null,
departurePrognosisType: null,
- }
+ },
],
frames: [
{
@@ -2059,7 +2059,7 @@ const bvgRadar = [
type: 'location',
id: '900100005',
latitude: 52.522389,
- longitude: 13.414495
+ longitude: 13.414495,
},
products: {
suburban: false,
@@ -2068,8 +2068,8 @@ const bvgRadar = [
bus: false,
ferry: false,
express: false,
- regional: false
- }
+ regional: false,
+ },
},
destination: {
type: 'stop',
@@ -2079,7 +2079,7 @@ const bvgRadar = [
type: 'location',
id: '900100040',
latitude: 52.525185,
- longitude: 13.419942
+ longitude: 13.419942,
},
products: {
suburban: false,
@@ -2088,10 +2088,10 @@ const bvgRadar = [
bus: true,
ferry: false,
express: false,
- regional: false
- }
+ regional: false,
+ },
},
- t: 0
+ t: 0,
},
{
origin: {
@@ -2102,7 +2102,7 @@ const bvgRadar = [
type: 'location',
id: '900100005',
latitude: 52.522389,
- longitude: 13.414495
+ longitude: 13.414495,
},
products: {
suburban: false,
@@ -2111,8 +2111,8 @@ const bvgRadar = [
bus: false,
ferry: false,
express: false,
- regional: false
- }
+ regional: false,
+ },
},
destination: {
type: 'stop',
@@ -2122,7 +2122,7 @@ const bvgRadar = [
type: 'location',
id: '900100040',
latitude: 52.525185,
- longitude: 13.419942
+ longitude: 13.419942,
},
products: {
suburban: false,
@@ -2131,10 +2131,10 @@ const bvgRadar = [
bus: true,
ferry: false,
express: false,
- regional: false
- }
+ regional: false,
+ },
},
- t: 10000
+ t: 10000,
},
{
origin: {
@@ -2145,7 +2145,7 @@ const bvgRadar = [
type: 'location',
id: '900100005',
latitude: 52.522389,
- longitude: 13.414495
+ longitude: 13.414495,
},
products: {
suburban: false,
@@ -2154,8 +2154,8 @@ const bvgRadar = [
bus: false,
ferry: false,
express: false,
- regional: false
- }
+ regional: false,
+ },
},
destination: {
type: 'stop',
@@ -2165,7 +2165,7 @@ const bvgRadar = [
type: 'location',
id: '900100040',
latitude: 52.525185,
- longitude: 13.419942
+ longitude: 13.419942,
},
products: {
suburban: false,
@@ -2174,10 +2174,10 @@ const bvgRadar = [
bus: true,
ferry: false,
express: false,
- regional: false
- }
+ regional: false,
+ },
},
- t: 20000
+ t: 20000,
},
{
origin: {
@@ -2188,7 +2188,7 @@ const bvgRadar = [
type: 'location',
id: '900100005',
latitude: 52.522389,
- longitude: 13.414495
+ longitude: 13.414495,
},
products: {
suburban: false,
@@ -2197,8 +2197,8 @@ const bvgRadar = [
bus: false,
ferry: false,
express: false,
- regional: false
- }
+ regional: false,
+ },
},
destination: {
type: 'stop',
@@ -2208,7 +2208,7 @@ const bvgRadar = [
type: 'location',
id: '900100040',
latitude: 52.525185,
- longitude: 13.419942
+ longitude: 13.419942,
},
products: {
suburban: false,
@@ -2217,11 +2217,11 @@ const bvgRadar = [
bus: true,
ferry: false,
express: false,
- regional: false
- }
+ regional: false,
+ },
},
- t: 30000
- }
+ t: 30000,
+ },
],
polyline: {
type: 'FeatureCollection',
@@ -2233,9 +2233,9 @@ const bvgRadar = [
type: 'Point',
coordinates: [
13.4151,
- 52.52236
- ]
- }
+ 52.52236,
+ ],
+ },
},
{
type: 'Feature',
@@ -2244,9 +2244,9 @@ const bvgRadar = [
type: 'Point',
coordinates: [
13.41513,
- 52.52238
- ]
- }
+ 52.52238,
+ ],
+ },
},
{
type: 'Feature',
@@ -2255,9 +2255,9 @@ const bvgRadar = [
type: 'Point',
coordinates: [
13.41541,
- 52.52263
- ]
- }
+ 52.52263,
+ ],
+ },
},
{
type: 'Feature',
@@ -2266,12 +2266,12 @@ const bvgRadar = [
type: 'Point',
coordinates: [
13.41569,
- 52.52286
- ]
- }
- }
- ]
- }
+ 52.52286,
+ ],
+ },
+ },
+ ],
+ },
},
{
direction: 'S Hackescher Markt',
@@ -2288,7 +2288,7 @@ const bvgRadar = [
location: {
type: 'location',
latitude: 52.521283,
- longitude: 13.411034
+ longitude: 13.411034,
},
nextStopovers: [
{
@@ -2300,7 +2300,7 @@ const bvgRadar = [
type: 'location',
id: '900175013',
latitude: 52.529401,
- longitude: 13.624186
+ longitude: 13.624186,
},
products: {
suburban: false,
@@ -2309,8 +2309,8 @@ const bvgRadar = [
bus: true,
ferry: false,
express: false,
- regional: false
- }
+ regional: false,
+ },
},
arrival: null,
plannedArrival: null,
@@ -2334,7 +2334,7 @@ const bvgRadar = [
type: 'location',
id: '900100026',
latitude: 52.521059,
- longitude: 13.41125
+ longitude: 13.41125,
},
products: {
suburban: false,
@@ -2343,8 +2343,8 @@ const bvgRadar = [
bus: false,
ferry: false,
express: false,
- regional: false
- }
+ regional: false,
+ },
},
arrival: '2019-08-19T20:33:00+02:00',
plannedArrival: '2019-08-19T20:30:00+02:00',
@@ -2368,7 +2368,7 @@ const bvgRadar = [
type: 'location',
id: '900100515',
latitude: 52.520025,
- longitude: 13.404822
+ longitude: 13.404822,
},
products: {
suburban: false,
@@ -2377,8 +2377,8 @@ const bvgRadar = [
bus: true,
ferry: false,
express: false,
- regional: false
- }
+ regional: false,
+ },
},
arrival: '2019-08-19T20:35:00+02:00',
plannedArrival: '2019-08-19T20:32:00+02:00',
@@ -2402,7 +2402,7 @@ const bvgRadar = [
type: 'location',
id: '900100002',
latitude: 52.522605,
- longitude: 13.402359
+ longitude: 13.402359,
},
products: {
suburban: true,
@@ -2411,8 +2411,8 @@ const bvgRadar = [
bus: true,
ferry: false,
express: false,
- regional: false
- }
+ regional: false,
+ },
},
arrival: '2019-08-19T20:36:00+02:00',
plannedArrival: '2019-08-19T20:33:00+02:00',
@@ -2426,7 +2426,7 @@ const bvgRadar = [
departurePlatform: null,
plannedDeparturePlatform: null,
departurePrognosisType: null,
- }
+ },
],
frames: [
{
@@ -2438,7 +2438,7 @@ const bvgRadar = [
type: 'location',
id: '900100026',
latitude: 52.521059,
- longitude: 13.41125
+ longitude: 13.41125,
},
products: {
suburban: false,
@@ -2447,8 +2447,8 @@ const bvgRadar = [
bus: false,
ferry: false,
express: false,
- regional: false
- }
+ regional: false,
+ },
},
destination: {
type: 'stop',
@@ -2458,7 +2458,7 @@ const bvgRadar = [
type: 'location',
id: '900100515',
latitude: 52.520025,
- longitude: 13.404822
+ longitude: 13.404822,
},
products: {
suburban: false,
@@ -2467,10 +2467,10 @@ const bvgRadar = [
bus: true,
ferry: false,
express: false,
- regional: false
- }
+ regional: false,
+ },
},
- t: 0
+ t: 0,
},
{
origin: {
@@ -2481,7 +2481,7 @@ const bvgRadar = [
type: 'location',
id: '900100026',
latitude: 52.521059,
- longitude: 13.41125
+ longitude: 13.41125,
},
products: {
suburban: false,
@@ -2490,8 +2490,8 @@ const bvgRadar = [
bus: false,
ferry: false,
express: false,
- regional: false
- }
+ regional: false,
+ },
},
destination: {
type: 'stop',
@@ -2501,7 +2501,7 @@ const bvgRadar = [
type: 'location',
id: '900100515',
latitude: 52.520025,
- longitude: 13.404822
+ longitude: 13.404822,
},
products: {
suburban: false,
@@ -2510,10 +2510,10 @@ const bvgRadar = [
bus: true,
ferry: false,
express: false,
- regional: false
- }
+ regional: false,
+ },
},
- t: 10000
+ t: 10000,
},
{
origin: {
@@ -2524,7 +2524,7 @@ const bvgRadar = [
type: 'location',
id: '900100026',
latitude: 52.521059,
- longitude: 13.41125
+ longitude: 13.41125,
},
products: {
suburban: false,
@@ -2533,8 +2533,8 @@ const bvgRadar = [
bus: false,
ferry: false,
express: false,
- regional: false
- }
+ regional: false,
+ },
},
destination: {
type: 'stop',
@@ -2544,7 +2544,7 @@ const bvgRadar = [
type: 'location',
id: '900100515',
latitude: 52.520025,
- longitude: 13.404822
+ longitude: 13.404822,
},
products: {
suburban: false,
@@ -2553,10 +2553,10 @@ const bvgRadar = [
bus: true,
ferry: false,
express: false,
- regional: false
- }
+ regional: false,
+ },
},
- t: 20000
+ t: 20000,
},
{
origin: {
@@ -2567,7 +2567,7 @@ const bvgRadar = [
type: 'location',
id: '900100026',
latitude: 52.521059,
- longitude: 13.41125
+ longitude: 13.41125,
},
products: {
suburban: false,
@@ -2576,8 +2576,8 @@ const bvgRadar = [
bus: false,
ferry: false,
express: false,
- regional: false
- }
+ regional: false,
+ },
},
destination: {
type: 'stop',
@@ -2587,7 +2587,7 @@ const bvgRadar = [
type: 'location',
id: '900100515',
latitude: 52.520025,
- longitude: 13.404822
+ longitude: 13.404822,
},
products: {
suburban: false,
@@ -2596,11 +2596,11 @@ const bvgRadar = [
bus: true,
ferry: false,
express: false,
- regional: false
- }
+ regional: false,
+ },
},
- t: 30000
- }
+ t: 30000,
+ },
],
polyline: {
type: 'FeatureCollection',
@@ -2612,9 +2612,9 @@ const bvgRadar = [
type: 'Point',
coordinates: [
13.41103,
- 52.52129
- ]
- }
+ 52.52129,
+ ],
+ },
},
{
type: 'Feature',
@@ -2623,9 +2623,9 @@ const bvgRadar = [
type: 'Point',
coordinates: [
13.41057,
- 52.52157
- ]
- }
+ 52.52157,
+ ],
+ },
},
{
type: 'Feature',
@@ -2634,9 +2634,9 @@ const bvgRadar = [
type: 'Point',
coordinates: [
13.41001,
- 52.52191
- ]
- }
+ 52.52191,
+ ],
+ },
},
{
type: 'Feature',
@@ -2645,12 +2645,12 @@ const bvgRadar = [
type: 'Point',
coordinates: [
13.40943,
- 52.52221
- ]
- }
- }
- ]
- }
+ 52.52221,
+ ],
+ },
+ },
+ ],
+ },
},
{
direction: 'S+U Hauptbahnhof',
@@ -2667,7 +2667,7 @@ const bvgRadar = [
location: {
type: 'location',
latitude: 52.52389,
- longitude: 13.416814
+ longitude: 13.416814,
},
nextStopovers: [
{
@@ -2679,7 +2679,7 @@ const bvgRadar = [
type: 'location',
id: '900151003',
latitude: 52.57236,
- longitude: 13.495164
+ longitude: 13.495164,
},
products: {
suburban: false,
@@ -2688,8 +2688,8 @@ const bvgRadar = [
bus: false,
ferry: false,
express: false,
- regional: false
- }
+ regional: false,
+ },
},
arrival: null,
plannedArrival: null,
@@ -2713,7 +2713,7 @@ const bvgRadar = [
type: 'location',
id: '900100040',
latitude: 52.525185,
- longitude: 13.419942
+ longitude: 13.419942,
},
products: {
suburban: false,
@@ -2722,8 +2722,8 @@ const bvgRadar = [
bus: true,
ferry: false,
express: false,
- regional: false
- }
+ regional: false,
+ },
},
arrival: '2019-08-19T20:32:00+02:00',
plannedArrival: '2019-08-19T20:30:00+02:00',
@@ -2747,7 +2747,7 @@ const bvgRadar = [
type: 'location',
id: '900100005',
latitude: 52.522389,
- longitude: 13.414495
+ longitude: 13.414495,
},
products: {
suburban: false,
@@ -2756,8 +2756,8 @@ const bvgRadar = [
bus: false,
ferry: false,
express: false,
- regional: false
- }
+ regional: false,
+ },
},
arrival: '2019-08-19T20:34:00+02:00',
plannedArrival: '2019-08-19T20:33:00+02:00',
@@ -2781,7 +2781,7 @@ const bvgRadar = [
type: 'location',
id: '900003259',
latitude: 52.523315,
- longitude: 13.36207
+ longitude: 13.36207,
},
products: {
suburban: false,
@@ -2790,8 +2790,8 @@ const bvgRadar = [
bus: false,
ferry: false,
express: false,
- regional: false
- }
+ regional: false,
+ },
},
arrival: '2019-08-19T20:55:00+02:00',
plannedArrival: '2019-08-19T20:54:00+02:00',
@@ -2805,7 +2805,7 @@ const bvgRadar = [
departurePlatform: null,
plannedDeparturePlatform: null,
departurePrognosisType: null,
- }
+ },
],
frames: [
{
@@ -2817,7 +2817,7 @@ const bvgRadar = [
type: 'location',
id: '900100040',
latitude: 52.525185,
- longitude: 13.419942
+ longitude: 13.419942,
},
products: {
suburban: false,
@@ -2826,8 +2826,8 @@ const bvgRadar = [
bus: true,
ferry: false,
express: false,
- regional: false
- }
+ regional: false,
+ },
},
destination: {
type: 'stop',
@@ -2837,7 +2837,7 @@ const bvgRadar = [
type: 'location',
id: '900100005',
latitude: 52.522389,
- longitude: 13.414495
+ longitude: 13.414495,
},
products: {
suburban: false,
@@ -2846,10 +2846,10 @@ const bvgRadar = [
bus: false,
ferry: false,
express: false,
- regional: false
- }
+ regional: false,
+ },
},
- t: 0
+ t: 0,
},
{
origin: {
@@ -2860,7 +2860,7 @@ const bvgRadar = [
type: 'location',
id: '900100040',
latitude: 52.525185,
- longitude: 13.419942
+ longitude: 13.419942,
},
products: {
suburban: false,
@@ -2869,8 +2869,8 @@ const bvgRadar = [
bus: true,
ferry: false,
express: false,
- regional: false
- }
+ regional: false,
+ },
},
destination: {
type: 'stop',
@@ -2880,7 +2880,7 @@ const bvgRadar = [
type: 'location',
id: '900100005',
latitude: 52.522389,
- longitude: 13.414495
+ longitude: 13.414495,
},
products: {
suburban: false,
@@ -2889,10 +2889,10 @@ const bvgRadar = [
bus: false,
ferry: false,
express: false,
- regional: false
- }
+ regional: false,
+ },
},
- t: 10000
+ t: 10000,
},
{
origin: {
@@ -2903,7 +2903,7 @@ const bvgRadar = [
type: 'location',
id: '900100040',
latitude: 52.525185,
- longitude: 13.419942
+ longitude: 13.419942,
},
products: {
suburban: false,
@@ -2912,8 +2912,8 @@ const bvgRadar = [
bus: true,
ferry: false,
express: false,
- regional: false
- }
+ regional: false,
+ },
},
destination: {
type: 'stop',
@@ -2923,7 +2923,7 @@ const bvgRadar = [
type: 'location',
id: '900100005',
latitude: 52.522389,
- longitude: 13.414495
+ longitude: 13.414495,
},
products: {
suburban: false,
@@ -2932,10 +2932,10 @@ const bvgRadar = [
bus: false,
ferry: false,
express: false,
- regional: false
- }
+ regional: false,
+ },
},
- t: 20000
+ t: 20000,
},
{
origin: {
@@ -2946,7 +2946,7 @@ const bvgRadar = [
type: 'location',
id: '900100040',
latitude: 52.525185,
- longitude: 13.419942
+ longitude: 13.419942,
},
products: {
suburban: false,
@@ -2955,8 +2955,8 @@ const bvgRadar = [
bus: true,
ferry: false,
express: false,
- regional: false
- }
+ regional: false,
+ },
},
destination: {
type: 'stop',
@@ -2966,7 +2966,7 @@ const bvgRadar = [
type: 'location',
id: '900100005',
latitude: 52.522389,
- longitude: 13.414495
+ longitude: 13.414495,
},
products: {
suburban: false,
@@ -2975,11 +2975,11 @@ const bvgRadar = [
bus: false,
ferry: false,
express: false,
- regional: false
- }
+ regional: false,
+ },
},
- t: 30000
- }
+ t: 30000,
+ },
],
polyline: {
type: 'FeatureCollection',
@@ -2991,9 +2991,9 @@ const bvgRadar = [
type: 'Point',
coordinates: [
13.41681,
- 52.52389
- ]
- }
+ 52.52389,
+ ],
+ },
},
{
type: 'Feature',
@@ -3002,9 +3002,9 @@ const bvgRadar = [
type: 'Point',
coordinates: [
13.41628,
- 52.52345
- ]
- }
+ 52.52345,
+ ],
+ },
},
{
type: 'Feature',
@@ -3013,9 +3013,9 @@ const bvgRadar = [
type: 'Point',
coordinates: [
13.41574,
- 52.52301
- ]
- }
+ 52.52301,
+ ],
+ },
},
{
type: 'Feature',
@@ -3024,15 +3024,15 @@ const bvgRadar = [
type: 'Point',
coordinates: [
13.41521,
- 52.52257
- ]
- }
- }
- ]
- }
- }
-]
+ 52.52257,
+ ],
+ },
+ },
+ ],
+ },
+ },
+];
export {
bvgRadar,
-}
+};
diff --git a/test/fixtures/bvg-trip-with-occupancy.js b/test/fixtures/bvg-trip-with-occupancy.js
index 9a833d4c..faeb72a0 100644
--- a/test/fixtures/bvg-trip-with-occupancy.js
+++ b/test/fixtures/bvg-trip-with-occupancy.js
@@ -14,26 +14,26 @@ const bvgTripWithOccupancy = {
operator: {
type: 'operator',
id: 'berliner-verkehrsbetriebe',
- name: 'Berliner Verkehrsbetriebe'
+ name: 'Berliner Verkehrsbetriebe',
},
},
remarks: [
- { type: 'hint', code: 'bf', text: 'barrier-free' },
+ {type: 'hint', code: 'bf', text: 'barrier-free'},
{
type: 'hint',
code: 'text.journeystop.product.or.direction.changes.journey.message',
- text: 'From S+U Wedding (Berlin) as 147 heading towards S Ostbahnhof via S+U Hauptbahnhof'
+ text: 'From S+U Wedding (Berlin) as 147 heading towards S Ostbahnhof via S+U Hauptbahnhof',
},
{
type: 'hint',
code: 'text.journeystop.product.or.direction.changes.journey.message',
- text: 'From S+U Berlin Hauptbahnhof as 147 heading towards S Ostbahnhof via Friedrichstr.'
+ text: 'From S+U Berlin Hauptbahnhof as 147 heading towards S Ostbahnhof via Friedrichstr.',
},
{
type: 'hint',
code: 'text.journeystop.product.or.direction.changes.journey.message',
- text: 'From S+U Friedrichstr. Bhf (Berlin) as 147 heading towards S Ostbahnhof'
- }
+ text: 'From S+U Friedrichstr. Bhf (Berlin) as 147 heading towards S Ostbahnhof',
+ },
],
occupancy: 'medium',
@@ -104,7 +104,7 @@ const bvgTripWithOccupancy = {
type: 'location',
id: '900009102',
latitude: 52.546489,
- longitude: 13.359391
+ longitude: 13.359391,
},
products: {
suburban: false,
@@ -113,8 +113,8 @@ const bvgTripWithOccupancy = {
bus: true,
ferry: false,
express: false,
- regional: false
- }
+ regional: false,
+ },
},
departure: '2021-11-01T07:18:00+01:00',
plannedDeparture: '2021-11-01T07:18:00+01:00',
@@ -131,7 +131,7 @@ const bvgTripWithOccupancy = {
type: 'location',
id: '900120005',
latitude: 52.510335,
- longitude: 13.435089
+ longitude: 13.435089,
},
products: {
suburban: true,
@@ -140,8 +140,8 @@ const bvgTripWithOccupancy = {
bus: true,
ferry: false,
express: true,
- regional: true
- }
+ regional: true,
+ },
},
arrival: '2021-11-01T07:59:00+01:00',
plannedArrival: '2021-11-01T07:59:00+01:00',
@@ -163,7 +163,7 @@ const bvgTripWithOccupancy = {
type: 'location',
id: '900009102',
latitude: 52.546489,
- longitude: 13.359391
+ longitude: 13.359391,
},
products: {
suburban: false,
@@ -172,10 +172,10 @@ const bvgTripWithOccupancy = {
bus: true,
ferry: false,
express: false,
- regional: false
- }
+ regional: false,
+ },
},
- geometry: { type: 'Point', coordinates: [ 13.35954, 52.54606 ] }
+ geometry: {type: 'Point', coordinates: [13.35954, 52.54606]},
},
{
type: 'Feature',
@@ -187,7 +187,7 @@ const bvgTripWithOccupancy = {
type: 'location',
id: '900009151',
latitude: 52.544476,
- longitude: 13.362663
+ longitude: 13.362663,
},
products: {
suburban: false,
@@ -196,10 +196,10 @@ const bvgTripWithOccupancy = {
bus: true,
ferry: false,
express: false,
- regional: false
- }
+ regional: false,
+ },
},
- geometry: { type: 'Point', coordinates: [ 13.36199, 52.54468 ] }
+ geometry: {type: 'Point', coordinates: [13.36199, 52.54468]},
},
{
type: 'Feature',
@@ -211,7 +211,7 @@ const bvgTripWithOccupancy = {
type: 'location',
id: '900009104',
latitude: 52.542732,
- longitude: 13.366061
+ longitude: 13.366061,
},
products: {
suburban: true,
@@ -220,20 +220,20 @@ const bvgTripWithOccupancy = {
bus: true,
ferry: false,
express: false,
- regional: false
- }
+ regional: false,
+ },
},
- geometry: { type: 'Point', coordinates: [ 13.36525, 52.54283 ] }
+ geometry: {type: 'Point', coordinates: [13.36525, 52.54283]},
},
{
type: 'Feature',
properties: {},
- geometry: { type: 'Point', coordinates: [ 13.36811, 52.54121 ] }
+ geometry: {type: 'Point', coordinates: [13.36811, 52.54121]},
},
{
type: 'Feature',
properties: {},
- geometry: { type: 'Point', coordinates: [ 13.36814, 52.54108 ] }
+ geometry: {type: 'Point', coordinates: [13.36814, 52.54108]},
},
{
type: 'Feature',
@@ -245,7 +245,7 @@ const bvgTripWithOccupancy = {
type: 'location',
id: '900008104',
latitude: 52.541195,
- longitude: 13.368713
+ longitude: 13.368713,
},
products: {
suburban: false,
@@ -254,10 +254,10 @@ const bvgTripWithOccupancy = {
bus: true,
ferry: false,
express: false,
- regional: false
- }
+ regional: false,
+ },
},
- geometry: { type: 'Point', coordinates: [ 13.36785, 52.54092 ] }
+ geometry: {type: 'Point', coordinates: [13.36785, 52.54092]},
},
{
type: 'Feature',
@@ -269,7 +269,7 @@ const bvgTripWithOccupancy = {
type: 'location',
id: '900001202',
latitude: 52.538848,
- longitude: 13.363607
+ longitude: 13.363607,
},
products: {
suburban: false,
@@ -278,35 +278,35 @@ const bvgTripWithOccupancy = {
bus: true,
ferry: false,
express: false,
- regional: false
- }
+ regional: false,
+ },
},
- geometry: { type: 'Point', coordinates: [ 13.36308, 52.53868 ] }
+ geometry: {type: 'Point', coordinates: [13.36308, 52.53868]},
},
{
type: 'Feature',
properties: {},
- geometry: { type: 'Point', coordinates: [ 13.36057, 52.53751 ] }
+ geometry: {type: 'Point', coordinates: [13.36057, 52.53751]},
},
{
type: 'Feature',
properties: {},
- geometry: { type: 'Point', coordinates: [ 13.36036, 52.53723 ] }
+ geometry: {type: 'Point', coordinates: [13.36036, 52.53723]},
},
{
type: 'Feature',
properties: {},
- geometry: { type: 'Point', coordinates: [ 13.36077, 52.53685 ] }
+ geometry: {type: 'Point', coordinates: [13.36077, 52.53685]},
},
{
type: 'Feature',
properties: {},
- geometry: { type: 'Point', coordinates: [ 13.36246, 52.5361 ] }
+ geometry: {type: 'Point', coordinates: [13.36246, 52.5361]},
},
{
type: 'Feature',
properties: {},
- geometry: { type: 'Point', coordinates: [ 13.36311, 52.53556 ] }
+ geometry: {type: 'Point', coordinates: [13.36311, 52.53556]},
},
{
type: 'Feature',
@@ -318,7 +318,7 @@ const bvgTripWithOccupancy = {
type: 'location',
id: '900001252',
latitude: 52.536736,
- longitude: 13.361216
+ longitude: 13.361216,
},
products: {
suburban: false,
@@ -327,15 +327,15 @@ const bvgTripWithOccupancy = {
bus: true,
ferry: false,
express: false,
- regional: false
- }
+ regional: false,
+ },
},
- geometry: { type: 'Point', coordinates: [ 13.36167, 52.53653 ] }
+ geometry: {type: 'Point', coordinates: [13.36167, 52.53653]},
},
{
type: 'Feature',
properties: {},
- geometry: { type: 'Point', coordinates: [ 13.36539, 52.53325 ] }
+ geometry: {type: 'Point', coordinates: [13.36539, 52.53325]},
},
{
type: 'Feature',
@@ -347,7 +347,7 @@ const bvgTripWithOccupancy = {
type: 'location',
id: '900001206',
latitude: 52.53332,
- longitude: 13.365512
+ longitude: 13.365512,
},
products: {
suburban: false,
@@ -356,15 +356,15 @@ const bvgTripWithOccupancy = {
bus: true,
ferry: false,
express: false,
- regional: false
- }
+ regional: false,
+ },
},
- geometry: { type: 'Point', coordinates: [ 13.36544, 52.53332 ] }
+ geometry: {type: 'Point', coordinates: [13.36544, 52.53332]},
},
{
type: 'Feature',
properties: {},
- geometry: { type: 'Point', coordinates: [ 13.36603, 52.5326 ] }
+ geometry: {type: 'Point', coordinates: [13.36603, 52.5326]},
},
{
type: 'Feature',
@@ -376,7 +376,7 @@ const bvgTripWithOccupancy = {
type: 'location',
id: '900001203',
latitude: 52.530668,
- longitude: 13.36811
+ longitude: 13.36811,
},
products: {
suburban: false,
@@ -385,55 +385,55 @@ const bvgTripWithOccupancy = {
bus: true,
ferry: false,
express: false,
- regional: false
- }
+ regional: false,
+ },
},
- geometry: { type: 'Point', coordinates: [ 13.36783, 52.5309 ] }
+ geometry: {type: 'Point', coordinates: [13.36783, 52.5309]},
},
{
type: 'Feature',
properties: {},
- geometry: { type: 'Point', coordinates: [ 13.36882, 52.52984 ] }
+ geometry: {type: 'Point', coordinates: [13.36882, 52.52984]},
},
{
type: 'Feature',
properties: {},
- geometry: { type: 'Point', coordinates: [ 13.36937, 52.52903 ] }
+ geometry: {type: 'Point', coordinates: [13.36937, 52.52903]},
},
{
type: 'Feature',
properties: {},
- geometry: { type: 'Point', coordinates: [ 13.36932, 52.5289 ] }
+ geometry: {type: 'Point', coordinates: [13.36932, 52.5289]},
},
{
type: 'Feature',
properties: {},
- geometry: { type: 'Point', coordinates: [ 13.36834, 52.52845 ] }
+ geometry: {type: 'Point', coordinates: [13.36834, 52.52845]},
},
{
type: 'Feature',
properties: {},
- geometry: { type: 'Point', coordinates: [ 13.36768, 52.52788 ] }
+ geometry: {type: 'Point', coordinates: [13.36768, 52.52788]},
},
{
type: 'Feature',
properties: {},
- geometry: { type: 'Point', coordinates: [ 13.36751, 52.5275 ] }
+ geometry: {type: 'Point', coordinates: [13.36751, 52.5275]},
},
{
type: 'Feature',
properties: {},
- geometry: { type: 'Point', coordinates: [ 13.3674, 52.52633 ] }
+ geometry: {type: 'Point', coordinates: [13.3674, 52.52633]},
},
{
type: 'Feature',
properties: {},
- geometry: { type: 'Point', coordinates: [ 13.36762, 52.52592 ] }
+ geometry: {type: 'Point', coordinates: [13.36762, 52.52592]},
},
{
type: 'Feature',
properties: {},
- geometry: { type: 'Point', coordinates: [ 13.36782, 52.52587 ] }
+ geometry: {type: 'Point', coordinates: [13.36782, 52.52587]},
},
{
type: 'Feature',
@@ -445,7 +445,7 @@ const bvgTripWithOccupancy = {
type: 'location',
id: '900003201',
latitude: 52.525607,
- longitude: 13.369072
+ longitude: 13.369072,
},
products: {
suburban: true,
@@ -454,20 +454,20 @@ const bvgTripWithOccupancy = {
bus: true,
ferry: false,
express: true,
- regional: true
- }
+ regional: true,
+ },
},
- geometry: { type: 'Point', coordinates: [ 13.36915, 52.52623 ] }
+ geometry: {type: 'Point', coordinates: [13.36915, 52.52623]},
},
{
type: 'Feature',
properties: {},
- geometry: { type: 'Point', coordinates: [ 13.37048, 52.52664 ] }
+ geometry: {type: 'Point', coordinates: [13.37048, 52.52664]},
},
{
type: 'Feature',
properties: {},
- geometry: { type: 'Point', coordinates: [ 13.3711, 52.52694 ] }
+ geometry: {type: 'Point', coordinates: [13.3711, 52.52694]},
},
{
type: 'Feature',
@@ -479,7 +479,7 @@ const bvgTripWithOccupancy = {
type: 'location',
id: '900100503',
latitude: 52.528762,
- longitude: 13.376929
+ longitude: 13.376929,
},
products: {
suburban: false,
@@ -488,20 +488,20 @@ const bvgTripWithOccupancy = {
bus: true,
ferry: false,
express: false,
- regional: false
- }
+ regional: false,
+ },
},
- geometry: { type: 'Point', coordinates: [ 13.37714, 52.52876 ] }
+ geometry: {type: 'Point', coordinates: [13.37714, 52.52876]},
},
{
type: 'Feature',
properties: {},
- geometry: { type: 'Point', coordinates: [ 13.37833, 52.52912 ] }
+ geometry: {type: 'Point', coordinates: [13.37833, 52.52912]},
},
{
type: 'Feature',
properties: {},
- geometry: { type: 'Point', coordinates: [ 13.3785, 52.52905 ] }
+ geometry: {type: 'Point', coordinates: [13.3785, 52.52905]},
},
{
type: 'Feature',
@@ -513,7 +513,7 @@ const bvgTripWithOccupancy = {
type: 'location',
id: '900100542',
latitude: 52.52576,
- longitude: 13.379086
+ longitude: 13.379086,
},
products: {
suburban: false,
@@ -522,10 +522,10 @@ const bvgTripWithOccupancy = {
bus: true,
ferry: false,
express: false,
- regional: false
- }
+ regional: false,
+ },
},
- geometry: { type: 'Point', coordinates: [ 13.37905, 52.52581 ] }
+ geometry: {type: 'Point', coordinates: [13.37905, 52.52581]},
},
{
type: 'Feature',
@@ -537,7 +537,7 @@ const bvgTripWithOccupancy = {
type: 'location',
id: '900100033',
latitude: 52.524052,
- longitude: 13.379392
+ longitude: 13.379392,
},
products: {
suburban: false,
@@ -546,15 +546,15 @@ const bvgTripWithOccupancy = {
bus: true,
ferry: false,
express: false,
- regional: false
- }
+ regional: false,
+ },
},
- geometry: { type: 'Point', coordinates: [ 13.37942, 52.52361 ] }
+ geometry: {type: 'Point', coordinates: [13.37942, 52.52361]},
},
{
type: 'Feature',
properties: {},
- geometry: { type: 'Point', coordinates: [ 13.37965, 52.52258 ] }
+ geometry: {type: 'Point', coordinates: [13.37965, 52.52258]},
},
{
type: 'Feature',
@@ -566,7 +566,7 @@ const bvgTripWithOccupancy = {
type: 'location',
id: '900100509',
latitude: 52.523126,
- longitude: 13.383266
+ longitude: 13.383266,
},
products: {
suburban: false,
@@ -575,10 +575,10 @@ const bvgTripWithOccupancy = {
bus: true,
ferry: false,
express: false,
- regional: false
- }
+ regional: false,
+ },
},
- geometry: { type: 'Point', coordinates: [ 13.38345, 52.52317 ] }
+ geometry: {type: 'Point', coordinates: [13.38345, 52.52317]},
},
{
type: 'Feature',
@@ -590,7 +590,7 @@ const bvgTripWithOccupancy = {
type: 'location',
id: '900100047',
latitude: 52.523711,
- longitude: 13.386835
+ longitude: 13.386835,
},
products: {
suburban: false,
@@ -599,20 +599,20 @@ const bvgTripWithOccupancy = {
bus: true,
ferry: false,
express: false,
- regional: false
- }
+ regional: false,
+ },
},
- geometry: { type: 'Point', coordinates: [ 13.3867, 52.5237 ] }
+ geometry: {type: 'Point', coordinates: [13.3867, 52.5237]},
},
{
type: 'Feature',
properties: {},
- geometry: { type: 'Point', coordinates: [ 13.38745, 52.52382 ] }
+ geometry: {type: 'Point', coordinates: [13.38745, 52.52382]},
},
{
type: 'Feature',
properties: {},
- geometry: { type: 'Point', coordinates: [ 13.38761, 52.52376 ] }
+ geometry: {type: 'Point', coordinates: [13.38761, 52.52376]},
},
{
type: 'Feature',
@@ -624,7 +624,7 @@ const bvgTripWithOccupancy = {
type: 'location',
id: '900100001',
latitude: 52.520519,
- longitude: 13.386448
+ longitude: 13.386448,
},
products: {
suburban: true,
@@ -633,15 +633,15 @@ const bvgTripWithOccupancy = {
bus: true,
ferry: false,
express: false,
- regional: true
- }
+ regional: true,
+ },
},
- geometry: { type: 'Point', coordinates: [ 13.38818, 52.52058 ] }
+ geometry: {type: 'Point', coordinates: [13.38818, 52.52058]},
},
{
type: 'Feature',
properties: {},
- geometry: { type: 'Point', coordinates: [ 13.38833, 52.51913 ] }
+ geometry: {type: 'Point', coordinates: [13.38833, 52.51913]},
},
{
type: 'Feature',
@@ -653,7 +653,7 @@ const bvgTripWithOccupancy = {
type: 'location',
id: '900100513',
latitude: 52.516996,
- longitude: 13.388875
+ longitude: 13.388875,
},
products: {
suburban: false,
@@ -662,20 +662,20 @@ const bvgTripWithOccupancy = {
bus: true,
ferry: false,
express: false,
- regional: false
- }
+ regional: false,
+ },
},
- geometry: { type: 'Point', coordinates: [ 13.38889, 52.51663 ] }
+ geometry: {type: 'Point', coordinates: [13.38889, 52.51663]},
},
{
type: 'Feature',
properties: {},
- geometry: { type: 'Point', coordinates: [ 13.38872, 52.51723 ] }
+ geometry: {type: 'Point', coordinates: [13.38872, 52.51723]},
},
{
type: 'Feature',
properties: {},
- geometry: { type: 'Point', coordinates: [ 13.38914, 52.51479 ] }
+ geometry: {type: 'Point', coordinates: [13.38914, 52.51479]},
},
{
type: 'Feature',
@@ -687,7 +687,7 @@ const bvgTripWithOccupancy = {
type: 'location',
id: '900100027',
latitude: 52.514766,
- longitude: 13.389208
+ longitude: 13.389208,
},
products: {
suburban: false,
@@ -696,10 +696,10 @@ const bvgTripWithOccupancy = {
bus: true,
ferry: false,
express: false,
- regional: false
- }
+ regional: false,
+ },
},
- geometry: { type: 'Point', coordinates: [ 13.38959, 52.51475 ] }
+ geometry: {type: 'Point', coordinates: [13.38959, 52.51475]},
},
{
type: 'Feature',
@@ -711,7 +711,7 @@ const bvgTripWithOccupancy = {
type: 'location',
id: '900100530',
latitude: 52.515306,
- longitude: 13.397334
+ longitude: 13.397334,
},
products: {
suburban: false,
@@ -720,20 +720,20 @@ const bvgTripWithOccupancy = {
bus: true,
ferry: false,
express: false,
- regional: false
- }
+ regional: false,
+ },
},
- geometry: { type: 'Point', coordinates: [ 13.3971, 52.51524 ] }
+ geometry: {type: 'Point', coordinates: [13.3971, 52.51524]},
},
{
type: 'Feature',
properties: {},
- geometry: { type: 'Point', coordinates: [ 13.39995, 52.51587 ] }
+ geometry: {type: 'Point', coordinates: [13.39995, 52.51587]},
},
{
type: 'Feature',
properties: {},
- geometry: { type: 'Point', coordinates: [ 13.40046, 52.51582 ] }
+ geometry: {type: 'Point', coordinates: [13.40046, 52.51582]},
},
{
type: 'Feature',
@@ -745,7 +745,7 @@ const bvgTripWithOccupancy = {
type: 'location',
id: '900100052',
latitude: 52.516124,
- longitude: 13.401676
+ longitude: 13.401676,
},
products: {
suburban: false,
@@ -754,15 +754,15 @@ const bvgTripWithOccupancy = {
bus: true,
ferry: false,
express: false,
- regional: false
- }
+ regional: false,
+ },
},
- geometry: { type: 'Point', coordinates: [ 13.40196, 52.51628 ] }
+ geometry: {type: 'Point', coordinates: [13.40196, 52.51628]},
},
{
type: 'Feature',
properties: {},
- geometry: { type: 'Point', coordinates: [ 13.40251, 52.51634 ] }
+ geometry: {type: 'Point', coordinates: [13.40251, 52.51634]},
},
{
type: 'Feature',
@@ -774,7 +774,7 @@ const bvgTripWithOccupancy = {
type: 'location',
id: '900100531',
latitude: 52.515189,
- longitude: 13.403995
+ longitude: 13.403995,
},
products: {
suburban: false,
@@ -783,10 +783,10 @@ const bvgTripWithOccupancy = {
bus: true,
ferry: false,
express: false,
- regional: false
- }
+ regional: false,
+ },
},
- geometry: { type: 'Point', coordinates: [ 13.40414, 52.51521 ] }
+ geometry: {type: 'Point', coordinates: [13.40414, 52.51521]},
},
{
type: 'Feature',
@@ -798,7 +798,7 @@ const bvgTripWithOccupancy = {
type: 'location',
id: '900100726',
latitude: 52.513571,
- longitude: 13.406449
+ longitude: 13.406449,
},
products: {
suburban: false,
@@ -807,15 +807,15 @@ const bvgTripWithOccupancy = {
bus: true,
ferry: false,
express: false,
- regional: false
- }
+ regional: false,
+ },
},
- geometry: { type: 'Point', coordinates: [ 13.4063, 52.51363 ] }
+ geometry: {type: 'Point', coordinates: [13.4063, 52.51363]},
},
{
type: 'Feature',
properties: {},
- geometry: { type: 'Point', coordinates: [ 13.40867, 52.51202 ] }
+ geometry: {type: 'Point', coordinates: [13.40867, 52.51202]},
},
{
type: 'Feature',
@@ -827,7 +827,7 @@ const bvgTripWithOccupancy = {
type: 'location',
id: '900100014',
latitude: 52.512007,
- longitude: 13.408768
+ longitude: 13.408768,
},
products: {
suburban: false,
@@ -836,15 +836,15 @@ const bvgTripWithOccupancy = {
bus: true,
ferry: false,
express: false,
- regional: false
- }
+ regional: false,
+ },
},
- geometry: { type: 'Point', coordinates: [ 13.40938, 52.51132 ] }
+ geometry: {type: 'Point', coordinates: [13.40938, 52.51132]},
},
{
type: 'Feature',
properties: {},
- geometry: { type: 'Point', coordinates: [ 13.41117, 52.5096 ] }
+ geometry: {type: 'Point', coordinates: [13.41117, 52.5096]},
},
{
type: 'Feature',
@@ -856,7 +856,7 @@ const bvgTripWithOccupancy = {
type: 'location',
id: '900100032',
latitude: 52.508285,
- longitude: 13.413749
+ longitude: 13.413749,
},
products: {
suburban: false,
@@ -865,15 +865,15 @@ const bvgTripWithOccupancy = {
bus: true,
ferry: false,
express: false,
- regional: false
- }
+ regional: false,
+ },
},
- geometry: { type: 'Point', coordinates: [ 13.41383, 52.50815 ] }
+ geometry: {type: 'Point', coordinates: [13.41383, 52.50815]},
},
{
type: 'Feature',
properties: {},
- geometry: { type: 'Point', coordinates: [ 13.41531, 52.50736 ] }
+ geometry: {type: 'Point', coordinates: [13.41531, 52.50736]},
},
{
type: 'Feature',
@@ -885,7 +885,7 @@ const bvgTripWithOccupancy = {
type: 'location',
id: '900100544',
latitude: 52.506595,
- longitude: 13.417857
+ longitude: 13.417857,
},
products: {
suburban: false,
@@ -894,30 +894,30 @@ const bvgTripWithOccupancy = {
bus: true,
ferry: false,
express: false,
- regional: false
- }
+ regional: false,
+ },
},
- geometry: { type: 'Point', coordinates: [ 13.41761, 52.50662 ] }
+ geometry: {type: 'Point', coordinates: [13.41761, 52.50662]},
},
{
type: 'Feature',
properties: {},
- geometry: { type: 'Point', coordinates: [ 13.41951, 52.50609 ] }
+ geometry: {type: 'Point', coordinates: [13.41951, 52.50609]},
},
{
type: 'Feature',
properties: {},
- geometry: { type: 'Point', coordinates: [ 13.41935, 52.50579 ] }
+ geometry: {type: 'Point', coordinates: [13.41935, 52.50579]},
},
{
type: 'Feature',
properties: {},
- geometry: { type: 'Point', coordinates: [ 13.41947, 52.50569 ] }
+ geometry: {type: 'Point', coordinates: [13.41947, 52.50569]},
},
{
type: 'Feature',
properties: {},
- geometry: { type: 'Point', coordinates: [ 13.42159, 52.50512 ] }
+ geometry: {type: 'Point', coordinates: [13.42159, 52.50512]},
},
{
type: 'Feature',
@@ -929,7 +929,7 @@ const bvgTripWithOccupancy = {
type: 'location',
id: '900100546',
latitude: 52.505283,
- longitude: 13.422144
+ longitude: 13.422144,
},
products: {
suburban: false,
@@ -938,35 +938,35 @@ const bvgTripWithOccupancy = {
bus: true,
ferry: false,
express: false,
- regional: false
- }
+ regional: false,
+ },
},
- geometry: { type: 'Point', coordinates: [ 13.42233, 52.50507 ] }
+ geometry: {type: 'Point', coordinates: [13.42233, 52.50507]},
},
{
type: 'Feature',
properties: {},
- geometry: { type: 'Point', coordinates: [ 13.42443, 52.50514 ] }
+ geometry: {type: 'Point', coordinates: [13.42443, 52.50514]},
},
{
type: 'Feature',
properties: {},
- geometry: { type: 'Point', coordinates: [ 13.42561, 52.50542 ] }
+ geometry: {type: 'Point', coordinates: [13.42561, 52.50542]},
},
{
type: 'Feature',
properties: {},
- geometry: { type: 'Point', coordinates: [ 13.42639, 52.5057 ] }
+ geometry: {type: 'Point', coordinates: [13.42639, 52.5057]},
},
{
type: 'Feature',
properties: {},
- geometry: { type: 'Point', coordinates: [ 13.42708, 52.50612 ] }
+ geometry: {type: 'Point', coordinates: [13.42708, 52.50612]},
},
{
type: 'Feature',
properties: {},
- geometry: { type: 'Point', coordinates: [ 13.4279, 52.5068 ] }
+ geometry: {type: 'Point', coordinates: [13.4279, 52.5068]},
},
{
type: 'Feature',
@@ -978,7 +978,7 @@ const bvgTripWithOccupancy = {
type: 'location',
id: '900014107',
latitude: 52.507215,
- longitude: 13.428437
+ longitude: 13.428437,
},
products: {
suburban: false,
@@ -987,35 +987,35 @@ const bvgTripWithOccupancy = {
bus: true,
ferry: false,
express: false,
- regional: false
- }
+ regional: false,
+ },
},
- geometry: { type: 'Point', coordinates: [ 13.42813, 52.50712 ] }
+ geometry: {type: 'Point', coordinates: [13.42813, 52.50712]},
},
{
type: 'Feature',
properties: {},
- geometry: { type: 'Point', coordinates: [ 13.42845, 52.5082 ] }
+ geometry: {type: 'Point', coordinates: [13.42845, 52.5082]},
},
{
type: 'Feature',
properties: {},
- geometry: { type: 'Point', coordinates: [ 13.43015, 52.51009 ] }
+ geometry: {type: 'Point', coordinates: [13.43015, 52.51009]},
},
{
type: 'Feature',
properties: {},
- geometry: { type: 'Point', coordinates: [ 13.43482, 52.50851 ] }
+ geometry: {type: 'Point', coordinates: [13.43482, 52.50851]},
},
{
type: 'Feature',
properties: {},
- geometry: { type: 'Point', coordinates: [ 13.43507, 52.5086 ] }
+ geometry: {type: 'Point', coordinates: [13.43507, 52.5086]},
},
{
type: 'Feature',
properties: {},
- geometry: { type: 'Point', coordinates: [ 13.4355, 52.50904 ] }
+ geometry: {type: 'Point', coordinates: [13.4355, 52.50904]},
},
{
type: 'Feature',
@@ -1027,7 +1027,7 @@ const bvgTripWithOccupancy = {
type: 'location',
id: '900120005',
latitude: 52.510335,
- longitude: 13.435089
+ longitude: 13.435089,
},
products: {
suburban: true,
@@ -1036,12 +1036,12 @@ const bvgTripWithOccupancy = {
bus: true,
ferry: false,
express: true,
- regional: true
- }
+ regional: true,
+ },
},
- geometry: { type: 'Point', coordinates: [ 13.43447, 52.50953 ] }
- }
- ]
+ geometry: {type: 'Point', coordinates: [13.43447, 52.50953]},
+ },
+ ],
},
stopovers: [
@@ -1054,7 +1054,7 @@ const bvgTripWithOccupancy = {
type: 'location',
id: '900009102',
latitude: 52.546489,
- longitude: 13.359391
+ longitude: 13.359391,
},
products: {
suburban: false,
@@ -1063,8 +1063,8 @@ const bvgTripWithOccupancy = {
bus: true,
ferry: false,
express: false,
- regional: false
- }
+ regional: false,
+ },
},
arrival: null,
plannedArrival: null,
@@ -1082,10 +1082,10 @@ const bvgTripWithOccupancy = {
{
type: 'hint',
code: 'text.journeystop.product.or.direction.changes.stop.message',
- text: 'As 147 heading towards S Ostbahnhof via S+U Wedding from here'
- }
+ text: 'As 147 heading towards S Ostbahnhof via S+U Wedding from here',
+ },
],
- occupancy: 'low'
+ occupancy: 'low',
},
{
stop: {
@@ -1096,7 +1096,7 @@ const bvgTripWithOccupancy = {
type: 'location',
id: '900009151',
latitude: 52.544476,
- longitude: 13.362663
+ longitude: 13.362663,
},
products: {
suburban: false,
@@ -1105,8 +1105,8 @@ const bvgTripWithOccupancy = {
bus: true,
ferry: false,
express: false,
- regional: false
- }
+ regional: false,
+ },
},
arrival: '2021-11-01T07:20:00+01:00',
plannedArrival: '2021-11-01T07:20:00+01:00',
@@ -1121,7 +1121,7 @@ const bvgTripWithOccupancy = {
plannedDeparturePlatform: null,
departurePrognosisType: null,
remarks: [],
- occupancy: 'low'
+ occupancy: 'low',
},
{
stop: {
@@ -1132,7 +1132,7 @@ const bvgTripWithOccupancy = {
type: 'location',
id: '900009104',
latitude: 52.542732,
- longitude: 13.366061
+ longitude: 13.366061,
},
products: {
suburban: true,
@@ -1141,8 +1141,8 @@ const bvgTripWithOccupancy = {
bus: true,
ferry: false,
express: false,
- regional: false
- }
+ regional: false,
+ },
},
arrival: '2021-11-01T07:21:00+01:00',
plannedArrival: '2021-11-01T07:21:00+01:00',
@@ -1160,10 +1160,10 @@ const bvgTripWithOccupancy = {
{
type: 'hint',
code: 'text.journeystop.product.or.direction.changes.stop.message',
- text: 'As 147 heading towards S Ostbahnhof via S+U Hauptbahnhof from here'
- }
+ text: 'As 147 heading towards S Ostbahnhof via S+U Hauptbahnhof from here',
+ },
],
- occupancy: 'low'
+ occupancy: 'low',
},
{
stop: {
@@ -1174,7 +1174,7 @@ const bvgTripWithOccupancy = {
type: 'location',
id: '900008104',
latitude: 52.541195,
- longitude: 13.368713
+ longitude: 13.368713,
},
products: {
suburban: false,
@@ -1183,8 +1183,8 @@ const bvgTripWithOccupancy = {
bus: true,
ferry: false,
express: false,
- regional: false
- }
+ regional: false,
+ },
},
arrival: '2021-11-01T07:22:00+01:00',
plannedArrival: '2021-11-01T07:22:00+01:00',
@@ -1199,7 +1199,7 @@ const bvgTripWithOccupancy = {
plannedDeparturePlatform: null,
departurePrognosisType: null,
remarks: [],
- occupancy: 'low'
+ occupancy: 'low',
},
{
stop: {
@@ -1210,7 +1210,7 @@ const bvgTripWithOccupancy = {
type: 'location',
id: '900001202',
latitude: 52.538848,
- longitude: 13.363607
+ longitude: 13.363607,
},
products: {
suburban: false,
@@ -1219,8 +1219,8 @@ const bvgTripWithOccupancy = {
bus: true,
ferry: false,
express: false,
- regional: false
- }
+ regional: false,
+ },
},
arrival: '2021-11-01T07:24:00+01:00',
plannedArrival: '2021-11-01T07:24:00+01:00',
@@ -1235,7 +1235,7 @@ const bvgTripWithOccupancy = {
plannedDeparturePlatform: null,
departurePrognosisType: null,
remarks: [],
- occupancy: 'low'
+ occupancy: 'low',
},
{
stop: {
@@ -1246,7 +1246,7 @@ const bvgTripWithOccupancy = {
type: 'location',
id: '900001252',
latitude: 52.536736,
- longitude: 13.361216
+ longitude: 13.361216,
},
products: {
suburban: false,
@@ -1255,8 +1255,8 @@ const bvgTripWithOccupancy = {
bus: true,
ferry: false,
express: false,
- regional: false
- }
+ regional: false,
+ },
},
arrival: '2021-11-01T07:26:00+01:00',
plannedArrival: '2021-11-01T07:26:00+01:00',
@@ -1271,7 +1271,7 @@ const bvgTripWithOccupancy = {
plannedDeparturePlatform: null,
departurePrognosisType: null,
remarks: [],
- occupancy: 'low'
+ occupancy: 'low',
},
{
stop: {
@@ -1282,7 +1282,7 @@ const bvgTripWithOccupancy = {
type: 'location',
id: '900001206',
latitude: 52.53332,
- longitude: 13.365512
+ longitude: 13.365512,
},
products: {
suburban: false,
@@ -1291,8 +1291,8 @@ const bvgTripWithOccupancy = {
bus: true,
ferry: false,
express: false,
- regional: false
- }
+ regional: false,
+ },
},
arrival: '2021-11-01T07:27:00+01:00',
plannedArrival: '2021-11-01T07:27:00+01:00',
@@ -1307,7 +1307,7 @@ const bvgTripWithOccupancy = {
plannedDeparturePlatform: null,
departurePrognosisType: null,
remarks: [],
- occupancy: 'low'
+ occupancy: 'low',
},
{
stop: {
@@ -1318,7 +1318,7 @@ const bvgTripWithOccupancy = {
type: 'location',
id: '900001203',
latitude: 52.530668,
- longitude: 13.36811
+ longitude: 13.36811,
},
products: {
suburban: false,
@@ -1327,8 +1327,8 @@ const bvgTripWithOccupancy = {
bus: true,
ferry: false,
express: false,
- regional: false
- }
+ regional: false,
+ },
},
arrival: '2021-11-01T07:28:00+01:00',
plannedArrival: '2021-11-01T07:28:00+01:00',
@@ -1343,7 +1343,7 @@ const bvgTripWithOccupancy = {
plannedDeparturePlatform: null,
departurePrognosisType: null,
remarks: [],
- occupancy: 'low'
+ occupancy: 'low',
},
{
stop: {
@@ -1354,7 +1354,7 @@ const bvgTripWithOccupancy = {
type: 'location',
id: '900003201',
latitude: 52.525607,
- longitude: 13.369072
+ longitude: 13.369072,
},
products: {
suburban: true,
@@ -1363,8 +1363,8 @@ const bvgTripWithOccupancy = {
bus: true,
ferry: false,
express: true,
- regional: true
- }
+ regional: true,
+ },
},
arrival: '2021-11-01T07:31:00+01:00',
plannedArrival: '2021-11-01T07:31:00+01:00',
@@ -1382,10 +1382,10 @@ const bvgTripWithOccupancy = {
{
type: 'hint',
code: 'text.journeystop.product.or.direction.changes.stop.message',
- text: 'As 147 heading towards S Ostbahnhof via Friedrichstr. from here'
- }
+ text: 'As 147 heading towards S Ostbahnhof via Friedrichstr. from here',
+ },
],
- occupancy: 'medium'
+ occupancy: 'medium',
},
{
stop: {
@@ -1396,7 +1396,7 @@ const bvgTripWithOccupancy = {
type: 'location',
id: '900100503',
latitude: 52.528762,
- longitude: 13.376929
+ longitude: 13.376929,
},
products: {
suburban: false,
@@ -1405,8 +1405,8 @@ const bvgTripWithOccupancy = {
bus: true,
ferry: false,
express: false,
- regional: false
- }
+ regional: false,
+ },
},
arrival: '2021-11-01T07:33:00+01:00',
plannedArrival: '2021-11-01T07:33:00+01:00',
@@ -1421,7 +1421,7 @@ const bvgTripWithOccupancy = {
plannedDeparturePlatform: null,
departurePrognosisType: null,
remarks: [],
- occupancy: 'medium'
+ occupancy: 'medium',
},
{
stop: {
@@ -1432,7 +1432,7 @@ const bvgTripWithOccupancy = {
type: 'location',
id: '900100542',
latitude: 52.52576,
- longitude: 13.379086
+ longitude: 13.379086,
},
products: {
suburban: false,
@@ -1441,8 +1441,8 @@ const bvgTripWithOccupancy = {
bus: true,
ferry: false,
express: false,
- regional: false
- }
+ regional: false,
+ },
},
arrival: '2021-11-01T07:35:00+01:00',
plannedArrival: '2021-11-01T07:35:00+01:00',
@@ -1457,7 +1457,7 @@ const bvgTripWithOccupancy = {
plannedDeparturePlatform: null,
departurePrognosisType: null,
remarks: [],
- occupancy: 'low'
+ occupancy: 'low',
},
{
stop: {
@@ -1468,7 +1468,7 @@ const bvgTripWithOccupancy = {
type: 'location',
id: '900100033',
latitude: 52.524052,
- longitude: 13.379392
+ longitude: 13.379392,
},
products: {
suburban: false,
@@ -1477,8 +1477,8 @@ const bvgTripWithOccupancy = {
bus: true,
ferry: false,
express: false,
- regional: false
- }
+ regional: false,
+ },
},
arrival: '2021-11-01T07:36:00+01:00',
plannedArrival: '2021-11-01T07:36:00+01:00',
@@ -1493,7 +1493,7 @@ const bvgTripWithOccupancy = {
plannedDeparturePlatform: null,
departurePrognosisType: null,
remarks: [],
- occupancy: 'low'
+ occupancy: 'low',
},
{
stop: {
@@ -1504,7 +1504,7 @@ const bvgTripWithOccupancy = {
type: 'location',
id: '900100509',
latitude: 52.523126,
- longitude: 13.383266
+ longitude: 13.383266,
},
products: {
suburban: false,
@@ -1513,8 +1513,8 @@ const bvgTripWithOccupancy = {
bus: true,
ferry: false,
express: false,
- regional: false
- }
+ regional: false,
+ },
},
arrival: '2021-11-01T07:38:00+01:00',
plannedArrival: '2021-11-01T07:38:00+01:00',
@@ -1529,7 +1529,7 @@ const bvgTripWithOccupancy = {
plannedDeparturePlatform: null,
departurePrognosisType: null,
remarks: [],
- occupancy: 'low'
+ occupancy: 'low',
},
{
stop: {
@@ -1540,7 +1540,7 @@ const bvgTripWithOccupancy = {
type: 'location',
id: '900100047',
latitude: 52.523711,
- longitude: 13.386835
+ longitude: 13.386835,
},
products: {
suburban: false,
@@ -1549,8 +1549,8 @@ const bvgTripWithOccupancy = {
bus: true,
ferry: false,
express: false,
- regional: false
- }
+ regional: false,
+ },
},
arrival: '2021-11-01T07:39:00+01:00',
plannedArrival: '2021-11-01T07:39:00+01:00',
@@ -1565,7 +1565,7 @@ const bvgTripWithOccupancy = {
plannedDeparturePlatform: null,
departurePrognosisType: null,
remarks: [],
- occupancy: 'low'
+ occupancy: 'low',
},
{
stop: {
@@ -1576,7 +1576,7 @@ const bvgTripWithOccupancy = {
type: 'location',
id: '900100001',
latitude: 52.520519,
- longitude: 13.386448
+ longitude: 13.386448,
},
products: {
suburban: true,
@@ -1585,8 +1585,8 @@ const bvgTripWithOccupancy = {
bus: true,
ferry: false,
express: false,
- regional: true
- }
+ regional: true,
+ },
},
arrival: '2021-11-01T07:41:00+01:00',
plannedArrival: '2021-11-01T07:41:00+01:00',
@@ -1604,10 +1604,10 @@ const bvgTripWithOccupancy = {
{
type: 'hint',
code: 'text.journeystop.product.or.direction.changes.stop.message',
- text: 'As 147 heading towards S Ostbahnhof from here'
- }
+ text: 'As 147 heading towards S Ostbahnhof from here',
+ },
],
- occupancy: 'low'
+ occupancy: 'low',
},
{
stop: {
@@ -1618,7 +1618,7 @@ const bvgTripWithOccupancy = {
type: 'location',
id: '900100513',
latitude: 52.516996,
- longitude: 13.388875
+ longitude: 13.388875,
},
products: {
suburban: false,
@@ -1627,8 +1627,8 @@ const bvgTripWithOccupancy = {
bus: true,
ferry: false,
express: false,
- regional: false
- }
+ regional: false,
+ },
},
arrival: '2021-11-01T07:44:00+01:00',
plannedArrival: '2021-11-01T07:44:00+01:00',
@@ -1643,7 +1643,7 @@ const bvgTripWithOccupancy = {
plannedDeparturePlatform: null,
departurePrognosisType: null,
remarks: [],
- occupancy: 'low'
+ occupancy: 'low',
},
{
stop: {
@@ -1654,7 +1654,7 @@ const bvgTripWithOccupancy = {
type: 'location',
id: '900100027',
latitude: 52.514766,
- longitude: 13.389208
+ longitude: 13.389208,
},
products: {
suburban: false,
@@ -1663,8 +1663,8 @@ const bvgTripWithOccupancy = {
bus: true,
ferry: false,
express: false,
- regional: false
- }
+ regional: false,
+ },
},
arrival: '2021-11-01T07:45:00+01:00',
plannedArrival: '2021-11-01T07:45:00+01:00',
@@ -1679,7 +1679,7 @@ const bvgTripWithOccupancy = {
plannedDeparturePlatform: null,
departurePrognosisType: null,
remarks: [],
- occupancy: 'low'
+ occupancy: 'low',
},
{
stop: {
@@ -1690,7 +1690,7 @@ const bvgTripWithOccupancy = {
type: 'location',
id: '900100530',
latitude: 52.515306,
- longitude: 13.397334
+ longitude: 13.397334,
},
products: {
suburban: false,
@@ -1699,8 +1699,8 @@ const bvgTripWithOccupancy = {
bus: true,
ferry: false,
express: false,
- regional: false
- }
+ regional: false,
+ },
},
arrival: '2021-11-01T07:47:00+01:00',
plannedArrival: '2021-11-01T07:47:00+01:00',
@@ -1715,7 +1715,7 @@ const bvgTripWithOccupancy = {
plannedDeparturePlatform: null,
departurePrognosisType: null,
remarks: [],
- occupancy: 'low'
+ occupancy: 'low',
},
{
stop: {
@@ -1726,7 +1726,7 @@ const bvgTripWithOccupancy = {
type: 'location',
id: '900100052',
latitude: 52.516124,
- longitude: 13.401676
+ longitude: 13.401676,
},
products: {
suburban: false,
@@ -1735,8 +1735,8 @@ const bvgTripWithOccupancy = {
bus: true,
ferry: false,
express: false,
- regional: false
- }
+ regional: false,
+ },
},
arrival: '2021-11-01T07:47:00+01:00',
plannedArrival: '2021-11-01T07:47:00+01:00',
@@ -1751,7 +1751,7 @@ const bvgTripWithOccupancy = {
plannedDeparturePlatform: null,
departurePrognosisType: null,
remarks: [],
- occupancy: 'low'
+ occupancy: 'low',
},
{
stop: {
@@ -1762,7 +1762,7 @@ const bvgTripWithOccupancy = {
type: 'location',
id: '900100531',
latitude: 52.515189,
- longitude: 13.403995
+ longitude: 13.403995,
},
products: {
suburban: false,
@@ -1771,8 +1771,8 @@ const bvgTripWithOccupancy = {
bus: true,
ferry: false,
express: false,
- regional: false
- }
+ regional: false,
+ },
},
arrival: '2021-11-01T07:48:00+01:00',
plannedArrival: '2021-11-01T07:48:00+01:00',
@@ -1787,7 +1787,7 @@ const bvgTripWithOccupancy = {
plannedDeparturePlatform: null,
departurePrognosisType: null,
remarks: [],
- occupancy: 'low'
+ occupancy: 'low',
},
{
stop: {
@@ -1798,7 +1798,7 @@ const bvgTripWithOccupancy = {
type: 'location',
id: '900100726',
latitude: 52.513571,
- longitude: 13.406449
+ longitude: 13.406449,
},
products: {
suburban: false,
@@ -1807,8 +1807,8 @@ const bvgTripWithOccupancy = {
bus: true,
ferry: false,
express: false,
- regional: false
- }
+ regional: false,
+ },
},
arrival: '2021-11-01T07:49:00+01:00',
plannedArrival: '2021-11-01T07:49:00+01:00',
@@ -1823,7 +1823,7 @@ const bvgTripWithOccupancy = {
plannedDeparturePlatform: null,
departurePrognosisType: null,
remarks: [],
- occupancy: 'low'
+ occupancy: 'low',
},
{
stop: {
@@ -1834,7 +1834,7 @@ const bvgTripWithOccupancy = {
type: 'location',
id: '900100014',
latitude: 52.512007,
- longitude: 13.408768
+ longitude: 13.408768,
},
products: {
suburban: false,
@@ -1843,8 +1843,8 @@ const bvgTripWithOccupancy = {
bus: true,
ferry: false,
express: false,
- regional: false
- }
+ regional: false,
+ },
},
arrival: '2021-11-01T07:50:00+01:00',
plannedArrival: '2021-11-01T07:50:00+01:00',
@@ -1859,7 +1859,7 @@ const bvgTripWithOccupancy = {
plannedDeparturePlatform: null,
departurePrognosisType: null,
remarks: [],
- occupancy: 'low'
+ occupancy: 'low',
},
{
stop: {
@@ -1870,7 +1870,7 @@ const bvgTripWithOccupancy = {
type: 'location',
id: '900100032',
latitude: 52.508285,
- longitude: 13.413749
+ longitude: 13.413749,
},
products: {
suburban: false,
@@ -1879,8 +1879,8 @@ const bvgTripWithOccupancy = {
bus: true,
ferry: false,
express: false,
- regional: false
- }
+ regional: false,
+ },
},
arrival: '2021-11-01T07:51:00+01:00',
plannedArrival: '2021-11-01T07:51:00+01:00',
@@ -1895,7 +1895,7 @@ const bvgTripWithOccupancy = {
plannedDeparturePlatform: null,
departurePrognosisType: null,
remarks: [],
- occupancy: 'low'
+ occupancy: 'low',
},
{
stop: {
@@ -1906,7 +1906,7 @@ const bvgTripWithOccupancy = {
type: 'location',
id: '900100544',
latitude: 52.506595,
- longitude: 13.417857
+ longitude: 13.417857,
},
products: {
suburban: false,
@@ -1915,8 +1915,8 @@ const bvgTripWithOccupancy = {
bus: true,
ferry: false,
express: false,
- regional: false
- }
+ regional: false,
+ },
},
arrival: '2021-11-01T07:52:00+01:00',
plannedArrival: '2021-11-01T07:52:00+01:00',
@@ -1931,7 +1931,7 @@ const bvgTripWithOccupancy = {
plannedDeparturePlatform: null,
departurePrognosisType: null,
remarks: [],
- occupancy: 'low'
+ occupancy: 'low',
},
{
stop: {
@@ -1942,7 +1942,7 @@ const bvgTripWithOccupancy = {
type: 'location',
id: '900100546',
latitude: 52.505283,
- longitude: 13.422144
+ longitude: 13.422144,
},
products: {
suburban: false,
@@ -1951,8 +1951,8 @@ const bvgTripWithOccupancy = {
bus: true,
ferry: false,
express: false,
- regional: false
- }
+ regional: false,
+ },
},
arrival: '2021-11-01T07:53:00+01:00',
plannedArrival: '2021-11-01T07:53:00+01:00',
@@ -1967,7 +1967,7 @@ const bvgTripWithOccupancy = {
plannedDeparturePlatform: null,
departurePrognosisType: null,
remarks: [],
- occupancy: 'low'
+ occupancy: 'low',
},
{
stop: {
@@ -1978,7 +1978,7 @@ const bvgTripWithOccupancy = {
type: 'location',
id: '900014107',
latitude: 52.507215,
- longitude: 13.428437
+ longitude: 13.428437,
},
products: {
suburban: false,
@@ -1987,8 +1987,8 @@ const bvgTripWithOccupancy = {
bus: true,
ferry: false,
express: false,
- regional: false
- }
+ regional: false,
+ },
},
arrival: '2021-11-01T07:55:00+01:00',
plannedArrival: '2021-11-01T07:55:00+01:00',
@@ -2003,7 +2003,7 @@ const bvgTripWithOccupancy = {
plannedDeparturePlatform: null,
departurePrognosisType: null,
remarks: [],
- occupancy: 'low'
+ occupancy: 'low',
},
{
stop: {
@@ -2014,7 +2014,7 @@ const bvgTripWithOccupancy = {
type: 'location',
id: '900120005',
latitude: 52.510335,
- longitude: 13.435089
+ longitude: 13.435089,
},
products: {
suburban: true,
@@ -2023,8 +2023,8 @@ const bvgTripWithOccupancy = {
bus: true,
ferry: false,
express: true,
- regional: true
- }
+ regional: true,
+ },
},
arrival: '2021-11-01T07:59:00+01:00',
plannedArrival: '2021-11-01T07:59:00+01:00',
@@ -2038,10 +2038,10 @@ const bvgTripWithOccupancy = {
departurePlatform: null,
plannedDeparturePlatform: null,
departurePrognosisType: null,
- }
+ },
],
-}
+};
export {
bvgTripWithOccupancy,
-}
+};
diff --git a/test/fixtures/db-arrivals.js b/test/fixtures/db-arrivals.js
index 6b4a88e4..0b775214 100644
--- a/test/fixtures/db-arrivals.js
+++ b/test/fixtures/db-arrivals.js
@@ -9,7 +9,7 @@ const dbArrivals = [
type: 'location',
id: '730985',
latitude: 52.530866,
- longitude: 13.300781
+ longitude: 13.300781,
},
products: {
nationalExpress: false,
@@ -21,7 +21,7 @@ const dbArrivals = [
ferry: false,
subway: true,
tram: false,
- taxi: false
+ taxi: false,
},
station: {
type: 'station',
@@ -31,7 +31,7 @@ const dbArrivals = [
type: 'location',
id: '8011167',
latitude: 52.530291,
- longitude: 13.299451
+ longitude: 13.299451,
},
products: {
nationalExpress: false,
@@ -43,7 +43,7 @@ const dbArrivals = [
ferry: false,
subway: true,
tram: false,
- taxi: false
+ taxi: false,
},
lines: [
{
@@ -53,7 +53,7 @@ const dbArrivals = [
name: 'Bus RE6',
public: true,
mode: 'train',
- product: 'regional'
+ product: 'regional',
},
{
type: 'line',
@@ -62,7 +62,7 @@ const dbArrivals = [
name: 'Bus SEV',
public: true,
mode: 'train',
- product: 'regional'
+ product: 'regional',
},
{
type: 'line',
@@ -71,7 +71,7 @@ const dbArrivals = [
name: 'RB',
public: true,
mode: 'train',
- product: 'regional'
+ product: 'regional',
},
{
type: 'line',
@@ -80,7 +80,7 @@ const dbArrivals = [
name: 'RE',
public: true,
mode: 'train',
- product: 'regional'
+ product: 'regional',
},
{
type: 'line',
@@ -89,7 +89,7 @@ const dbArrivals = [
name: 'RE',
public: true,
mode: 'train',
- product: 'regional'
+ product: 'regional',
},
{
type: 'line',
@@ -98,7 +98,7 @@ const dbArrivals = [
name: 'S 2',
public: true,
mode: 'train',
- product: 'suburban'
+ product: 'suburban',
},
{
type: 'line',
@@ -107,7 +107,7 @@ const dbArrivals = [
name: 'S 25',
public: true,
mode: 'train',
- product: 'suburban'
+ product: 'suburban',
},
{
type: 'line',
@@ -116,7 +116,7 @@ const dbArrivals = [
name: 'S 41',
public: true,
mode: 'train',
- product: 'suburban'
+ product: 'suburban',
},
{
type: 'line',
@@ -125,7 +125,7 @@ const dbArrivals = [
name: 'S 42',
public: true,
mode: 'train',
- product: 'suburban'
+ product: 'suburban',
},
{
type: 'line',
@@ -134,7 +134,7 @@ const dbArrivals = [
name: 'S 46',
public: true,
mode: 'train',
- product: 'suburban'
+ product: 'suburban',
},
{
type: 'line',
@@ -143,7 +143,7 @@ const dbArrivals = [
name: 'Bus N7',
public: true,
mode: 'bus',
- product: 'bus'
+ product: 'bus',
},
{
type: 'line',
@@ -152,7 +152,7 @@ const dbArrivals = [
name: 'Bus X9',
public: true,
mode: 'bus',
- product: 'bus'
+ product: 'bus',
},
{
type: 'line',
@@ -161,7 +161,7 @@ const dbArrivals = [
name: 'Bus 109',
public: true,
mode: 'bus',
- product: 'bus'
+ product: 'bus',
},
{
type: 'line',
@@ -170,7 +170,7 @@ const dbArrivals = [
name: 'Bus M21',
public: true,
mode: 'bus',
- product: 'bus'
+ product: 'bus',
},
{
type: 'line',
@@ -179,7 +179,7 @@ const dbArrivals = [
name: 'Bus M27',
public: true,
mode: 'bus',
- product: 'bus'
+ product: 'bus',
},
{
type: 'line',
@@ -188,9 +188,9 @@ const dbArrivals = [
name: 'U 7',
public: true,
mode: 'train',
- product: 'subway'
- }
- ]
+ product: 'subway',
+ },
+ ],
},
lines: [
{
@@ -200,7 +200,7 @@ const dbArrivals = [
name: 'Bus N7',
public: true,
mode: 'bus',
- product: 'bus'
+ product: 'bus',
},
{
type: 'line',
@@ -209,7 +209,7 @@ const dbArrivals = [
name: 'Bus X9',
public: true,
mode: 'bus',
- product: 'bus'
+ product: 'bus',
},
{
type: 'line',
@@ -218,7 +218,7 @@ const dbArrivals = [
name: 'Bus M21',
public: true,
mode: 'bus',
- product: 'bus'
+ product: 'bus',
},
{
type: 'line',
@@ -227,7 +227,7 @@ const dbArrivals = [
name: 'Bus M27',
public: true,
mode: 'bus',
- product: 'bus'
+ product: 'bus',
},
{
type: 'line',
@@ -236,9 +236,9 @@ const dbArrivals = [
name: 'U 7',
public: true,
mode: 'train',
- product: 'subway'
- }
- ]
+ product: 'subway',
+ },
+ ],
},
when: '2020-06-09T17:21:00+02:00',
plannedWhen: '2020-06-09T17:04:00+02:00',
@@ -260,12 +260,12 @@ const dbArrivals = [
productName: 'U',
mode: 'train',
product: 'subway',
- operator: { type: 'operator', id: 'nahreisezug', name: 'Nahreisezug' }
+ operator: {type: 'operator', id: 'nahreisezug', name: 'Nahreisezug'},
},
- remarks: []
- }
-]
+ remarks: [],
+ },
+];
export {
dbArrivals,
-}
+};
diff --git a/test/fixtures/db-journey-2.js b/test/fixtures/db-journey-2.js
index ae777209..fcd66db9 100644
--- a/test/fixtures/db-journey-2.js
+++ b/test/fixtures/db-journey-2.js
@@ -10,7 +10,7 @@ const dbJourney = {
type: 'location',
id: '8004154',
latitude: 48.107418,
- longitude: 11.536306
+ longitude: 11.536306,
},
products: {
nationalExpress: false,
@@ -22,8 +22,8 @@ const dbJourney = {
ferry: false,
subway: false,
tram: false,
- taxi: false
- }
+ taxi: false,
+ },
},
destination: {
type: 'stop',
@@ -33,7 +33,7 @@ const dbJourney = {
type: 'location',
id: '8004137',
latitude: 48.094492,
- longitude: 11.53281
+ longitude: 11.53281,
},
products: {
nationalExpress: false,
@@ -45,8 +45,8 @@ const dbJourney = {
ferry: false,
subway: false,
tram: false,
- taxi: false
- }
+ taxi: false,
+ },
},
departure: '2020-11-16T10:04:00+01:00',
plannedDeparture: '2020-11-16T10:04:00+01:00',
@@ -71,8 +71,8 @@ const dbJourney = {
operator: {
type: 'operator',
id: 'db-regio-ag-bayern',
- name: 'DB Regio AG Bayern'
- }
+ name: 'DB Regio AG Bayern',
+ },
},
direction: 'Höllriegelskreuth',
arrivalPlatform: '2',
@@ -89,7 +89,7 @@ const dbJourney = {
type: 'location',
id: '8004154',
latitude: 48.107418,
- longitude: 11.536306
+ longitude: 11.536306,
},
products: {
nationalExpress: false,
@@ -101,8 +101,8 @@ const dbJourney = {
ferry: false,
subway: false,
tram: false,
- taxi: false
- }
+ taxi: false,
+ },
},
arrival: null,
plannedArrival: null,
@@ -126,7 +126,7 @@ const dbJourney = {
type: 'location',
id: '8004137',
latitude: 48.094492,
- longitude: 11.53281
+ longitude: 11.53281,
},
products: {
nationalExpress: false,
@@ -138,8 +138,8 @@ const dbJourney = {
ferry: false,
subway: false,
tram: false,
- taxi: false
- }
+ taxi: false,
+ },
},
arrival: '2020-11-16T10:05:00+01:00',
plannedArrival: '2020-11-16T10:05:00+01:00',
@@ -153,33 +153,33 @@ const dbJourney = {
departurePlatform: null,
plannedDeparturePlatform: null,
departurePrognosisType: null,
- }
+ },
],
remarks: [
{
type: 'hint',
code: 'PB',
- text: 'Obligation to cover nose and mouth'
+ text: 'Obligation to cover nose and mouth',
},
{
text: 'Number of bicycles conveyed limited',
type: 'hint',
code: 'bicycle-conveyance',
- summary: 'bicycles conveyed'
+ summary: 'bicycles conveyed',
},
{
type: 'hint',
code: 'FS',
- text: 'conveying bicycles: mind the excluded times'
+ text: 'conveying bicycles: mind the excluded times',
},
{
text: '2nd class only',
type: 'hint',
code: '2nd-class-only',
- summary: '2. class only'
- }
+ summary: '2. class only',
+ },
],
- cycle: {min: 1200, max: 1200, nr: 7}
+ cycle: {min: 1200, max: 1200, nr: 7},
},
{
origin: {
@@ -190,7 +190,7 @@ const dbJourney = {
type: 'location',
id: '8004137',
latitude: 48.094492,
- longitude: 11.53281
+ longitude: 11.53281,
},
products: {
nationalExpress: false,
@@ -202,8 +202,8 @@ const dbJourney = {
ferry: false,
subway: false,
tram: false,
- taxi: false
- }
+ taxi: false,
+ },
},
destination: {
type: 'stop',
@@ -213,7 +213,7 @@ const dbJourney = {
type: 'location',
id: '625016',
latitude: 48.098357,
- longitude: 11.536261
+ longitude: 11.536261,
},
products: {
nationalExpress: false,
@@ -225,7 +225,7 @@ const dbJourney = {
ferry: false,
subway: true,
tram: false,
- taxi: false
+ taxi: false,
},
station: {
type: 'station',
@@ -235,7 +235,7 @@ const dbJourney = {
type: 'location',
id: '625021',
latitude: 48.098627,
- longitude: 11.538023
+ longitude: 11.538023,
},
products: {
nationalExpress: false,
@@ -247,9 +247,9 @@ const dbJourney = {
ferry: false,
subway: true,
tram: false,
- taxi: false
- }
- }
+ taxi: false,
+ },
+ },
},
departure: '2020-11-16T10:05:00+01:00',
plannedDeparture: '2020-11-16T10:05:00+01:00',
@@ -260,7 +260,7 @@ const dbJourney = {
public: true,
walking: true,
distance: 500,
- remarks: [ {type: 'hint', code: 'XK', text: 'walking distance 500 m'} ]
+ remarks: [{type: 'hint', code: 'XK', text: 'walking distance 500 m'}],
},
{
origin: {
@@ -271,7 +271,7 @@ const dbJourney = {
type: 'location',
id: '625016',
latitude: 48.098357,
- longitude: 11.536261
+ longitude: 11.536261,
},
products: {
nationalExpress: false,
@@ -283,7 +283,7 @@ const dbJourney = {
ferry: false,
subway: true,
tram: false,
- taxi: false
+ taxi: false,
},
station: {
type: 'station',
@@ -293,7 +293,7 @@ const dbJourney = {
type: 'location',
id: '625021',
latitude: 48.098627,
- longitude: 11.538023
+ longitude: 11.538023,
},
products: {
nationalExpress: false,
@@ -305,9 +305,9 @@ const dbJourney = {
ferry: false,
subway: true,
tram: false,
- taxi: false
- }
- }
+ taxi: false,
+ },
+ },
},
destination: {
type: 'stop',
@@ -317,7 +317,7 @@ const dbJourney = {
type: 'location',
id: '624333',
latitude: 48.166702,
- longitude: 11.578151
+ longitude: 11.578151,
},
products: {
nationalExpress: false,
@@ -329,7 +329,7 @@ const dbJourney = {
ferry: false,
subway: true,
tram: false,
- taxi: false
+ taxi: false,
},
station: {
type: 'station',
@@ -339,7 +339,7 @@ const dbJourney = {
type: 'location',
id: '790754',
latitude: 48.167035,
- longitude: 11.579347
+ longitude: 11.579347,
},
products: {
nationalExpress: false,
@@ -351,9 +351,9 @@ const dbJourney = {
ferry: false,
subway: true,
tram: false,
- taxi: false
- }
- }
+ taxi: false,
+ },
+ },
},
departure: '2020-11-16T10:15:00+01:00',
plannedDeparture: '2020-11-16T10:15:00+01:00',
@@ -374,7 +374,7 @@ const dbJourney = {
adminCode: 'swm001',
productName: 'U',
mode: 'train',
- product: 'subway'
+ product: 'subway',
},
direction: 'Moosach, München',
arrivalPlatform: null,
@@ -391,7 +391,7 @@ const dbJourney = {
type: 'location',
id: '625016',
latitude: 48.098357,
- longitude: 11.536261
+ longitude: 11.536261,
},
products: {
nationalExpress: false,
@@ -403,7 +403,7 @@ const dbJourney = {
ferry: false,
subway: true,
tram: false,
- taxi: false
+ taxi: false,
},
station: {
type: 'station',
@@ -413,7 +413,7 @@ const dbJourney = {
type: 'location',
id: '625021',
latitude: 48.098627,
- longitude: 11.538023
+ longitude: 11.538023,
},
products: {
nationalExpress: false,
@@ -425,9 +425,9 @@ const dbJourney = {
ferry: false,
subway: true,
tram: false,
- taxi: false
- }
- }
+ taxi: false,
+ },
+ },
},
arrival: null,
plannedArrival: null,
@@ -451,7 +451,7 @@ const dbJourney = {
type: 'location',
id: '625236',
latitude: 48.102708,
- longitude: 11.546015
+ longitude: 11.546015,
},
products: {
nationalExpress: false,
@@ -463,7 +463,7 @@ const dbJourney = {
ferry: false,
subway: true,
tram: false,
- taxi: false
+ taxi: false,
},
station: {
type: 'station',
@@ -473,7 +473,7 @@ const dbJourney = {
type: 'location',
id: '625242',
latitude: 48.101009,
- longitude: 11.54668
+ longitude: 11.54668,
},
products: {
nationalExpress: false,
@@ -485,9 +485,9 @@ const dbJourney = {
ferry: false,
subway: true,
tram: false,
- taxi: false
- }
- }
+ taxi: false,
+ },
+ },
},
arrival: '2020-11-16T10:16:00+01:00',
plannedArrival: '2020-11-16T10:16:00+01:00',
@@ -511,7 +511,7 @@ const dbJourney = {
type: 'location',
id: '624342',
latitude: 48.112596,
- longitude: 11.548721
+ longitude: 11.548721,
},
products: {
nationalExpress: false,
@@ -523,7 +523,7 @@ const dbJourney = {
ferry: false,
subway: true,
tram: false,
- taxi: false
+ taxi: false,
},
station: {
type: 'station',
@@ -533,7 +533,7 @@ const dbJourney = {
type: 'location',
id: '624345',
latitude: 48.112209,
- longitude: 11.548235
+ longitude: 11.548235,
},
products: {
nationalExpress: false,
@@ -545,9 +545,9 @@ const dbJourney = {
ferry: false,
subway: true,
tram: false,
- taxi: false
- }
- }
+ taxi: false,
+ },
+ },
},
arrival: '2020-11-16T10:18:00+01:00',
plannedArrival: '2020-11-16T10:18:00+01:00',
@@ -571,7 +571,7 @@ const dbJourney = {
type: 'location',
id: '624684',
latitude: 48.120138,
- longitude: 11.548433
+ longitude: 11.548433,
},
products: {
nationalExpress: false,
@@ -583,7 +583,7 @@ const dbJourney = {
ferry: false,
subway: true,
tram: false,
- taxi: false
+ taxi: false,
},
station: {
type: 'station',
@@ -593,7 +593,7 @@ const dbJourney = {
type: 'location',
id: '624691',
latitude: 48.119392,
- longitude: 11.548855
+ longitude: 11.548855,
},
products: {
nationalExpress: false,
@@ -605,9 +605,9 @@ const dbJourney = {
ferry: false,
subway: true,
tram: false,
- taxi: false
- }
- }
+ taxi: false,
+ },
+ },
},
arrival: '2020-11-16T10:20:00+01:00',
plannedArrival: '2020-11-16T10:20:00+01:00',
@@ -631,7 +631,7 @@ const dbJourney = {
type: 'location',
id: '625095',
latitude: 48.125513,
- longitude: 11.550357
+ longitude: 11.550357,
},
products: {
nationalExpress: false,
@@ -643,8 +643,8 @@ const dbJourney = {
ferry: false,
subway: true,
tram: false,
- taxi: false
- }
+ taxi: false,
+ },
},
arrival: '2020-11-16T10:21:00+01:00',
plannedArrival: '2020-11-16T10:21:00+01:00',
@@ -668,7 +668,7 @@ const dbJourney = {
type: 'location',
id: '624535',
latitude: 48.129064,
- longitude: 11.557422
+ longitude: 11.557422,
},
products: {
nationalExpress: false,
@@ -680,8 +680,8 @@ const dbJourney = {
ferry: false,
subway: true,
tram: false,
- taxi: false
- }
+ taxi: false,
+ },
},
arrival: '2020-11-16T10:22:00+01:00',
plannedArrival: '2020-11-16T10:22:00+01:00',
@@ -705,7 +705,7 @@ const dbJourney = {
type: 'location',
id: '625176',
latitude: 48.133406,
- longitude: 11.566744
+ longitude: 11.566744,
},
products: {
nationalExpress: false,
@@ -717,8 +717,8 @@ const dbJourney = {
ferry: false,
subway: true,
tram: true,
- taxi: false
- }
+ taxi: false,
+ },
},
arrival: '2020-11-16T10:24:00+01:00',
plannedArrival: '2020-11-16T10:24:00+01:00',
@@ -742,7 +742,7 @@ const dbJourney = {
type: 'location',
id: '624885',
latitude: 48.137829,
- longitude: 11.576596
+ longitude: 11.576596,
},
products: {
nationalExpress: false,
@@ -754,7 +754,7 @@ const dbJourney = {
ferry: false,
subway: true,
tram: false,
- taxi: false
+ taxi: false,
},
station: {
type: 'station',
@@ -764,7 +764,7 @@ const dbJourney = {
type: 'location',
id: '8004135',
latitude: 48.137047,
- longitude: 11.575383
+ longitude: 11.575383,
},
products: {
nationalExpress: false,
@@ -776,9 +776,9 @@ const dbJourney = {
ferry: false,
subway: true,
tram: false,
- taxi: false
- }
- }
+ taxi: false,
+ },
+ },
},
arrival: '2020-11-16T10:26:00+01:00',
plannedArrival: '2020-11-16T10:26:00+01:00',
@@ -802,7 +802,7 @@ const dbJourney = {
type: 'location',
id: '638143',
latitude: 48.143411,
- longitude: 11.57798
+ longitude: 11.57798,
},
products: {
nationalExpress: false,
@@ -814,7 +814,7 @@ const dbJourney = {
ferry: false,
subway: true,
tram: false,
- taxi: false
+ taxi: false,
},
station: {
type: 'station',
@@ -824,7 +824,7 @@ const dbJourney = {
type: 'location',
id: '8070914',
latitude: 48.142943,
- longitude: 11.577819
+ longitude: 11.577819,
},
products: {
nationalExpress: false,
@@ -836,9 +836,9 @@ const dbJourney = {
ferry: false,
subway: true,
tram: false,
- taxi: false
- }
- }
+ taxi: false,
+ },
+ },
},
arrival: '2020-11-16T10:27:00+01:00',
plannedArrival: '2020-11-16T10:27:00+01:00',
@@ -862,7 +862,7 @@ const dbJourney = {
type: 'location',
id: '638611',
latitude: 48.150063,
- longitude: 11.581001
+ longitude: 11.581001,
},
products: {
nationalExpress: false,
@@ -874,7 +874,7 @@ const dbJourney = {
ferry: false,
subway: true,
tram: false,
- taxi: false
+ taxi: false,
},
station: {
type: 'station',
@@ -884,7 +884,7 @@ const dbJourney = {
type: 'location',
id: '625286',
latitude: 48.148283,
- longitude: 11.580048
+ longitude: 11.580048,
},
products: {
nationalExpress: false,
@@ -896,9 +896,9 @@ const dbJourney = {
ferry: false,
subway: true,
tram: false,
- taxi: false
- }
- }
+ taxi: false,
+ },
+ },
},
arrival: '2020-11-16T10:29:00+01:00',
plannedArrival: '2020-11-16T10:29:00+01:00',
@@ -922,7 +922,7 @@ const dbJourney = {
type: 'location',
id: '624521',
latitude: 48.156517,
- longitude: 11.584003
+ longitude: 11.584003,
},
products: {
nationalExpress: false,
@@ -934,7 +934,7 @@ const dbJourney = {
ferry: false,
subway: true,
tram: false,
- taxi: false
+ taxi: false,
},
station: {
type: 'station',
@@ -944,7 +944,7 @@ const dbJourney = {
type: 'location',
id: '624526',
latitude: 48.157236,
- longitude: 11.584803
+ longitude: 11.584803,
},
products: {
nationalExpress: false,
@@ -956,9 +956,9 @@ const dbJourney = {
ferry: false,
subway: true,
tram: false,
- taxi: false
- }
- }
+ taxi: false,
+ },
+ },
},
arrival: '2020-11-16T10:30:00+01:00',
plannedArrival: '2020-11-16T10:30:00+01:00',
@@ -982,7 +982,7 @@ const dbJourney = {
type: 'location',
id: '624950',
latitude: 48.161839,
- longitude: 11.586331
+ longitude: 11.586331,
},
products: {
nationalExpress: false,
@@ -994,8 +994,8 @@ const dbJourney = {
ferry: false,
subway: true,
tram: true,
- taxi: false
- }
+ taxi: false,
+ },
},
arrival: '2020-11-16T10:31:00+01:00',
plannedArrival: '2020-11-16T10:31:00+01:00',
@@ -1019,7 +1019,7 @@ const dbJourney = {
type: 'location',
id: '624333',
latitude: 48.166702,
- longitude: 11.578151
+ longitude: 11.578151,
},
products: {
nationalExpress: false,
@@ -1031,7 +1031,7 @@ const dbJourney = {
ferry: false,
subway: true,
tram: false,
- taxi: false
+ taxi: false,
},
station: {
type: 'station',
@@ -1041,7 +1041,7 @@ const dbJourney = {
type: 'location',
id: '790754',
latitude: 48.167035,
- longitude: 11.579347
+ longitude: 11.579347,
},
products: {
nationalExpress: false,
@@ -1053,9 +1053,9 @@ const dbJourney = {
ferry: false,
subway: true,
tram: false,
- taxi: false
- }
- }
+ taxi: false,
+ },
+ },
},
arrival: '2020-11-16T10:33:00+01:00',
plannedArrival: '2020-11-16T10:33:00+01:00',
@@ -1069,9 +1069,9 @@ const dbJourney = {
departurePlatform: null,
plannedDeparturePlatform: null,
departurePrognosisType: null,
- }
+ },
],
- cycle: {min: 600, max: 600, nr: 13}
+ cycle: {min: 600, max: 600, nr: 13},
},
{
origin: {
@@ -1082,7 +1082,7 @@ const dbJourney = {
type: 'location',
id: '624333',
latitude: 48.166702,
- longitude: 11.578151
+ longitude: 11.578151,
},
products: {
nationalExpress: false,
@@ -1094,7 +1094,7 @@ const dbJourney = {
ferry: false,
subway: true,
tram: false,
- taxi: false
+ taxi: false,
},
station: {
type: 'station',
@@ -1104,7 +1104,7 @@ const dbJourney = {
type: 'location',
id: '790754',
latitude: 48.167035,
- longitude: 11.579347
+ longitude: 11.579347,
},
products: {
nationalExpress: false,
@@ -1116,9 +1116,9 @@ const dbJourney = {
ferry: false,
subway: true,
tram: false,
- taxi: false
- }
- }
+ taxi: false,
+ },
+ },
},
destination: {
type: 'station',
@@ -1128,7 +1128,7 @@ const dbJourney = {
type: 'location',
id: '621790',
latitude: 48.166918,
- longitude: 11.574043
+ longitude: 11.574043,
},
products: {
nationalExpress: false,
@@ -1140,8 +1140,8 @@ const dbJourney = {
ferry: false,
subway: false,
tram: true,
- taxi: false
- }
+ taxi: false,
+ },
},
departure: '2020-11-16T10:33:00+01:00',
plannedDeparture: '2020-11-16T10:33:00+01:00',
@@ -1151,14 +1151,14 @@ const dbJourney = {
arrivalDelay: null,
public: true,
walking: true,
- distance: 353
- }
+ distance: 353,
+ },
],
refreshToken: '¶HKI¶T$A=1@O=München-Mittersendling@L=8004154@a=128@$A=1@O=München Siemenswerke@L=8004137@a=128@$202011161004$202011161005$S 7$$1$$$§W$A=1@O=München Siemenswerke@L=8004137@a=128@$A=1@O=Obersendling, München@L=625016@a=128@$202011161005$202011161015$$$1$$$§T$A=1@O=Obersendling, München@L=625016@a=128@$A=1@O=Bonner Platz, München@L=624333@a=128@$202011161015$202011161033$U 3$$1$$$§G@F$A=1@O=Bonner Platz, München@L=624333@a=128@$A=1@O=Karl-Theodor-Straße, München@L=621790@a=128@$202011161033$202011161038$$$1$$$¶GP¶ft@0@2000@120@1@100@1@1000@0@@@@@false@0@-1@$f@$f@$f@$f@$f@$§bt@0@2000@120@1@100@1@1000@0@@@@@false@0@-1@$f@$f@$f@$f@$f@$§tt@0@5000@120@1@100@1@2500@0@@@@@false@0@-1@$t@0@25000@120@1@100@1@3000@0@@@@@false@0@-1@$f@$f@$f@$f@$§',
cycle: {min: 1200},
- price: null
-}
+ price: null,
+};
export {
dbJourney,
-}
+};
diff --git a/test/fixtures/db-journey-overnight-1.expected.js b/test/fixtures/db-journey-overnight-1.expected.js
index 42a026b5..7402ed5d 100644
--- a/test/fixtures/db-journey-overnight-1.expected.js
+++ b/test/fixtures/db-journey-overnight-1.expected.js
@@ -6,7 +6,7 @@ const büchen = {
type: 'location',
id: '8000058',
latitude: 53.475291,
- longitude: 10.622939
+ longitude: 10.622939,
},
products: {
nationalExpress: true,
@@ -20,7 +20,7 @@ const büchen = {
tram: false,
taxi: true,
},
-}
+};
const berlinHbfTief = {
type: 'stop',
@@ -30,7 +30,7 @@ const berlinHbfTief = {
type: 'location',
id: '8098160',
latitude: 52.52585,
- longitude: 13.368892
+ longitude: 13.368892,
},
products: {
nationalExpress: true,
@@ -52,7 +52,7 @@ const berlinHbfTief = {
type: 'location',
id: '8011160',
latitude: 52.524924,
- longitude: 13.369629
+ longitude: 13.369629,
},
products: {
nationalExpress: true,
@@ -67,7 +67,7 @@ const berlinHbfTief = {
taxi: false,
},
},
-}
+};
const overnightJourney = {
type: 'journey',
@@ -83,7 +83,7 @@ const overnightJourney = {
type: 'location',
id: '8000237',
latitude: 53.86767,
- longitude: 10.669737
+ longitude: 10.669737,
},
products: {
nationalExpress: true,
@@ -160,7 +160,7 @@ const overnightJourney = {
code: 'SM',
text: 'Info www.bahn.de/sh-barrierefrei',
},
- ]
+ ],
},
{
origin: büchen,
@@ -222,7 +222,7 @@ const overnightJourney = {
type: 'location',
id: '8000261',
latitude: 48.140364,
- longitude: 11.558744
+ longitude: 11.558744,
},
products: {
nationalExpress: true,
@@ -306,8 +306,8 @@ const overnightJourney = {
remarks: [],
price: {amount: 108.9, currency: 'EUR', hint: null},
-}
+};
export {
overnightJourney,
-}
+};
diff --git a/test/fixtures/db-journey-polyline.js b/test/fixtures/db-journey-polyline.js
index 75f063c4..236ac6c2 100644
--- a/test/fixtures/db-journey-polyline.js
+++ b/test/fixtures/db-journey-polyline.js
@@ -10,7 +10,7 @@ const dbJourneyPolyline = {
type: 'location',
id: '8098160',
latitude: 52.52585,
- longitude: 13.368892
+ longitude: 13.368892,
},
products: {
nationalExpress: true,
@@ -22,7 +22,7 @@ const dbJourneyPolyline = {
ferry: false,
subway: false,
tram: true,
- taxi: false
+ taxi: false,
},
station: {
type: 'station',
@@ -32,7 +32,7 @@ const dbJourneyPolyline = {
type: 'location',
id: '8011160',
latitude: 52.524924,
- longitude: 13.369629
+ longitude: 13.369629,
},
products: {
nationalExpress: true,
@@ -44,9 +44,9 @@ const dbJourneyPolyline = {
ferry: false,
subway: false,
tram: true,
- taxi: false
- }
- }
+ taxi: false,
+ },
+ },
},
destination: {
type: 'stop',
@@ -56,7 +56,7 @@ const dbJourneyPolyline = {
type: 'location',
id: '8002549',
latitude: 53.553533,
- longitude: 10.00636
+ longitude: 10.00636,
},
products: {
nationalExpress: true,
@@ -68,8 +68,8 @@ const dbJourneyPolyline = {
ferry: false,
subway: true,
tram: false,
- taxi: false
- }
+ taxi: false,
+ },
},
arrival: '2020-07-27T12:34:00+02:00',
plannedArrival: '2020-07-27T12:34:00+02:00',
@@ -93,7 +93,7 @@ const dbJourneyPolyline = {
type: 'location',
id: '8098160',
latitude: 52.52585,
- longitude: 13.368892
+ longitude: 13.368892,
},
products: {
nationalExpress: true,
@@ -105,7 +105,7 @@ const dbJourneyPolyline = {
ferry: false,
subway: false,
tram: true,
- taxi: false
+ taxi: false,
},
station: {
type: 'station',
@@ -115,7 +115,7 @@ const dbJourneyPolyline = {
type: 'location',
id: '8011160',
latitude: 52.524924,
- longitude: 13.369629
+ longitude: 13.369629,
},
products: {
nationalExpress: true,
@@ -127,14 +127,14 @@ const dbJourneyPolyline = {
ferry: false,
subway: false,
tram: true,
- taxi: false
- }
- }
+ taxi: false,
+ },
+ },
},
geometry: {
type: 'Point',
coordinates: [13.36889, 52.52585],
- }
+ },
},
{
type: 'Feature',
@@ -142,7 +142,7 @@ const dbJourneyPolyline = {
geometry: {
type: 'Point',
coordinates: [13.36723, 52.52811],
- }
+ },
},
{
type: 'Feature',
@@ -150,7 +150,7 @@ const dbJourneyPolyline = {
geometry: {
type: 'Point',
coordinates: [13.36567, 52.52968],
- }
+ },
},
{
type: 'Feature',
@@ -158,7 +158,7 @@ const dbJourneyPolyline = {
geometry: {
type: 'Point',
coordinates: [13.36647, 52.53],
- }
+ },
},
{
type: 'Feature',
@@ -166,7 +166,7 @@ const dbJourneyPolyline = {
geometry: {
type: 'Point',
coordinates: [13.36647, 52.53],
- }
+ },
},
{
type: 'Feature',
@@ -174,7 +174,7 @@ const dbJourneyPolyline = {
geometry: {
type: 'Point',
coordinates: [13.36511, 52.53106],
- }
+ },
},
{
type: 'Feature',
@@ -182,7 +182,7 @@ const dbJourneyPolyline = {
geometry: {
type: 'Point',
coordinates: [13.36241, 52.53358],
- }
+ },
},
{
type: 'Feature',
@@ -190,7 +190,7 @@ const dbJourneyPolyline = {
geometry: {
type: 'Point',
coordinates: [13.36241, 52.53358],
- }
+ },
},
{
type: 'Feature',
@@ -198,7 +198,7 @@ const dbJourneyPolyline = {
geometry: {
type: 'Point',
coordinates: [13.36187, 52.53337],
- }
+ },
},
{
type: 'Feature',
@@ -206,7 +206,7 @@ const dbJourneyPolyline = {
geometry: {
type: 'Point',
coordinates: [13.36069, 52.53447],
- }
+ },
},
{
type: 'Feature',
@@ -214,7 +214,7 @@ const dbJourneyPolyline = {
geometry: {
type: 'Point',
coordinates: [13.3594, 52.53563],
- }
+ },
},
{
type: 'Feature',
@@ -222,7 +222,7 @@ const dbJourneyPolyline = {
geometry: {
type: 'Point',
coordinates: [13.35859, 52.53615],
- }
+ },
},
{
type: 'Feature',
@@ -230,7 +230,7 @@ const dbJourneyPolyline = {
geometry: {
type: 'Point',
coordinates: [13.35776, 52.53652],
- }
+ },
},
{
type: 'Feature',
@@ -238,7 +238,7 @@ const dbJourneyPolyline = {
geometry: {
type: 'Point',
coordinates: [13.35622, 52.53692],
- }
+ },
},
{
type: 'Feature',
@@ -246,7 +246,7 @@ const dbJourneyPolyline = {
geometry: {
type: 'Point',
coordinates: [13.3562, 52.53687],
- }
+ },
},
{
type: 'Feature',
@@ -254,7 +254,7 @@ const dbJourneyPolyline = {
geometry: {
type: 'Point',
coordinates: [13.35618, 52.53683],
- }
+ },
},
{
type: 'Feature',
@@ -262,7 +262,7 @@ const dbJourneyPolyline = {
geometry: {
type: 'Point',
coordinates: [13.35491, 52.53697],
- }
+ },
},
{
type: 'Feature',
@@ -270,7 +270,7 @@ const dbJourneyPolyline = {
geometry: {
type: 'Point',
coordinates: [13.3536, 52.53697],
- }
+ },
},
{
type: 'Feature',
@@ -278,7 +278,7 @@ const dbJourneyPolyline = {
geometry: {
type: 'Point',
coordinates: [13.35117, 52.53673],
- }
+ },
},
{
type: 'Feature',
@@ -286,7 +286,7 @@ const dbJourneyPolyline = {
geometry: {
type: 'Point',
coordinates: [13.3511, 52.53698],
- }
+ },
},
{
type: 'Feature',
@@ -294,7 +294,7 @@ const dbJourneyPolyline = {
geometry: {
type: 'Point',
coordinates: [13.3511, 52.53698],
- }
+ },
},
{
type: 'Feature',
@@ -302,7 +302,7 @@ const dbJourneyPolyline = {
geometry: {
type: 'Point',
coordinates: [13.34762, 52.53649],
- }
+ },
},
{
type: 'Feature',
@@ -310,7 +310,7 @@ const dbJourneyPolyline = {
geometry: {
type: 'Point',
coordinates: [13.34425, 52.53613],
- }
+ },
},
{
type: 'Feature',
@@ -318,7 +318,7 @@ const dbJourneyPolyline = {
geometry: {
type: 'Point',
coordinates: [13.34425, 52.53613],
- }
+ },
},
{
type: 'Feature',
@@ -326,7 +326,7 @@ const dbJourneyPolyline = {
geometry: {
type: 'Point',
coordinates: [13.34144, 52.53573],
- }
+ },
},
{
type: 'Feature',
@@ -334,7 +334,7 @@ const dbJourneyPolyline = {
geometry: {
type: 'Point',
coordinates: [13.33938, 52.53549],
- }
+ },
},
{
type: 'Feature',
@@ -342,7 +342,7 @@ const dbJourneyPolyline = {
geometry: {
type: 'Point',
coordinates: [13.33942, 52.53536],
- }
+ },
},
{
type: 'Feature',
@@ -350,7 +350,7 @@ const dbJourneyPolyline = {
geometry: {
type: 'Point',
coordinates: [13.33938, 52.53549],
- }
+ },
},
{
type: 'Feature',
@@ -358,7 +358,7 @@ const dbJourneyPolyline = {
geometry: {
type: 'Point',
coordinates: [13.33459, 52.5349],
- }
+ },
},
{
type: 'Feature',
@@ -366,7 +366,7 @@ const dbJourneyPolyline = {
geometry: {
type: 'Point',
coordinates: [13.33456, 52.535],
- }
+ },
},
{
type: 'Feature',
@@ -374,7 +374,7 @@ const dbJourneyPolyline = {
geometry: {
type: 'Point',
coordinates: [13.33459, 52.5349],
- }
+ },
},
{
type: 'Feature',
@@ -382,7 +382,7 @@ const dbJourneyPolyline = {
geometry: {
type: 'Point',
coordinates: [13.32921, 52.53425],
- }
+ },
},
{
type: 'Feature',
@@ -390,7 +390,7 @@ const dbJourneyPolyline = {
geometry: {
type: 'Point',
coordinates: [13.32921, 52.53425],
- }
+ },
},
{
type: 'Feature',
@@ -398,7 +398,7 @@ const dbJourneyPolyline = {
geometry: {
type: 'Point',
coordinates: [13.32857, 52.53417],
- }
+ },
},
{
type: 'Feature',
@@ -406,7 +406,7 @@ const dbJourneyPolyline = {
geometry: {
type: 'Point',
coordinates: [13.32858, 52.53414],
- }
+ },
},
{
type: 'Feature',
@@ -414,7 +414,7 @@ const dbJourneyPolyline = {
geometry: {
type: 'Point',
coordinates: [13.32853, 52.53426],
- }
+ },
},
{
type: 'Feature',
@@ -422,7 +422,7 @@ const dbJourneyPolyline = {
geometry: {
type: 'Point',
coordinates: [13.3078, 52.53144],
- }
+ },
},
{
type: 'Feature',
@@ -430,7 +430,7 @@ const dbJourneyPolyline = {
geometry: {
type: 'Point',
coordinates: [13.29942, 52.53041],
- }
+ },
},
{
type: 'Feature',
@@ -438,7 +438,7 @@ const dbJourneyPolyline = {
geometry: {
type: 'Point',
coordinates: [13.29942, 52.53041],
- }
+ },
},
{
type: 'Feature',
@@ -446,7 +446,7 @@ const dbJourneyPolyline = {
geometry: {
type: 'Point',
coordinates: [13.29941, 52.5304],
- }
+ },
},
{
type: 'Feature',
@@ -454,7 +454,7 @@ const dbJourneyPolyline = {
geometry: {
type: 'Point',
coordinates: [13.29945, 52.53029],
- }
+ },
},
{
type: 'Feature',
@@ -462,7 +462,7 @@ const dbJourneyPolyline = {
geometry: {
type: 'Point',
coordinates: [13.293, 52.52939],
- }
+ },
},
{
type: 'Feature',
@@ -470,7 +470,7 @@ const dbJourneyPolyline = {
geometry: {
type: 'Point',
coordinates: [13.29009, 52.52909],
- }
+ },
},
{
type: 'Feature',
@@ -478,7 +478,7 @@ const dbJourneyPolyline = {
geometry: {
type: 'Point',
coordinates: [13.25551, 52.52694],
- }
+ },
},
{
type: 'Feature',
@@ -486,7 +486,7 @@ const dbJourneyPolyline = {
geometry: {
type: 'Point',
coordinates: [13.25551, 52.5269],
- }
+ },
},
{
type: 'Feature',
@@ -494,7 +494,7 @@ const dbJourneyPolyline = {
geometry: {
type: 'Point',
coordinates: [13.25552, 52.52687],
- }
+ },
},
{
type: 'Feature',
@@ -502,7 +502,7 @@ const dbJourneyPolyline = {
geometry: {
type: 'Point',
coordinates: [13.24855, 52.52647],
- }
+ },
},
{
type: 'Feature',
@@ -510,7 +510,7 @@ const dbJourneyPolyline = {
geometry: {
type: 'Point',
coordinates: [13.24344, 52.52654],
- }
+ },
},
{
type: 'Feature',
@@ -518,7 +518,7 @@ const dbJourneyPolyline = {
geometry: {
type: 'Point',
coordinates: [13.24088, 52.52693],
- }
+ },
},
{
type: 'Feature',
@@ -526,7 +526,7 @@ const dbJourneyPolyline = {
geometry: {
type: 'Point',
coordinates: [13.23554, 52.52845],
- }
+ },
},
{
type: 'Feature',
@@ -534,7 +534,7 @@ const dbJourneyPolyline = {
geometry: {
type: 'Point',
coordinates: [13.2312, 52.52902],
- }
+ },
},
{
type: 'Feature',
@@ -542,7 +542,7 @@ const dbJourneyPolyline = {
geometry: {
type: 'Point',
coordinates: [13.23123, 52.52913],
- }
+ },
},
{
type: 'Feature',
@@ -550,7 +550,7 @@ const dbJourneyPolyline = {
geometry: {
type: 'Point',
coordinates: [13.23048, 52.52914],
- }
+ },
},
{
type: 'Feature',
@@ -558,7 +558,7 @@ const dbJourneyPolyline = {
geometry: {
type: 'Point',
coordinates: [13.22399, 52.52981],
- }
+ },
},
{
type: 'Feature',
@@ -566,7 +566,7 @@ const dbJourneyPolyline = {
geometry: {
type: 'Point',
coordinates: [13.22397, 52.52975],
- }
+ },
},
{
type: 'Feature',
@@ -574,7 +574,7 @@ const dbJourneyPolyline = {
geometry: {
type: 'Point',
coordinates: [13.22397, 52.52975],
- }
+ },
},
{
type: 'Feature',
@@ -582,7 +582,7 @@ const dbJourneyPolyline = {
geometry: {
type: 'Point',
coordinates: [13.21369, 52.5311],
- }
+ },
},
{
type: 'Feature',
@@ -590,7 +590,7 @@ const dbJourneyPolyline = {
geometry: {
type: 'Point',
coordinates: [13.21371, 52.53118],
- }
+ },
},
{
type: 'Feature',
@@ -598,7 +598,7 @@ const dbJourneyPolyline = {
geometry: {
type: 'Point',
coordinates: [13.2137, 52.53117],
- }
+ },
},
{
type: 'Feature',
@@ -606,7 +606,7 @@ const dbJourneyPolyline = {
geometry: {
type: 'Point',
coordinates: [13.20948, 52.53171],
- }
+ },
},
{
type: 'Feature',
@@ -614,7 +614,7 @@ const dbJourneyPolyline = {
geometry: {
type: 'Point',
coordinates: [13.20956, 52.53196],
- }
+ },
},
{
type: 'Feature',
@@ -622,7 +622,7 @@ const dbJourneyPolyline = {
geometry: {
type: 'Point',
coordinates: [13.20595, 52.53255],
- }
+ },
},
{
type: 'Feature',
@@ -630,7 +630,7 @@ const dbJourneyPolyline = {
geometry: {
type: 'Point',
coordinates: [13.20114, 52.53401],
- }
+ },
},
{
type: 'Feature',
@@ -638,7 +638,7 @@ const dbJourneyPolyline = {
geometry: {
type: 'Point',
coordinates: [13.20095, 52.5338],
- }
+ },
},
{
type: 'Feature',
@@ -646,7 +646,7 @@ const dbJourneyPolyline = {
geometry: {
type: 'Point',
coordinates: [13.1984, 52.53437],
- }
+ },
},
{
type: 'Feature',
@@ -654,7 +654,7 @@ const dbJourneyPolyline = {
geometry: {
type: 'Point',
coordinates: [13.19848, 52.53451],
- }
+ },
},
{
type: 'Feature',
@@ -662,7 +662,7 @@ const dbJourneyPolyline = {
geometry: {
type: 'Point',
coordinates: [13.19478, 52.53514],
- }
+ },
},
{
type: 'Feature',
@@ -670,7 +670,7 @@ const dbJourneyPolyline = {
geometry: {
type: 'Point',
coordinates: [13.18783, 52.53615],
- }
+ },
},
{
type: 'Feature',
@@ -678,7 +678,7 @@ const dbJourneyPolyline = {
geometry: {
type: 'Point',
coordinates: [13.18763, 52.53573],
- }
+ },
},
{
type: 'Feature',
@@ -686,7 +686,7 @@ const dbJourneyPolyline = {
geometry: {
type: 'Point',
coordinates: [13.18778, 52.53606],
- }
+ },
},
{
type: 'Feature',
@@ -694,7 +694,7 @@ const dbJourneyPolyline = {
geometry: {
type: 'Point',
coordinates: [13.18523, 52.53648],
- }
+ },
},
{
type: 'Feature',
@@ -702,7 +702,7 @@ const dbJourneyPolyline = {
geometry: {
type: 'Point',
coordinates: [13.18524, 52.5365],
- }
+ },
},
{
type: 'Feature',
@@ -710,7 +710,7 @@ const dbJourneyPolyline = {
geometry: {
type: 'Point',
coordinates: [13.18523, 52.53648],
- }
+ },
},
{
type: 'Feature',
@@ -718,7 +718,7 @@ const dbJourneyPolyline = {
geometry: {
type: 'Point',
coordinates: [13.17109, 52.53875],
- }
+ },
},
{
type: 'Feature',
@@ -726,3257 +726,3257 @@ const dbJourneyPolyline = {
geometry: {
type: 'Point',
coordinates: [13.16593, 52.53992],
- }
- },
- {
- 'type': 'Feature',
- 'properties': {},
- 'geometry': {
- 'type': 'Point',
- 'coordinates': [13.1607, 52.54117],
- }
- },
- {
- 'type': 'Feature',
- 'properties': {},
- 'geometry': {
- 'type': 'Point',
- 'coordinates': [13.1276, 52.54975],
- }
- },
- {
- 'type': 'Feature',
- 'properties': {},
- 'geometry': {
- 'type': 'Point',
- 'coordinates': [13.1276, 52.54975],
- }
- },
- {
- 'type': 'Feature',
- 'properties': {},
- 'geometry': {
- 'type': 'Point',
- 'coordinates': [13.12921, 52.54933],
- }
- },
- {
- 'type': 'Feature',
- 'properties': {},
- 'geometry': {
- 'type': 'Point',
- 'coordinates': [13.12921, 52.54933],
- }
- },
- {
- 'type': 'Feature',
- 'properties': {},
- 'geometry': {
- 'type': 'Point',
- 'coordinates': [13.11701, 52.55246],
- }
- },
- {
- 'type': 'Feature',
- 'properties': {},
- 'geometry': {
- 'type': 'Point',
- 'coordinates': [13.11701, 52.55246],
- }
- },
- {
- 'type': 'Feature',
- 'properties': {},
- 'geometry': {
- 'type': 'Point',
- 'coordinates': [13.10514, 52.55567],
- }
- },
- {
- 'type': 'Feature',
- 'properties': {},
- 'geometry': {
- 'type': 'Point',
- 'coordinates': [13.08924, 52.5598],
- }
- },
- {
- 'type': 'Feature',
- 'properties': {},
- 'geometry': {
- 'type': 'Point',
- 'coordinates': [13.08924, 52.5598],
- }
- },
- {
- 'type': 'Feature',
- 'properties': {},
- 'geometry': {
- 'type': 'Point',
- 'coordinates': [13.05095, 52.56974],
- }
- },
- {
- 'type': 'Feature',
- 'properties': {},
- 'geometry': {
- 'type': 'Point',
- 'coordinates': [13.05095, 52.56974],
- }
- },
- {
- 'type': 'Feature',
- 'properties': {},
- 'geometry': {
- 'type': 'Point',
- 'coordinates': [13.03193, 52.57466],
- }
- },
- {
- 'type': 'Feature',
- 'properties': {},
- 'geometry': {
- 'type': 'Point',
- 'coordinates': [13.03193, 52.57466],
- }
- },
- {
- 'type': 'Feature',
- 'properties': {},
- 'geometry': {
- 'type': 'Point',
- 'coordinates': [13.03193, 52.57466],
- }
- },
- {
- 'type': 'Feature',
- 'properties': {},
- 'geometry': {
- 'type': 'Point',
- 'coordinates': [13.03193, 52.57466],
- }
- },
- {
- 'type': 'Feature',
- 'properties': {},
- 'geometry': {
- 'type': 'Point',
- 'coordinates': [13.00885, 52.58066],
- }
- },
- {
- 'type': 'Feature',
- 'properties': {},
- 'geometry': {
- 'type': 'Point',
- 'coordinates': [12.99998, 52.58292],
- }
- },
- {
- 'type': 'Feature',
- 'properties': {},
- 'geometry': {
- 'type': 'Point',
- 'coordinates': [12.99998, 52.58292],
- }
- },
- {
- 'type': 'Feature',
- 'properties': {},
- 'geometry': {
- 'type': 'Point',
- 'coordinates': [12.98704, 52.58622],
- }
- },
- {
- 'type': 'Feature',
- 'properties': {},
- 'geometry': {
- 'type': 'Point',
- 'coordinates': [12.97895, 52.58845],
- }
- },
- {
- 'type': 'Feature',
- 'properties': {},
- 'geometry': {
- 'type': 'Point',
- 'coordinates': [12.93546, 52.59969],
- }
- },
- {
- 'type': 'Feature',
- 'properties': {},
- 'geometry': {
- 'type': 'Point',
- 'coordinates': [12.92199, 52.60329],
- }
- },
- {
- 'type': 'Feature',
- 'properties': {},
- 'geometry': {
- 'type': 'Point',
- 'coordinates': [12.90683, 52.60719],
- }
- },
- {
- 'type': 'Feature',
- 'properties': {},
- 'geometry': {
- 'type': 'Point',
- 'coordinates': [12.89792, 52.60938],
- }
- },
- {
- 'type': 'Feature',
- 'properties': {},
- 'geometry': {
- 'type': 'Point',
- 'coordinates': [12.8856, 52.61272],
- }
- },
- {
- 'type': 'Feature',
- 'properties': {},
- 'geometry': {
- 'type': 'Point',
- 'coordinates': [12.8856, 52.61272],
- }
- },
- {
- 'type': 'Feature',
- 'properties': {},
- 'geometry': {
- 'type': 'Point',
- 'coordinates': [12.87943, 52.61423],
- }
- },
- {
- 'type': 'Feature',
- 'properties': {},
- 'geometry': {
- 'type': 'Point',
- 'coordinates': [12.87436, 52.61571],
- }
- },
- {
- 'type': 'Feature',
- 'properties': {},
- 'geometry': {
- 'type': 'Point',
- 'coordinates': [12.8491, 52.62502],
- }
- },
- {
- 'type': 'Feature',
- 'properties': {},
- 'geometry': {
- 'type': 'Point',
- 'coordinates': [12.8491, 52.62502],
- }
- },
- {
- 'type': 'Feature',
- 'properties': {},
- 'geometry': {
- 'type': 'Point',
- 'coordinates': [12.74165, 52.66478],
- }
- },
- {
- 'type': 'Feature',
- 'properties': {},
- 'geometry': {
- 'type': 'Point',
- 'coordinates': [12.74165, 52.66478],
- }
- },
- {
- 'type': 'Feature',
- 'properties': {},
- 'geometry': {
- 'type': 'Point',
- 'coordinates': [12.72018, 52.67271],
- }
- },
- {
- 'type': 'Feature',
- 'properties': {},
- 'geometry': {
- 'type': 'Point',
- 'coordinates': [12.71653, 52.67424],
- }
- },
- {
- 'type': 'Feature',
- 'properties': {},
- 'geometry': {
- 'type': 'Point',
- 'coordinates': [12.71322, 52.67589],
- }
- },
- {
- 'type': 'Feature',
- 'properties': {},
- 'geometry': {
- 'type': 'Point',
- 'coordinates': [12.71322, 52.67589],
- }
- },
- {
- 'type': 'Feature',
- 'properties': {},
- 'geometry': {
- 'type': 'Point',
- 'coordinates': [12.71042, 52.6775],
- }
- },
- {
- 'type': 'Feature',
- 'properties': {},
- 'geometry': {
- 'type': 'Point',
- 'coordinates': [12.70791, 52.67915],
- }
- },
- {
- 'type': 'Feature',
- 'properties': {},
- 'geometry': {
- 'type': 'Point',
- 'coordinates': [12.63245, 52.73031],
- }
- },
- {
- 'type': 'Feature',
- 'properties': {},
- 'geometry': {
- 'type': 'Point',
- 'coordinates': [12.63245, 52.73031],
- }
- },
- {
- 'type': 'Feature',
- 'properties': {},
- 'geometry': {
- 'type': 'Point',
- 'coordinates': [12.5876, 52.76064],
- }
- },
- {
- 'type': 'Feature',
- 'properties': {},
- 'geometry': {
- 'type': 'Point',
- 'coordinates': [12.5876, 52.76064],
- }
- },
- {
- 'type': 'Feature',
- 'properties': {},
- 'geometry': {
- 'type': 'Point',
- 'coordinates': [12.4592, 52.84705],
- }
- },
- {
- 'type': 'Feature',
- 'properties': {},
- 'geometry': {
- 'type': 'Point',
- 'coordinates': [12.4592, 52.84705],
- }
- },
- {
- 'type': 'Feature',
- 'properties': {},
- 'geometry': {
- 'type': 'Point',
- 'coordinates': [12.45274, 52.85141],
- }
- },
- {
- 'type': 'Feature',
- 'properties': {},
- 'geometry': {
- 'type': 'Point',
- 'coordinates': [12.45091, 52.85264],
- }
- },
- {
- 'type': 'Feature',
- 'properties': {},
- 'geometry': {
- 'type': 'Point',
- 'coordinates': [12.45105, 52.85272],
- }
- },
- {
- 'type': 'Feature',
- 'properties': {},
- 'geometry': {
- 'type': 'Point',
- 'coordinates': [12.444, 52.85746],
- }
- },
- {
- 'type': 'Feature',
- 'properties': {},
- 'geometry': {
- 'type': 'Point',
- 'coordinates': [12.444, 52.85746],
- }
- },
- {
- 'type': 'Feature',
- 'properties': {},
- 'geometry': {
- 'type': 'Point',
- 'coordinates': [12.44385, 52.85737],
- }
- },
- {
- 'type': 'Feature',
- 'properties': {},
- 'geometry': {
- 'type': 'Point',
- 'coordinates': [12.43328, 52.86438],
- }
- },
- {
- 'type': 'Feature',
- 'properties': {},
- 'geometry': {
- 'type': 'Point',
- 'coordinates': [12.43169, 52.8652],
- }
- },
- {
- 'type': 'Feature',
- 'properties': {},
- 'geometry': {
- 'type': 'Point',
- 'coordinates': [12.42889, 52.8663],
- }
- },
- {
- 'type': 'Feature',
- 'properties': {},
- 'geometry': {
- 'type': 'Point',
- 'coordinates': [12.35027, 52.8916],
- }
- },
- {
- 'type': 'Feature',
- 'properties': {},
- 'geometry': {
- 'type': 'Point',
- 'coordinates': [12.34689, 52.89253],
- }
- },
- {
- 'type': 'Feature',
- 'properties': {},
- 'geometry': {
- 'type': 'Point',
- 'coordinates': [12.34334, 52.89319],
- }
- },
- {
- 'type': 'Feature',
- 'properties': {},
- 'geometry': {
- 'type': 'Point',
- 'coordinates': [12.33967, 52.89354],
- }
- },
- {
- 'type': 'Feature',
- 'properties': {},
- 'geometry': {
- 'type': 'Point',
- 'coordinates': [12.33596, 52.89359],
- }
- },
- {
- 'type': 'Feature',
- 'properties': {},
- 'geometry': {
- 'type': 'Point',
- 'coordinates': [12.28484, 52.89139],
- }
- },
- {
- 'type': 'Feature',
- 'properties': {},
- 'geometry': {
- 'type': 'Point',
- 'coordinates': [12.27896, 52.89088],
- }
- },
- {
- 'type': 'Feature',
- 'properties': {},
- 'geometry': {
- 'type': 'Point',
- 'coordinates': [12.23634, 52.88631],
- }
- },
- {
- 'type': 'Feature',
- 'properties': {},
- 'geometry': {
- 'type': 'Point',
- 'coordinates': [12.23043, 52.88599],
- }
- },
- {
- 'type': 'Feature',
- 'properties': {},
- 'geometry': {
- 'type': 'Point',
- 'coordinates': [12.22745, 52.88598],
- }
- },
- {
- 'type': 'Feature',
- 'properties': {},
- 'geometry': {
- 'type': 'Point',
- 'coordinates': [12.2242, 52.88609],
- }
- },
- {
- 'type': 'Feature',
- 'properties': {},
- 'geometry': {
- 'type': 'Point',
- 'coordinates': [12.2242, 52.88609],
- }
- },
- {
- 'type': 'Feature',
- 'properties': {},
- 'geometry': {
- 'type': 'Point',
- 'coordinates': [12.1491, 52.8907],
- }
- },
- {
- 'type': 'Feature',
- 'properties': {},
- 'geometry': {
- 'type': 'Point',
- 'coordinates': [12.14468, 52.89103],
- }
- },
- {
- 'type': 'Feature',
- 'properties': {},
- 'geometry': {
- 'type': 'Point',
- 'coordinates': [12.14177, 52.89137],
- }
- },
- {
- 'type': 'Feature',
- 'properties': {},
- 'geometry': {
- 'type': 'Point',
- 'coordinates': [12.13605, 52.89234],
- }
- },
- {
- 'type': 'Feature',
- 'properties': {},
- 'geometry': {
- 'type': 'Point',
- 'coordinates': [12.08388, 52.90351],
- }
- },
- {
- 'type': 'Feature',
- 'properties': {},
- 'geometry': {
- 'type': 'Point',
- 'coordinates': [12.08388, 52.90351],
- }
- },
- {
- 'type': 'Feature',
- 'properties': {},
- 'geometry': {
- 'type': 'Point',
- 'coordinates': [12.07726, 52.90534],
- }
- },
- {
- 'type': 'Feature',
- 'properties': {},
- 'geometry': {
- 'type': 'Point',
- 'coordinates': [12.07278, 52.90694],
- }
- },
- {
- 'type': 'Feature',
- 'properties': {},
- 'geometry': {
- 'type': 'Point',
- 'coordinates': [11.94977, 52.96001],
- }
- },
- {
- 'type': 'Feature',
- 'properties': {},
- 'geometry': {
- 'type': 'Point',
- 'coordinates': [11.94977, 52.96001],
- }
- },
- {
- 'type': 'Feature',
- 'properties': {},
- 'geometry': {
- 'type': 'Point',
- 'coordinates': [11.94245, 52.96311],
- }
- },
- {
- 'type': 'Feature',
- 'properties': {},
- 'geometry': {
- 'type': 'Point',
- 'coordinates': [11.93223, 52.96679],
- }
- },
- {
- 'type': 'Feature',
- 'properties': {},
- 'geometry': {
- 'type': 'Point',
- 'coordinates': [11.92961, 52.96765],
- }
- },
- {
- 'type': 'Feature',
- 'properties': {},
- 'geometry': {
- 'type': 'Point',
- 'coordinates': [11.87325, 52.98405],
- }
- },
- {
- 'type': 'Feature',
- 'properties': {},
- 'geometry': {
- 'type': 'Point',
- 'coordinates': [11.86103, 52.98751],
- }
- },
- {
- 'type': 'Feature',
- 'properties': {},
- 'geometry': {
- 'type': 'Point',
- 'coordinates': [11.8575, 52.98835],
- }
- },
- {
- 'type': 'Feature',
- 'properties': {},
- 'geometry': {
- 'type': 'Point',
- 'coordinates': [11.85282, 52.98905],
- }
- },
- {
- 'type': 'Feature',
- 'properties': {},
- 'geometry': {
- 'type': 'Point',
- 'coordinates': [11.84214, 52.98976],
- }
- },
- {
- 'type': 'Feature',
- 'properties': {},
- 'geometry': {
- 'type': 'Point',
- 'coordinates': [11.78825, 52.99283],
- }
- },
- {
- 'type': 'Feature',
- 'properties': {},
- 'geometry': {
- 'type': 'Point',
- 'coordinates': [11.78481, 52.99297],
- }
- },
- {
- 'type': 'Feature',
- 'properties': {},
- 'geometry': {
- 'type': 'Point',
- 'coordinates': [11.77866, 52.9929],
- }
- },
- {
- 'type': 'Feature',
- 'properties': {},
- 'geometry': {
- 'type': 'Point',
- 'coordinates': [11.77654, 52.99306],
- }
- },
- {
- 'type': 'Feature',
- 'properties': {},
- 'geometry': {
- 'type': 'Point',
- 'coordinates': [11.77667, 52.99344],
- }
- },
- {
- 'type': 'Feature',
- 'properties': {},
- 'geometry': {
- 'type': 'Point',
- 'coordinates': [11.77654, 52.99306],
- }
- },
- {
- 'type': 'Feature',
- 'properties': {},
- 'geometry': {
- 'type': 'Point',
- 'coordinates': [11.77438, 52.99341],
- }
- },
- {
- 'type': 'Feature',
- 'properties': {},
- 'geometry': {
- 'type': 'Point',
- 'coordinates': [11.77214, 52.99402],
- }
- },
- {
- 'type': 'Feature',
- 'properties': {},
- 'geometry': {
- 'type': 'Point',
- 'coordinates': [11.76965, 52.99507],
- }
- },
- {
- 'type': 'Feature',
- 'properties': {},
- 'geometry': {
- 'type': 'Point',
- 'coordinates': [11.76822, 52.99593],
- }
- },
- {
- 'type': 'Feature',
- 'properties': {},
- 'geometry': {
- 'type': 'Point',
- 'coordinates': [11.76681, 52.99704],
- }
- },
- {
- 'type': 'Feature',
- 'properties': {},
- 'geometry': {
- 'type': 'Point',
- 'coordinates': [11.76607, 52.99783],
- }
- },
- {
- 'type': 'Feature',
- 'properties': {},
- 'geometry': {
- 'type': 'Point',
- 'coordinates': [11.7651, 52.99924],
- }
- },
- {
- 'type': 'Feature',
- 'properties': {},
- 'geometry': {
- 'type': 'Point',
- 'coordinates': [11.76404, 53.00122],
- }
- },
- {
- 'type': 'Feature',
- 'properties': {},
- 'geometry': {
- 'type': 'Point',
- 'coordinates': [11.76294, 53.00335],
- }
- },
- {
- 'type': 'Feature',
- 'properties': {},
- 'geometry': {
- 'type': 'Point',
- 'coordinates': [11.76294, 53.00335],
- }
- },
- {
- 'type': 'Feature',
- 'properties': {},
- 'geometry': {
- 'type': 'Point',
- 'coordinates': [11.76209, 53.00562],
- }
- },
- {
- 'type': 'Feature',
- 'properties': {},
- 'geometry': {
- 'type': 'Point',
- 'coordinates': [11.76156, 53.00818],
- }
- },
- {
- 'type': 'Feature',
- 'properties': {},
- 'geometry': {
- 'type': 'Point',
- 'coordinates': [11.75999, 53.01863],
- }
- },
- {
- 'type': 'Feature',
- 'properties': {},
- 'geometry': {
- 'type': 'Point',
- 'coordinates': [11.75999, 53.01863],
- }
- },
- {
- 'type': 'Feature',
- 'properties': {},
- 'geometry': {
- 'type': 'Point',
- 'coordinates': [11.75896, 53.02618],
- }
- },
- {
- 'type': 'Feature',
- 'properties': {},
- 'geometry': {
- 'type': 'Point',
- 'coordinates': [11.75016, 53.08416],
- }
- },
- {
- 'type': 'Feature',
- 'properties': {},
- 'geometry': {
- 'type': 'Point',
- 'coordinates': [11.75016, 53.08416],
- }
- },
- {
- 'type': 'Feature',
- 'properties': {},
- 'geometry': {
- 'type': 'Point',
- 'coordinates': [11.73836, 53.16122],
- }
- },
- {
- 'type': 'Feature',
- 'properties': {},
- 'geometry': {
- 'type': 'Point',
- 'coordinates': [11.73836, 53.16122],
- }
- },
- {
- 'type': 'Feature',
- 'properties': {},
- 'geometry': {
- 'type': 'Point',
- 'coordinates': [11.73394, 53.19105],
- }
- },
- {
- 'type': 'Feature',
- 'properties': {},
- 'geometry': {
- 'type': 'Point',
- 'coordinates': [11.73354, 53.19283],
- }
- },
- {
- 'type': 'Feature',
- 'properties': {},
- 'geometry': {
- 'type': 'Point',
- 'coordinates': [11.73226, 53.19635],
- }
- },
- {
- 'type': 'Feature',
- 'properties': {},
- 'geometry': {
- 'type': 'Point',
- 'coordinates': [11.7309, 53.19892],
- }
- },
- {
- 'type': 'Feature',
- 'properties': {},
- 'geometry': {
- 'type': 'Point',
- 'coordinates': [11.72857, 53.20223],
- }
- },
- {
- 'type': 'Feature',
- 'properties': {},
- 'geometry': {
- 'type': 'Point',
- 'coordinates': [11.72645, 53.2046],
- }
- },
- {
- 'type': 'Feature',
- 'properties': {},
- 'geometry': {
- 'type': 'Point',
- 'coordinates': [11.72403, 53.20687],
- }
- },
- {
- 'type': 'Feature',
- 'properties': {},
- 'geometry': {
- 'type': 'Point',
- 'coordinates': [11.72132, 53.20902],
- }
- },
- {
- 'type': 'Feature',
- 'properties': {},
- 'geometry': {
- 'type': 'Point',
- 'coordinates': [11.71835, 53.21104],
- }
- },
- {
- 'type': 'Feature',
- 'properties': {},
- 'geometry': {
- 'type': 'Point',
- 'coordinates': [11.71398, 53.21349],
- }
- },
- {
- 'type': 'Feature',
- 'properties': {},
- 'geometry': {
- 'type': 'Point',
- 'coordinates': [11.66362, 53.23654],
- }
- },
- {
- 'type': 'Feature',
- 'properties': {},
- 'geometry': {
- 'type': 'Point',
- 'coordinates': [11.66362, 53.23654],
- }
- },
- {
- 'type': 'Feature',
- 'properties': {},
- 'geometry': {
- 'type': 'Point',
- 'coordinates': [11.65112, 53.24225],
- }
- },
- {
- 'type': 'Feature',
- 'properties': {},
- 'geometry': {
- 'type': 'Point',
- 'coordinates': [11.65112, 53.24225],
- }
- },
- {
- 'type': 'Feature',
- 'properties': {},
- 'geometry': {
- 'type': 'Point',
- 'coordinates': [11.57315, 53.27784],
- }
- },
- {
- 'type': 'Feature',
- 'properties': {},
- 'geometry': {
- 'type': 'Point',
- 'coordinates': [11.56972, 53.27957],
- }
- },
- {
- 'type': 'Feature',
- 'properties': {},
- 'geometry': {
- 'type': 'Point',
- 'coordinates': [11.56432, 53.28283],
- }
- },
- {
- 'type': 'Feature',
- 'properties': {},
- 'geometry': {
- 'type': 'Point',
- 'coordinates': [11.56432, 53.28283],
- }
- },
- {
- 'type': 'Feature',
- 'properties': {},
- 'geometry': {
- 'type': 'Point',
- 'coordinates': [11.5177, 53.31039],
- }
- },
- {
- 'type': 'Feature',
- 'properties': {},
- 'geometry': {
- 'type': 'Point',
- 'coordinates': [11.51624, 53.30953],
- }
- },
- {
- 'type': 'Feature',
- 'properties': {},
- 'geometry': {
- 'type': 'Point',
- 'coordinates': [11.5177, 53.31039],
- }
- },
- {
- 'type': 'Feature',
- 'properties': {},
- 'geometry': {
- 'type': 'Point',
- 'coordinates': [11.51531, 53.31192],
- }
- },
- {
- 'type': 'Feature',
- 'properties': {},
- 'geometry': {
- 'type': 'Point',
- 'coordinates': [11.51329, 53.31345],
- }
- },
- {
- 'type': 'Feature',
- 'properties': {},
- 'geometry': {
- 'type': 'Point',
- 'coordinates': [11.511, 53.31557],
- }
- },
- {
- 'type': 'Feature',
- 'properties': {},
- 'geometry': {
- 'type': 'Point',
- 'coordinates': [11.50921, 53.31767],
- }
- },
- {
- 'type': 'Feature',
- 'properties': {},
- 'geometry': {
- 'type': 'Point',
- 'coordinates': [11.50822, 53.31915],
- }
- },
- {
- 'type': 'Feature',
- 'properties': {},
- 'geometry': {
- 'type': 'Point',
- 'coordinates': [11.5074, 53.32076],
- }
- },
- {
- 'type': 'Feature',
- 'properties': {},
- 'geometry': {
- 'type': 'Point',
- 'coordinates': [11.50624, 53.32469],
- }
- },
- {
- 'type': 'Feature',
- 'properties': {},
- 'geometry': {
- 'type': 'Point',
- 'coordinates': [11.50574, 53.32604],
- }
- },
- {
- 'type': 'Feature',
- 'properties': {},
- 'geometry': {
- 'type': 'Point',
- 'coordinates': [11.50486, 53.32756],
- }
- },
- {
- 'type': 'Feature',
- 'properties': {},
- 'geometry': {
- 'type': 'Point',
- 'coordinates': [11.50385, 53.32882],
- }
- },
- {
- 'type': 'Feature',
- 'properties': {},
- 'geometry': {
- 'type': 'Point',
- 'coordinates': [11.50245, 53.33014],
- }
- },
- {
- 'type': 'Feature',
- 'properties': {},
- 'geometry': {
- 'type': 'Point',
- 'coordinates': [11.50027, 53.33172],
- }
- },
- {
- 'type': 'Feature',
- 'properties': {},
- 'geometry': {
- 'type': 'Point',
- 'coordinates': [11.49907, 53.33241],
- }
- },
- {
- 'type': 'Feature',
- 'properties': {},
- 'geometry': {
- 'type': 'Point',
- 'coordinates': [11.49366, 53.33506],
- }
- },
- {
- 'type': 'Feature',
- 'properties': {},
- 'geometry': {
- 'type': 'Point',
- 'coordinates': [11.49366, 53.33506],
- }
- },
- {
- 'type': 'Feature',
- 'properties': {},
- 'geometry': {
- 'type': 'Point',
- 'coordinates': [11.45045, 53.35549],
- }
- },
- {
- 'type': 'Feature',
- 'properties': {},
- 'geometry': {
- 'type': 'Point',
- 'coordinates': [11.45045, 53.35549],
- }
- },
- {
- 'type': 'Feature',
- 'properties': {},
- 'geometry': {
- 'type': 'Point',
- 'coordinates': [11.40358, 53.37763],
- }
- },
- {
- 'type': 'Feature',
- 'properties': {},
- 'geometry': {
- 'type': 'Point',
- 'coordinates': [11.39713, 53.38052],
- }
- },
- {
- 'type': 'Feature',
- 'properties': {},
- 'geometry': {
- 'type': 'Point',
- 'coordinates': [11.39326, 53.3819],
- }
- },
- {
- 'type': 'Feature',
- 'properties': {},
- 'geometry': {
- 'type': 'Point',
- 'coordinates': [11.38919, 53.38305],
- }
- },
- {
- 'type': 'Feature',
- 'properties': {},
- 'geometry': {
- 'type': 'Point',
- 'coordinates': [11.37464, 53.38622],
- }
- },
- {
- 'type': 'Feature',
- 'properties': {},
- 'geometry': {
- 'type': 'Point',
- 'coordinates': [11.37464, 53.38622],
- }
- },
- {
- 'type': 'Feature',
- 'properties': {},
- 'geometry': {
- 'type': 'Point',
- 'coordinates': [11.31781, 53.39847],
- }
- },
- {
- 'type': 'Feature',
- 'properties': {},
- 'geometry': {
- 'type': 'Point',
- 'coordinates': [11.31781, 53.39847],
- }
- },
- {
- 'type': 'Feature',
- 'properties': {},
- 'geometry': {
- 'type': 'Point',
- 'coordinates': [11.24191, 53.41474],
- }
- },
- {
- 'type': 'Feature',
- 'properties': {},
- 'geometry': {
- 'type': 'Point',
- 'coordinates': [11.23624, 53.41587],
- }
- },
- {
- 'type': 'Feature',
- 'properties': {},
- 'geometry': {
- 'type': 'Point',
- 'coordinates': [11.23324, 53.41619],
- }
- },
- {
- 'type': 'Feature',
- 'properties': {},
- 'geometry': {
- 'type': 'Point',
- 'coordinates': [11.2305, 53.41627],
- }
- },
- {
- 'type': 'Feature',
- 'properties': {},
- 'geometry': {
- 'type': 'Point',
- 'coordinates': [11.22814, 53.41618],
- }
- },
- {
- 'type': 'Feature',
- 'properties': {},
- 'geometry': {
- 'type': 'Point',
- 'coordinates': [11.22597, 53.41597],
- }
- },
- {
- 'type': 'Feature',
- 'properties': {},
- 'geometry': {
- 'type': 'Point',
- 'coordinates': [11.22395, 53.41566],
- }
- },
- {
- 'type': 'Feature',
- 'properties': {},
- 'geometry': {
- 'type': 'Point',
- 'coordinates': [11.22151, 53.41512],
- }
- },
- {
- 'type': 'Feature',
- 'properties': {},
- 'geometry': {
- 'type': 'Point',
- 'coordinates': [11.21897, 53.4144],
- }
- },
- {
- 'type': 'Feature',
- 'properties': {},
- 'geometry': {
- 'type': 'Point',
- 'coordinates': [11.21576, 53.41327],
- }
- },
- {
- 'type': 'Feature',
- 'properties': {},
- 'geometry': {
- 'type': 'Point',
- 'coordinates': [11.2153, 53.41361],
- }
- },
- {
- 'type': 'Feature',
- 'properties': {},
- 'geometry': {
- 'type': 'Point',
- 'coordinates': [11.21199, 53.41173],
- }
- },
- {
- 'type': 'Feature',
- 'properties': {},
- 'geometry': {
- 'type': 'Point',
- 'coordinates': [11.20864, 53.4102],
- }
- },
- {
- 'type': 'Feature',
- 'properties': {},
- 'geometry': {
- 'type': 'Point',
- 'coordinates': [11.20778, 53.40993],
- }
- },
- {
- 'type': 'Feature',
- 'properties': {},
- 'geometry': {
- 'type': 'Point',
- 'coordinates': [11.20612, 53.40964],
- }
- },
- {
- 'type': 'Feature',
- 'properties': {},
- 'geometry': {
- 'type': 'Point',
- 'coordinates': [11.20612, 53.40964],
- }
- },
- {
- 'type': 'Feature',
- 'properties': {},
- 'geometry': {
- 'type': 'Point',
- 'coordinates': [11.20701, 53.4091],
- }
- },
- {
- 'type': 'Feature',
- 'properties': {},
- 'geometry': {
- 'type': 'Point',
- 'coordinates': [11.15773, 53.37663],
- }
- },
- {
- 'type': 'Feature',
- 'properties': {},
- 'geometry': {
- 'type': 'Point',
- 'coordinates': [11.15606, 53.37572],
- }
- },
- {
- 'type': 'Feature',
- 'properties': {},
- 'geometry': {
- 'type': 'Point',
- 'coordinates': [11.15427, 53.3749],
- }
- },
- {
- 'type': 'Feature',
- 'properties': {},
- 'geometry': {
- 'type': 'Point',
- 'coordinates': [11.15106, 53.37375],
- }
- },
- {
- 'type': 'Feature',
- 'properties': {},
- 'geometry': {
- 'type': 'Point',
- 'coordinates': [11.1476, 53.37287],
- }
- },
- {
- 'type': 'Feature',
- 'properties': {},
- 'geometry': {
- 'type': 'Point',
- 'coordinates': [11.14299, 53.37216],
- }
- },
- {
- 'type': 'Feature',
- 'properties': {},
- 'geometry': {
- 'type': 'Point',
- 'coordinates': [11.14299, 53.37216],
- }
- },
- {
- 'type': 'Feature',
- 'properties': {},
- 'geometry': {
- 'type': 'Point',
- 'coordinates': [11.08354, 53.36499],
- }
- },
- {
- 'type': 'Feature',
- 'properties': {},
- 'geometry': {
- 'type': 'Point',
- 'coordinates': [11.08354, 53.36499],
- }
- },
- {
- 'type': 'Feature',
- 'properties': {},
- 'geometry': {
- 'type': 'Point',
- 'coordinates': [11.02743, 53.35819],
- }
- },
- {
- 'type': 'Feature',
- 'properties': {},
- 'geometry': {
- 'type': 'Point',
- 'coordinates': [11.02384, 53.35785],
- }
- },
- {
- 'type': 'Feature',
- 'properties': {},
- 'geometry': {
- 'type': 'Point',
- 'coordinates': [11.02009, 53.35773],
- }
- },
- {
- 'type': 'Feature',
- 'properties': {},
- 'geometry': {
- 'type': 'Point',
- 'coordinates': [10.98705, 53.35799],
- }
- },
- {
- 'type': 'Feature',
- 'properties': {},
- 'geometry': {
- 'type': 'Point',
- 'coordinates': [10.98405, 53.3581],
- }
- },
- {
- 'type': 'Feature',
- 'properties': {},
- 'geometry': {
- 'type': 'Point',
- 'coordinates': [10.98183, 53.35829],
- }
- },
- {
- 'type': 'Feature',
- 'properties': {},
- 'geometry': {
- 'type': 'Point',
- 'coordinates': [10.97962, 53.35856],
- }
- },
- {
- 'type': 'Feature',
- 'properties': {},
- 'geometry': {
- 'type': 'Point',
- 'coordinates': [10.97674, 53.35906],
- }
- },
- {
- 'type': 'Feature',
- 'properties': {},
- 'geometry': {
- 'type': 'Point',
- 'coordinates': [10.95201, 53.36442],
- }
- },
- {
- 'type': 'Feature',
- 'properties': {},
- 'geometry': {
- 'type': 'Point',
- 'coordinates': [10.95201, 53.36442],
- }
- },
- {
- 'type': 'Feature',
- 'properties': {},
- 'geometry': {
- 'type': 'Point',
- 'coordinates': [10.90455, 53.37471],
- }
- },
- {
- 'type': 'Feature',
- 'properties': {},
- 'geometry': {
- 'type': 'Point',
- 'coordinates': [10.90024, 53.37551],
- }
- },
- {
- 'type': 'Feature',
- 'properties': {},
- 'geometry': {
- 'type': 'Point',
- 'coordinates': [10.89731, 53.3759],
- }
- },
- {
- 'type': 'Feature',
- 'properties': {},
- 'geometry': {
- 'type': 'Point',
- 'coordinates': [10.89434, 53.37617],
- }
- },
- {
- 'type': 'Feature',
- 'properties': {},
- 'geometry': {
- 'type': 'Point',
- 'coordinates': [10.89135, 53.37631],
- }
- },
- {
- 'type': 'Feature',
- 'properties': {},
- 'geometry': {
- 'type': 'Point',
- 'coordinates': [10.88684, 53.37635],
- }
- },
- {
- 'type': 'Feature',
- 'properties': {},
- 'geometry': {
- 'type': 'Point',
- 'coordinates': [10.76786, 53.37606],
- }
- },
- {
- 'type': 'Feature',
- 'properties': {},
- 'geometry': {
- 'type': 'Point',
- 'coordinates': [10.76411, 53.37619],
- }
- },
- {
- 'type': 'Feature',
- 'properties': {},
- 'geometry': {
- 'type': 'Point',
- 'coordinates': [10.76042, 53.37662],
- }
- },
- {
- 'type': 'Feature',
- 'properties': {},
- 'geometry': {
- 'type': 'Point',
- 'coordinates': [10.75756, 53.37718],
- }
- },
- {
- 'type': 'Feature',
- 'properties': {},
- 'geometry': {
- 'type': 'Point',
- 'coordinates': [10.75411, 53.37813],
- }
- },
- {
- 'type': 'Feature',
- 'properties': {},
- 'geometry': {
- 'type': 'Point',
- 'coordinates': [10.75411, 53.37813],
- }
- },
- {
- 'type': 'Feature',
- 'properties': {},
- 'geometry': {
- 'type': 'Point',
- 'coordinates': [10.74951, 53.37959],
- }
- },
- {
- 'type': 'Feature',
- 'properties': {},
- 'geometry': {
- 'type': 'Point',
- 'coordinates': [10.74639, 53.38083],
- }
- },
- {
- 'type': 'Feature',
- 'properties': {},
- 'geometry': {
- 'type': 'Point',
- 'coordinates': [10.74343, 53.38242],
- }
- },
- {
- 'type': 'Feature',
- 'properties': {},
- 'geometry': {
- 'type': 'Point',
- 'coordinates': [10.74114, 53.38403],
- }
- },
- {
- 'type': 'Feature',
- 'properties': {},
- 'geometry': {
- 'type': 'Point',
- 'coordinates': [10.73225, 53.39182],
- }
- },
- {
- 'type': 'Feature',
- 'properties': {},
- 'geometry': {
- 'type': 'Point',
- 'coordinates': [10.68993, 53.42813],
- }
- },
- {
- 'type': 'Feature',
- 'properties': {},
- 'geometry': {
- 'type': 'Point',
- 'coordinates': [10.68993, 53.42813],
- }
- },
- {
- 'type': 'Feature',
- 'properties': {},
- 'geometry': {
- 'type': 'Point',
- 'coordinates': [10.65985, 53.45385],
- }
- },
- {
- 'type': 'Feature',
- 'properties': {},
- 'geometry': {
- 'type': 'Point',
- 'coordinates': [10.65601, 53.45662],
- }
- },
- {
- 'type': 'Feature',
- 'properties': {},
- 'geometry': {
- 'type': 'Point',
- 'coordinates': [10.64984, 53.46022],
- }
- },
- {
- 'type': 'Feature',
- 'properties': {},
- 'geometry': {
- 'type': 'Point',
- 'coordinates': [10.64984, 53.46022],
- }
- },
- {
- 'type': 'Feature',
- 'properties': {},
- 'geometry': {
- 'type': 'Point',
- 'coordinates': [10.64982, 53.46022],
- }
- },
- {
- 'type': 'Feature',
- 'properties': {},
- 'geometry': {
- 'type': 'Point',
- 'coordinates': [10.64982, 53.46022],
- }
- },
- {
- 'type': 'Feature',
- 'properties': {},
- 'geometry': {
- 'type': 'Point',
- 'coordinates': [10.62314, 53.47542],
- }
- },
- {
- 'type': 'Feature',
- 'properties': {},
- 'geometry': {
- 'type': 'Point',
- 'coordinates': [10.62268, 53.47521],
- }
- },
- {
- 'type': 'Feature',
- 'properties': {},
- 'geometry': {
- 'type': 'Point',
- 'coordinates': [10.62181, 53.47606],
- }
- },
- {
- 'type': 'Feature',
- 'properties': {},
- 'geometry': {
- 'type': 'Point',
- 'coordinates': [10.62098, 53.47663],
- }
- },
- {
- 'type': 'Feature',
- 'properties': {},
- 'geometry': {
- 'type': 'Point',
- 'coordinates': [10.61977, 53.47735],
- }
- },
- {
- 'type': 'Feature',
- 'properties': {},
- 'geometry': {
- 'type': 'Point',
- 'coordinates': [10.61131, 53.48209],
- }
- },
- {
- 'type': 'Feature',
- 'properties': {},
- 'geometry': {
- 'type': 'Point',
- 'coordinates': [10.61131, 53.48209],
- }
- },
- {
- 'type': 'Feature',
- 'properties': {},
- 'geometry': {
- 'type': 'Point',
- 'coordinates': [10.60795, 53.4839],
- }
- },
- {
- 'type': 'Feature',
- 'properties': {},
- 'geometry': {
- 'type': 'Point',
- 'coordinates': [10.60315, 53.48606],
- }
- },
- {
- 'type': 'Feature',
- 'properties': {},
- 'geometry': {
- 'type': 'Point',
- 'coordinates': [10.59996, 53.48726],
- }
- },
- {
- 'type': 'Feature',
- 'properties': {},
- 'geometry': {
- 'type': 'Point',
- 'coordinates': [10.59079, 53.49017],
- }
- },
- {
- 'type': 'Feature',
- 'properties': {},
- 'geometry': {
- 'type': 'Point',
- 'coordinates': [10.59079, 53.49017],
- }
- },
- {
- 'type': 'Feature',
- 'properties': {},
- 'geometry': {
- 'type': 'Point',
- 'coordinates': [10.55908, 53.50015],
- }
- },
- {
- 'type': 'Feature',
- 'properties': {},
- 'geometry': {
- 'type': 'Point',
- 'coordinates': [10.55908, 53.50015],
- }
- },
- {
- 'type': 'Feature',
- 'properties': {},
- 'geometry': {
- 'type': 'Point',
- 'coordinates': [10.54596, 53.50428],
- }
- },
- {
- 'type': 'Feature',
- 'properties': {},
- 'geometry': {
- 'type': 'Point',
- 'coordinates': [10.54324, 53.50506],
- }
- },
- {
- 'type': 'Feature',
- 'properties': {},
- 'geometry': {
- 'type': 'Point',
- 'coordinates': [10.53969, 53.5058],
- }
- },
- {
- 'type': 'Feature',
- 'properties': {},
- 'geometry': {
- 'type': 'Point',
- 'coordinates': [10.53749, 53.50611],
- }
- },
- {
- 'type': 'Feature',
- 'properties': {},
- 'geometry': {
- 'type': 'Point',
- 'coordinates': [10.53526, 53.50631],
- }
- },
- {
- 'type': 'Feature',
- 'properties': {},
- 'geometry': {
- 'type': 'Point',
- 'coordinates': [10.533, 53.5064],
- }
- },
- {
- 'type': 'Feature',
- 'properties': {},
- 'geometry': {
- 'type': 'Point',
- 'coordinates': [10.53074, 53.50638],
- }
- },
- {
- 'type': 'Feature',
- 'properties': {},
- 'geometry': {
- 'type': 'Point',
- 'coordinates': [10.52774, 53.50618],
- }
- },
- {
- 'type': 'Feature',
- 'properties': {},
- 'geometry': {
- 'type': 'Point',
- 'coordinates': [10.52553, 53.5059],
- }
- },
- {
- 'type': 'Feature',
- 'properties': {},
- 'geometry': {
- 'type': 'Point',
- 'coordinates': [10.52337, 53.50552],
- }
- },
- {
- 'type': 'Feature',
- 'properties': {},
- 'geometry': {
- 'type': 'Point',
- 'coordinates': [10.52126, 53.50504],
- }
- },
- {
- 'type': 'Feature',
- 'properties': {},
- 'geometry': {
- 'type': 'Point',
- 'coordinates': [10.51294, 53.50272],
- }
- },
- {
- 'type': 'Feature',
- 'properties': {},
- 'geometry': {
- 'type': 'Point',
- 'coordinates': [10.51084, 53.50222],
- }
- },
- {
- 'type': 'Feature',
- 'properties': {},
- 'geometry': {
- 'type': 'Point',
- 'coordinates': [10.50794, 53.50172],
- }
- },
- {
- 'type': 'Feature',
- 'properties': {},
- 'geometry': {
- 'type': 'Point',
- 'coordinates': [10.50422, 53.50138],
- }
- },
- {
- 'type': 'Feature',
- 'properties': {},
- 'geometry': {
- 'type': 'Point',
- 'coordinates': [10.49971, 53.50139],
- }
- },
- {
- 'type': 'Feature',
- 'properties': {},
- 'geometry': {
- 'type': 'Point',
- 'coordinates': [10.49524, 53.50178],
- }
- },
- {
- 'type': 'Feature',
- 'properties': {},
- 'geometry': {
- 'type': 'Point',
- 'coordinates': [10.49232, 53.50222],
- }
- },
- {
- 'type': 'Feature',
- 'properties': {},
- 'geometry': {
- 'type': 'Point',
- 'coordinates': [10.48489, 53.50381],
- }
- },
- {
- 'type': 'Feature',
- 'properties': {},
- 'geometry': {
- 'type': 'Point',
- 'coordinates': [10.48489, 53.50381],
- }
- },
- {
- 'type': 'Feature',
- 'properties': {},
- 'geometry': {
- 'type': 'Point',
- 'coordinates': [10.48163, 53.50441],
- }
- },
- {
- 'type': 'Feature',
- 'properties': {},
- 'geometry': {
- 'type': 'Point',
- 'coordinates': [10.47869, 53.50479],
- }
- },
- {
- 'type': 'Feature',
- 'properties': {},
- 'geometry': {
- 'type': 'Point',
- 'coordinates': [10.46895, 53.50542],
- }
- },
- {
- 'type': 'Feature',
- 'properties': {},
- 'geometry': {
- 'type': 'Point',
- 'coordinates': [10.46598, 53.5057],
- }
- },
- {
- 'type': 'Feature',
- 'properties': {},
- 'geometry': {
- 'type': 'Point',
- 'coordinates': [10.46235, 53.50631],
- }
- },
- {
- 'type': 'Feature',
- 'properties': {},
- 'geometry': {
- 'type': 'Point',
- 'coordinates': [10.45956, 53.507],
- }
- },
- {
- 'type': 'Feature',
- 'properties': {},
- 'geometry': {
- 'type': 'Point',
- 'coordinates': [10.45692, 53.50785],
- }
- },
- {
- 'type': 'Feature',
- 'properties': {},
- 'geometry': {
- 'type': 'Point',
- 'coordinates': [10.45505, 53.50861],
- }
- },
- {
- 'type': 'Feature',
- 'properties': {},
- 'geometry': {
- 'type': 'Point',
- 'coordinates': [10.42782, 53.52066],
- }
- },
- {
- 'type': 'Feature',
- 'properties': {},
- 'geometry': {
- 'type': 'Point',
- 'coordinates': [10.42587, 53.52134],
- }
- },
- {
- 'type': 'Feature',
- 'properties': {},
- 'geometry': {
- 'type': 'Point',
- 'coordinates': [10.42384, 53.52193],
- }
- },
- {
- 'type': 'Feature',
- 'properties': {},
- 'geometry': {
- 'type': 'Point',
- 'coordinates': [10.42029, 53.52268],
- }
- },
- {
- 'type': 'Feature',
- 'properties': {},
- 'geometry': {
- 'type': 'Point',
- 'coordinates': [10.41809, 53.523],
- }
- },
- {
- 'type': 'Feature',
- 'properties': {},
- 'geometry': {
- 'type': 'Point',
- 'coordinates': [10.41586, 53.52321],
- }
- },
- {
- 'type': 'Feature',
- 'properties': {},
- 'geometry': {
- 'type': 'Point',
- 'coordinates': [10.4136, 53.52331],
- }
- },
- {
- 'type': 'Feature',
- 'properties': {},
- 'geometry': {
- 'type': 'Point',
- 'coordinates': [10.41134, 53.5233],
- }
- },
- {
- 'type': 'Feature',
- 'properties': {},
- 'geometry': {
- 'type': 'Point',
- 'coordinates': [10.37228, 53.52093],
- }
- },
- {
- 'type': 'Feature',
- 'properties': {},
- 'geometry': {
- 'type': 'Point',
- 'coordinates': [10.36926, 53.52083],
- }
- },
- {
- 'type': 'Feature',
- 'properties': {},
- 'geometry': {
- 'type': 'Point',
- 'coordinates': [10.36626, 53.52092],
- }
- },
- {
- 'type': 'Feature',
- 'properties': {},
- 'geometry': {
- 'type': 'Point',
- 'coordinates': [10.36256, 53.52134],
- }
- },
- {
- 'type': 'Feature',
- 'properties': {},
- 'geometry': {
- 'type': 'Point',
- 'coordinates': [10.3604, 53.52174],
- }
- },
- {
- 'type': 'Feature',
- 'properties': {},
- 'geometry': {
- 'type': 'Point',
- 'coordinates': [10.35832, 53.52227],
- }
- },
- {
- 'type': 'Feature',
- 'properties': {},
- 'geometry': {
- 'type': 'Point',
- 'coordinates': [10.35568, 53.52313],
- }
- },
- {
- 'type': 'Feature',
- 'properties': {},
- 'geometry': {
- 'type': 'Point',
- 'coordinates': [10.3502, 53.52552],
- }
- },
- {
- 'type': 'Feature',
- 'properties': {},
- 'geometry': {
- 'type': 'Point',
- 'coordinates': [10.34828, 53.52623],
- }
- },
- {
- 'type': 'Feature',
- 'properties': {},
- 'geometry': {
- 'type': 'Point',
- 'coordinates': [10.34487, 53.52718],
- }
- },
- {
- 'type': 'Feature',
- 'properties': {},
- 'geometry': {
- 'type': 'Point',
- 'coordinates': [10.34107, 53.5279],
- }
- },
- {
- 'type': 'Feature',
- 'properties': {},
- 'geometry': {
- 'type': 'Point',
- 'coordinates': [10.34107, 53.5279],
- }
- },
- {
- 'type': 'Feature',
- 'properties': {},
- 'geometry': {
- 'type': 'Point',
- 'coordinates': [10.33396, 53.5291],
- }
- },
- {
- 'type': 'Feature',
- 'properties': {},
- 'geometry': {
- 'type': 'Point',
- 'coordinates': [10.32878, 53.52967],
- }
- },
- {
- 'type': 'Feature',
- 'properties': {},
- 'geometry': {
- 'type': 'Point',
- 'coordinates': [10.32427, 53.52993],
- }
- },
- {
- 'type': 'Feature',
- 'properties': {},
- 'geometry': {
- 'type': 'Point',
- 'coordinates': [10.31961, 53.52997],
- }
- },
- {
- 'type': 'Feature',
- 'properties': {},
- 'geometry': {
- 'type': 'Point',
- 'coordinates': [10.3196, 53.53001],
- }
- },
- {
- 'type': 'Feature',
- 'properties': {},
- 'geometry': {
- 'type': 'Point',
- 'coordinates': [10.31932, 53.52997],
- }
- },
- {
- 'type': 'Feature',
- 'properties': {},
- 'geometry': {
- 'type': 'Point',
- 'coordinates': [10.31483, 53.52992],
- }
- },
- {
- 'type': 'Feature',
- 'properties': {},
- 'geometry': {
- 'type': 'Point',
- 'coordinates': [10.31475, 53.53004],
- }
- },
- {
- 'type': 'Feature',
- 'properties': {},
- 'geometry': {
- 'type': 'Point',
- 'coordinates': [10.31334, 53.52995],
- }
- },
- {
- 'type': 'Feature',
- 'properties': {},
- 'geometry': {
- 'type': 'Point',
- 'coordinates': [10.30808, 53.52934],
- }
- },
- {
- 'type': 'Feature',
- 'properties': {},
- 'geometry': {
- 'type': 'Point',
- 'coordinates': [10.303, 53.52852],
- }
- },
- {
- 'type': 'Feature',
- 'properties': {},
- 'geometry': {
- 'type': 'Point',
- 'coordinates': [10.3002, 53.52793],
- }
- },
- {
- 'type': 'Feature',
- 'properties': {},
- 'geometry': {
- 'type': 'Point',
- 'coordinates': [10.28762, 53.52489],
- }
- },
- {
- 'type': 'Feature',
- 'properties': {},
- 'geometry': {
- 'type': 'Point',
- 'coordinates': [10.28493, 53.52409],
- }
- },
- {
- 'type': 'Feature',
- 'properties': {},
- 'geometry': {
- 'type': 'Point',
- 'coordinates': [10.28241, 53.52309],
- }
- },
- {
- 'type': 'Feature',
- 'properties': {},
- 'geometry': {
- 'type': 'Point',
- 'coordinates': [10.28011, 53.52194],
- }
- },
- {
- 'type': 'Feature',
- 'properties': {},
- 'geometry': {
- 'type': 'Point',
- 'coordinates': [10.27811, 53.52067],
- }
- },
- {
- 'type': 'Feature',
- 'properties': {},
- 'geometry': {
- 'type': 'Point',
- 'coordinates': [10.27811, 53.52067],
- }
- },
- {
- 'type': 'Feature',
- 'properties': {},
- 'geometry': {
- 'type': 'Point',
- 'coordinates': [10.27624, 53.51919],
- }
- },
- {
- 'type': 'Feature',
- 'properties': {},
- 'geometry': {
- 'type': 'Point',
- 'coordinates': [10.27321, 53.51609],
- }
- },
- {
- 'type': 'Feature',
- 'properties': {},
- 'geometry': {
- 'type': 'Point',
- 'coordinates': [10.27192, 53.51498],
- }
- },
- {
- 'type': 'Feature',
- 'properties': {},
- 'geometry': {
- 'type': 'Point',
- 'coordinates': [10.26996, 53.51361],
- }
- },
- {
- 'type': 'Feature',
- 'properties': {},
- 'geometry': {
- 'type': 'Point',
- 'coordinates': [10.26774, 53.5124],
- }
- },
- {
- 'type': 'Feature',
- 'properties': {},
- 'geometry': {
- 'type': 'Point',
- 'coordinates': [10.2653, 53.51135],
- }
- },
- {
- 'type': 'Feature',
- 'properties': {},
- 'geometry': {
- 'type': 'Point',
- 'coordinates': [10.26265, 53.51049],
- }
- },
- {
- 'type': 'Feature',
- 'properties': {},
- 'geometry': {
- 'type': 'Point',
- 'coordinates': [10.26057, 53.50996],
- }
- },
- {
- 'type': 'Feature',
- 'properties': {},
- 'geometry': {
- 'type': 'Point',
- 'coordinates': [10.25488, 53.50878],
- }
- },
- {
- 'type': 'Feature',
- 'properties': {},
- 'geometry': {
- 'type': 'Point',
- 'coordinates': [10.25198, 53.50802],
- }
- },
- {
- 'type': 'Feature',
- 'properties': {},
- 'geometry': {
- 'type': 'Point',
- 'coordinates': [10.25205, 53.50793],
- }
- },
- {
- 'type': 'Feature',
- 'properties': {},
- 'geometry': {
- 'type': 'Point',
- 'coordinates': [10.2492, 53.50694],
- }
- },
- {
- 'type': 'Feature',
- 'properties': {},
- 'geometry': {
- 'type': 'Point',
- 'coordinates': [10.24742, 53.50612],
- }
- },
- {
- 'type': 'Feature',
- 'properties': {},
- 'geometry': {
- 'type': 'Point',
- 'coordinates': [10.24576, 53.5052],
- }
- },
- {
- 'type': 'Feature',
- 'properties': {},
- 'geometry': {
- 'type': 'Point',
- 'coordinates': [10.24378, 53.50384],
- }
- },
- {
- 'type': 'Feature',
- 'properties': {},
- 'geometry': {
- 'type': 'Point',
- 'coordinates': [10.24028, 53.50092],
- }
- },
- {
- 'type': 'Feature',
- 'properties': {},
- 'geometry': {
- 'type': 'Point',
- 'coordinates': [10.23766, 53.49931],
- }
- },
- {
- 'type': 'Feature',
- 'properties': {},
- 'geometry': {
- 'type': 'Point',
- 'coordinates': [10.23462, 53.49798],
- }
- },
- {
- 'type': 'Feature',
- 'properties': {},
- 'geometry': {
- 'type': 'Point',
- 'coordinates': [10.23126, 53.49698],
- }
- },
- {
- 'type': 'Feature',
- 'properties': {},
- 'geometry': {
- 'type': 'Point',
- 'coordinates': [10.23126, 53.49698],
- }
- },
- {
- 'type': 'Feature',
- 'properties': {},
- 'geometry': {
- 'type': 'Point',
- 'coordinates': [10.2312, 53.49707],
- }
- },
- {
- 'type': 'Feature',
- 'properties': {},
- 'geometry': {
- 'type': 'Point',
- 'coordinates': [10.22803, 53.49646],
- }
- },
- {
- 'type': 'Feature',
- 'properties': {},
- 'geometry': {
- 'type': 'Point',
- 'coordinates': [10.22509, 53.49612],
- }
- },
- {
- 'type': 'Feature',
- 'properties': {},
- 'geometry': {
- 'type': 'Point',
- 'coordinates': [10.22509, 53.49612],
- }
- },
- {
- 'type': 'Feature',
- 'properties': {},
- 'geometry': {
- 'type': 'Point',
- 'coordinates': [10.22509, 53.49612],
- }
- },
- {
- 'type': 'Feature',
- 'properties': {},
- 'geometry': {
- 'type': 'Point',
- 'coordinates': [10.22212, 53.49576],
- }
- },
- {
- 'type': 'Feature',
- 'properties': {},
- 'geometry': {
- 'type': 'Point',
- 'coordinates': [10.21995, 53.49538],
- }
- },
- {
- 'type': 'Feature',
- 'properties': {},
- 'geometry': {
- 'type': 'Point',
- 'coordinates': [10.21788, 53.49485],
- }
- },
- {
- 'type': 'Feature',
- 'properties': {},
- 'geometry': {
- 'type': 'Point',
- 'coordinates': [10.21587, 53.49422],
- }
- },
- {
- 'type': 'Feature',
- 'properties': {},
- 'geometry': {
- 'type': 'Point',
- 'coordinates': [10.21395, 53.49351],
- }
- },
- {
- 'type': 'Feature',
- 'properties': {},
- 'geometry': {
- 'type': 'Point',
- 'coordinates': [10.21151, 53.49246],
- }
- },
- {
- 'type': 'Feature',
- 'properties': {},
- 'geometry': {
- 'type': 'Point',
- 'coordinates': [10.20626, 53.48986],
- }
- },
- {
- 'type': 'Feature',
- 'properties': {},
- 'geometry': {
- 'type': 'Point',
- 'coordinates': [10.20626, 53.48986],
- }
- },
- {
- 'type': 'Feature',
- 'properties': {},
- 'geometry': {
- 'type': 'Point',
- 'coordinates': [10.20625, 53.48986],
- }
- },
- {
- 'type': 'Feature',
- 'properties': {},
- 'geometry': {
- 'type': 'Point',
- 'coordinates': [10.20625, 53.48986],
- }
- },
- {
- 'type': 'Feature',
- 'properties': {},
- 'geometry': {
- 'type': 'Point',
- 'coordinates': [10.20625, 53.48986],
- }
- },
- {
- 'type': 'Feature',
- 'properties': {},
- 'geometry': {
- 'type': 'Point',
- 'coordinates': [10.20391, 53.48879],
- }
- },
- {
- 'type': 'Feature',
- 'properties': {},
- 'geometry': {
- 'type': 'Point',
- 'coordinates': [10.20129, 53.4879],
- }
- },
- {
- 'type': 'Feature',
- 'properties': {},
- 'geometry': {
- 'type': 'Point',
- 'coordinates': [10.19849, 53.48725],
- }
- },
- {
- 'type': 'Feature',
- 'properties': {},
- 'geometry': {
- 'type': 'Point',
- 'coordinates': [10.19555, 53.48687],
- }
- },
- {
- 'type': 'Feature',
- 'properties': {},
- 'geometry': {
- 'type': 'Point',
- 'coordinates': [10.19104, 53.48684],
- }
- },
- {
- 'type': 'Feature',
- 'properties': {},
- 'geometry': {
- 'type': 'Point',
- 'coordinates': [10.18188, 53.48784],
- }
- },
- {
- 'type': 'Feature',
- 'properties': {},
- 'geometry': {
- 'type': 'Point',
- 'coordinates': [10.18185, 53.48772],
- }
- },
- {
- 'type': 'Feature',
- 'properties': {},
- 'geometry': {
- 'type': 'Point',
- 'coordinates': [10.18185, 53.48772],
- }
- },
- {
- 'type': 'Feature',
- 'properties': {},
- 'geometry': {
- 'type': 'Point',
- 'coordinates': [10.18124, 53.48779],
- }
- },
- {
- 'type': 'Feature',
- 'properties': {},
- 'geometry': {
- 'type': 'Point',
- 'coordinates': [10.18128, 53.48791],
- }
- },
- {
- 'type': 'Feature',
- 'properties': {},
- 'geometry': {
- 'type': 'Point',
- 'coordinates': [10.15867, 53.49036],
- }
- },
- {
- 'type': 'Feature',
- 'properties': {},
- 'geometry': {
- 'type': 'Point',
- 'coordinates': [10.15867, 53.49036],
- }
- },
- {
- 'type': 'Feature',
- 'properties': {},
- 'geometry': {
- 'type': 'Point',
- 'coordinates': [10.15369, 53.49093],
- }
- },
- {
- 'type': 'Feature',
- 'properties': {},
- 'geometry': {
- 'type': 'Point',
- 'coordinates': [10.15366, 53.49084],
- }
- },
- {
- 'type': 'Feature',
- 'properties': {},
- 'geometry': {
- 'type': 'Point',
- 'coordinates': [10.15369, 53.49093],
- }
- },
- {
- 'type': 'Feature',
- 'properties': {},
- 'geometry': {
- 'type': 'Point',
- 'coordinates': [10.15034, 53.49143],
- }
- },
- {
- 'type': 'Feature',
- 'properties': {},
- 'geometry': {
- 'type': 'Point',
- 'coordinates': [10.14748, 53.492],
- }
- },
- {
- 'type': 'Feature',
- 'properties': {},
- 'geometry': {
- 'type': 'Point',
- 'coordinates': [10.14195, 53.49342],
- }
- },
- {
- 'type': 'Feature',
- 'properties': {},
- 'geometry': {
- 'type': 'Point',
- 'coordinates': [10.13934, 53.49431],
- }
- },
- {
- 'type': 'Feature',
- 'properties': {},
- 'geometry': {
- 'type': 'Point',
- 'coordinates': [10.13687, 53.49534],
- }
- },
- {
- 'type': 'Feature',
- 'properties': {},
- 'geometry': {
- 'type': 'Point',
- 'coordinates': [10.13064, 53.49832],
- }
- },
- {
- 'type': 'Feature',
- 'properties': {},
- 'geometry': {
- 'type': 'Point',
- 'coordinates': [10.13064, 53.49832],
- }
- },
- {
- 'type': 'Feature',
- 'properties': {},
- 'geometry': {
- 'type': 'Point',
- 'coordinates': [10.12307, 53.50231],
- }
- },
- {
- 'type': 'Feature',
- 'properties': {},
- 'geometry': {
- 'type': 'Point',
- 'coordinates': [10.11319, 53.5073],
- }
- },
- {
- 'type': 'Feature',
- 'properties': {},
- 'geometry': {
- 'type': 'Point',
- 'coordinates': [10.11319, 53.5073],
- }
- },
- {
- 'type': 'Feature',
- 'properties': {},
- 'geometry': {
- 'type': 'Point',
- 'coordinates': [10.11296, 53.50715],
- }
- },
- {
- 'type': 'Feature',
- 'properties': {},
- 'geometry': {
- 'type': 'Point',
- 'coordinates': [10.11265, 53.50732],
- }
- },
- {
- 'type': 'Feature',
- 'properties': {},
- 'geometry': {
- 'type': 'Point',
- 'coordinates': [10.09793, 53.5148],
- }
- },
- {
- 'type': 'Feature',
- 'properties': {},
- 'geometry': {
- 'type': 'Point',
- 'coordinates': [10.09799, 53.51483],
- }
- },
- {
- 'type': 'Feature',
- 'properties': {},
- 'geometry': {
- 'type': 'Point',
- 'coordinates': [10.09793, 53.5148],
- }
- },
- {
- 'type': 'Feature',
- 'properties': {},
- 'geometry': {
- 'type': 'Point',
- 'coordinates': [10.09685, 53.51534],
- }
- },
- {
- 'type': 'Feature',
- 'properties': {},
- 'geometry': {
- 'type': 'Point',
- 'coordinates': [10.09693, 53.5154],
- }
- },
- {
- 'type': 'Feature',
- 'properties': {},
- 'geometry': {
- 'type': 'Point',
- 'coordinates': [10.07175, 53.52804],
- }
- },
- {
- 'type': 'Feature',
- 'properties': {},
- 'geometry': {
- 'type': 'Point',
- 'coordinates': [10.06978, 53.52904],
- }
- },
- {
- 'type': 'Feature',
- 'properties': {},
- 'geometry': {
- 'type': 'Point',
- 'coordinates': [10.06973, 53.52901],
- }
- },
- {
- 'type': 'Feature',
- 'properties': {},
- 'geometry': {
- 'type': 'Point',
- 'coordinates': [10.06969, 53.52899],
- }
- },
- {
- 'type': 'Feature',
- 'properties': {},
- 'geometry': {
- 'type': 'Point',
- 'coordinates': [10.06647, 53.53056],
- }
- },
- {
- 'type': 'Feature',
- 'properties': {},
- 'geometry': {
- 'type': 'Point',
- 'coordinates': [10.06655, 53.53063],
- }
- },
- {
- 'type': 'Feature',
- 'properties': {},
- 'geometry': {
- 'type': 'Point',
- 'coordinates': [10.05948, 53.53359],
- }
- },
- {
- 'type': 'Feature',
- 'properties': {},
- 'geometry': {
- 'type': 'Point',
- 'coordinates': [10.05426, 53.53536],
- }
- },
- {
- 'type': 'Feature',
- 'properties': {},
- 'geometry': {
- 'type': 'Point',
- 'coordinates': [10.05258, 53.53586],
- }
- },
- {
- 'type': 'Feature',
- 'properties': {},
- 'geometry': {
- 'type': 'Point',
- 'coordinates': [10.05257, 53.53585],
- }
- },
- {
- 'type': 'Feature',
- 'properties': {},
- 'geometry': {
- 'type': 'Point',
- 'coordinates': [10.05254, 53.5358],
- }
- },
- {
- 'type': 'Feature',
- 'properties': {},
- 'geometry': {
- 'type': 'Point',
- 'coordinates': [10.05088, 53.5361],
- }
- },
- {
- 'type': 'Feature',
- 'properties': {},
- 'geometry': {
- 'type': 'Point',
- 'coordinates': [10.04571, 53.53672],
- }
- },
- {
- 'type': 'Feature',
- 'properties': {},
- 'geometry': {
- 'type': 'Point',
- 'coordinates': [10.03906, 53.53792],
- }
- },
- {
- 'type': 'Feature',
- 'properties': {},
- 'geometry': {
- 'type': 'Point',
- 'coordinates': [10.03905, 53.5379],
- }
- },
- {
- 'type': 'Feature',
- 'properties': {},
- 'geometry': {
- 'type': 'Point',
- 'coordinates': [10.03906, 53.53792],
- }
- },
- {
- 'type': 'Feature',
- 'properties': {},
- 'geometry': {
- 'type': 'Point',
- 'coordinates': [10.03188, 53.53976],
- }
- },
- {
- 'type': 'Feature',
- 'properties': {},
- 'geometry': {
- 'type': 'Point',
- 'coordinates': [10.02942, 53.54022],
- }
- },
- {
- 'type': 'Feature',
- 'properties': {},
- 'geometry': {
- 'type': 'Point',
- 'coordinates': [10.02807, 53.54062],
- }
- },
- {
- 'type': 'Feature',
- 'properties': {},
- 'geometry': {
- 'type': 'Point',
- 'coordinates': [10.02363, 53.54233],
- }
- },
- {
- 'type': 'Feature',
- 'properties': {},
- 'geometry': {
- 'type': 'Point',
- 'coordinates': [10.02165, 53.54297],
- }
- },
- {
- 'type': 'Feature',
- 'properties': {},
- 'geometry': {
- 'type': 'Point',
- 'coordinates': [10.01983, 53.54376],
- }
- },
- {
- 'type': 'Feature',
- 'properties': {},
- 'geometry': {
- 'type': 'Point',
- 'coordinates': [10.01789, 53.54445],
- }
- },
- {
- 'type': 'Feature',
- 'properties': {},
- 'geometry': {
- 'type': 'Point',
- 'coordinates': [10.01648, 53.54477],
- }
- },
- {
- 'type': 'Feature',
- 'properties': {},
- 'geometry': {
- 'type': 'Point',
- 'coordinates': [10.01353, 53.54515],
- }
- },
- {
- 'type': 'Feature',
- 'properties': {},
- 'geometry': {
- 'type': 'Point',
- 'coordinates': [10.00972, 53.54659],
- }
- },
- {
- 'type': 'Feature',
- 'properties': {},
- 'geometry': {
- 'type': 'Point',
- 'coordinates': [10.00864, 53.54722],
- }
- },
- {
- 'type': 'Feature',
- 'properties': {},
- 'geometry': {
- 'type': 'Point',
- 'coordinates': [10.00785, 53.54797],
- }
- },
- {
- 'type': 'Feature',
- 'properties': {},
- 'geometry': {
- 'type': 'Point',
- 'coordinates': [10.00749, 53.54884],
- }
- },
- {
- 'type': 'Feature',
- 'properties': {},
- 'geometry': {
- 'type': 'Point',
- 'coordinates': [10.00728, 53.55017],
- }
- },
- {
- 'type': 'Feature',
- 'properties': {},
- 'geometry': {
- 'type': 'Point',
- 'coordinates': [10.00731, 53.55131],
- }
- },
- {
- 'type': 'Feature',
- 'properties': {},
- 'geometry': {
- 'type': 'Point',
- 'coordinates': [10.00683, 53.55267],
- }
- },
- {
- 'type': 'Feature',
- 'properties': {},
- 'geometry': {
- 'type': 'Point',
- 'coordinates': [10.00703, 53.55368],
- }
- },
- {
- 'type': 'Feature',
- 'properties': {},
- 'geometry': {
- 'type': 'Point',
- 'coordinates': [10.007, 53.55371],
- }
- },
- {
- 'type': 'Feature',
- 'properties': {
- 'type': 'stop',
- 'id': '8002549',
- 'name': 'Hamburg Hbf',
- 'location': {
- 'type': 'location',
- 'id': '8002549',
- 'latitude': 53.553533,
- 'longitude': 10.00636
- },
- 'products': {
- 'nationalExpress': true,
- 'national': true,
- 'regionalExpress': true,
- 'regional': true,
- 'suburban': true,
- 'bus': true,
- 'ferry': false,
- 'subway': true,
- 'tram': false,
- 'taxi': false
- }
},
- 'geometry': {
- 'type': 'Point',
- 'coordinates': [10.00636, 53.55354],
- }
- }
- ]
+ },
+ {
+ type: 'Feature',
+ properties: {},
+ geometry: {
+ type: 'Point',
+ coordinates: [13.1607, 52.54117],
+ },
+ },
+ {
+ type: 'Feature',
+ properties: {},
+ geometry: {
+ type: 'Point',
+ coordinates: [13.1276, 52.54975],
+ },
+ },
+ {
+ type: 'Feature',
+ properties: {},
+ geometry: {
+ type: 'Point',
+ coordinates: [13.1276, 52.54975],
+ },
+ },
+ {
+ type: 'Feature',
+ properties: {},
+ geometry: {
+ type: 'Point',
+ coordinates: [13.12921, 52.54933],
+ },
+ },
+ {
+ type: 'Feature',
+ properties: {},
+ geometry: {
+ type: 'Point',
+ coordinates: [13.12921, 52.54933],
+ },
+ },
+ {
+ type: 'Feature',
+ properties: {},
+ geometry: {
+ type: 'Point',
+ coordinates: [13.11701, 52.55246],
+ },
+ },
+ {
+ type: 'Feature',
+ properties: {},
+ geometry: {
+ type: 'Point',
+ coordinates: [13.11701, 52.55246],
+ },
+ },
+ {
+ type: 'Feature',
+ properties: {},
+ geometry: {
+ type: 'Point',
+ coordinates: [13.10514, 52.55567],
+ },
+ },
+ {
+ type: 'Feature',
+ properties: {},
+ geometry: {
+ type: 'Point',
+ coordinates: [13.08924, 52.5598],
+ },
+ },
+ {
+ type: 'Feature',
+ properties: {},
+ geometry: {
+ type: 'Point',
+ coordinates: [13.08924, 52.5598],
+ },
+ },
+ {
+ type: 'Feature',
+ properties: {},
+ geometry: {
+ type: 'Point',
+ coordinates: [13.05095, 52.56974],
+ },
+ },
+ {
+ type: 'Feature',
+ properties: {},
+ geometry: {
+ type: 'Point',
+ coordinates: [13.05095, 52.56974],
+ },
+ },
+ {
+ type: 'Feature',
+ properties: {},
+ geometry: {
+ type: 'Point',
+ coordinates: [13.03193, 52.57466],
+ },
+ },
+ {
+ type: 'Feature',
+ properties: {},
+ geometry: {
+ type: 'Point',
+ coordinates: [13.03193, 52.57466],
+ },
+ },
+ {
+ type: 'Feature',
+ properties: {},
+ geometry: {
+ type: 'Point',
+ coordinates: [13.03193, 52.57466],
+ },
+ },
+ {
+ type: 'Feature',
+ properties: {},
+ geometry: {
+ type: 'Point',
+ coordinates: [13.03193, 52.57466],
+ },
+ },
+ {
+ type: 'Feature',
+ properties: {},
+ geometry: {
+ type: 'Point',
+ coordinates: [13.00885, 52.58066],
+ },
+ },
+ {
+ type: 'Feature',
+ properties: {},
+ geometry: {
+ type: 'Point',
+ coordinates: [12.99998, 52.58292],
+ },
+ },
+ {
+ type: 'Feature',
+ properties: {},
+ geometry: {
+ type: 'Point',
+ coordinates: [12.99998, 52.58292],
+ },
+ },
+ {
+ type: 'Feature',
+ properties: {},
+ geometry: {
+ type: 'Point',
+ coordinates: [12.98704, 52.58622],
+ },
+ },
+ {
+ type: 'Feature',
+ properties: {},
+ geometry: {
+ type: 'Point',
+ coordinates: [12.97895, 52.58845],
+ },
+ },
+ {
+ type: 'Feature',
+ properties: {},
+ geometry: {
+ type: 'Point',
+ coordinates: [12.93546, 52.59969],
+ },
+ },
+ {
+ type: 'Feature',
+ properties: {},
+ geometry: {
+ type: 'Point',
+ coordinates: [12.92199, 52.60329],
+ },
+ },
+ {
+ type: 'Feature',
+ properties: {},
+ geometry: {
+ type: 'Point',
+ coordinates: [12.90683, 52.60719],
+ },
+ },
+ {
+ type: 'Feature',
+ properties: {},
+ geometry: {
+ type: 'Point',
+ coordinates: [12.89792, 52.60938],
+ },
+ },
+ {
+ type: 'Feature',
+ properties: {},
+ geometry: {
+ type: 'Point',
+ coordinates: [12.8856, 52.61272],
+ },
+ },
+ {
+ type: 'Feature',
+ properties: {},
+ geometry: {
+ type: 'Point',
+ coordinates: [12.8856, 52.61272],
+ },
+ },
+ {
+ type: 'Feature',
+ properties: {},
+ geometry: {
+ type: 'Point',
+ coordinates: [12.87943, 52.61423],
+ },
+ },
+ {
+ type: 'Feature',
+ properties: {},
+ geometry: {
+ type: 'Point',
+ coordinates: [12.87436, 52.61571],
+ },
+ },
+ {
+ type: 'Feature',
+ properties: {},
+ geometry: {
+ type: 'Point',
+ coordinates: [12.8491, 52.62502],
+ },
+ },
+ {
+ type: 'Feature',
+ properties: {},
+ geometry: {
+ type: 'Point',
+ coordinates: [12.8491, 52.62502],
+ },
+ },
+ {
+ type: 'Feature',
+ properties: {},
+ geometry: {
+ type: 'Point',
+ coordinates: [12.74165, 52.66478],
+ },
+ },
+ {
+ type: 'Feature',
+ properties: {},
+ geometry: {
+ type: 'Point',
+ coordinates: [12.74165, 52.66478],
+ },
+ },
+ {
+ type: 'Feature',
+ properties: {},
+ geometry: {
+ type: 'Point',
+ coordinates: [12.72018, 52.67271],
+ },
+ },
+ {
+ type: 'Feature',
+ properties: {},
+ geometry: {
+ type: 'Point',
+ coordinates: [12.71653, 52.67424],
+ },
+ },
+ {
+ type: 'Feature',
+ properties: {},
+ geometry: {
+ type: 'Point',
+ coordinates: [12.71322, 52.67589],
+ },
+ },
+ {
+ type: 'Feature',
+ properties: {},
+ geometry: {
+ type: 'Point',
+ coordinates: [12.71322, 52.67589],
+ },
+ },
+ {
+ type: 'Feature',
+ properties: {},
+ geometry: {
+ type: 'Point',
+ coordinates: [12.71042, 52.6775],
+ },
+ },
+ {
+ type: 'Feature',
+ properties: {},
+ geometry: {
+ type: 'Point',
+ coordinates: [12.70791, 52.67915],
+ },
+ },
+ {
+ type: 'Feature',
+ properties: {},
+ geometry: {
+ type: 'Point',
+ coordinates: [12.63245, 52.73031],
+ },
+ },
+ {
+ type: 'Feature',
+ properties: {},
+ geometry: {
+ type: 'Point',
+ coordinates: [12.63245, 52.73031],
+ },
+ },
+ {
+ type: 'Feature',
+ properties: {},
+ geometry: {
+ type: 'Point',
+ coordinates: [12.5876, 52.76064],
+ },
+ },
+ {
+ type: 'Feature',
+ properties: {},
+ geometry: {
+ type: 'Point',
+ coordinates: [12.5876, 52.76064],
+ },
+ },
+ {
+ type: 'Feature',
+ properties: {},
+ geometry: {
+ type: 'Point',
+ coordinates: [12.4592, 52.84705],
+ },
+ },
+ {
+ type: 'Feature',
+ properties: {},
+ geometry: {
+ type: 'Point',
+ coordinates: [12.4592, 52.84705],
+ },
+ },
+ {
+ type: 'Feature',
+ properties: {},
+ geometry: {
+ type: 'Point',
+ coordinates: [12.45274, 52.85141],
+ },
+ },
+ {
+ type: 'Feature',
+ properties: {},
+ geometry: {
+ type: 'Point',
+ coordinates: [12.45091, 52.85264],
+ },
+ },
+ {
+ type: 'Feature',
+ properties: {},
+ geometry: {
+ type: 'Point',
+ coordinates: [12.45105, 52.85272],
+ },
+ },
+ {
+ type: 'Feature',
+ properties: {},
+ geometry: {
+ type: 'Point',
+ coordinates: [12.444, 52.85746],
+ },
+ },
+ {
+ type: 'Feature',
+ properties: {},
+ geometry: {
+ type: 'Point',
+ coordinates: [12.444, 52.85746],
+ },
+ },
+ {
+ type: 'Feature',
+ properties: {},
+ geometry: {
+ type: 'Point',
+ coordinates: [12.44385, 52.85737],
+ },
+ },
+ {
+ type: 'Feature',
+ properties: {},
+ geometry: {
+ type: 'Point',
+ coordinates: [12.43328, 52.86438],
+ },
+ },
+ {
+ type: 'Feature',
+ properties: {},
+ geometry: {
+ type: 'Point',
+ coordinates: [12.43169, 52.8652],
+ },
+ },
+ {
+ type: 'Feature',
+ properties: {},
+ geometry: {
+ type: 'Point',
+ coordinates: [12.42889, 52.8663],
+ },
+ },
+ {
+ type: 'Feature',
+ properties: {},
+ geometry: {
+ type: 'Point',
+ coordinates: [12.35027, 52.8916],
+ },
+ },
+ {
+ type: 'Feature',
+ properties: {},
+ geometry: {
+ type: 'Point',
+ coordinates: [12.34689, 52.89253],
+ },
+ },
+ {
+ type: 'Feature',
+ properties: {},
+ geometry: {
+ type: 'Point',
+ coordinates: [12.34334, 52.89319],
+ },
+ },
+ {
+ type: 'Feature',
+ properties: {},
+ geometry: {
+ type: 'Point',
+ coordinates: [12.33967, 52.89354],
+ },
+ },
+ {
+ type: 'Feature',
+ properties: {},
+ geometry: {
+ type: 'Point',
+ coordinates: [12.33596, 52.89359],
+ },
+ },
+ {
+ type: 'Feature',
+ properties: {},
+ geometry: {
+ type: 'Point',
+ coordinates: [12.28484, 52.89139],
+ },
+ },
+ {
+ type: 'Feature',
+ properties: {},
+ geometry: {
+ type: 'Point',
+ coordinates: [12.27896, 52.89088],
+ },
+ },
+ {
+ type: 'Feature',
+ properties: {},
+ geometry: {
+ type: 'Point',
+ coordinates: [12.23634, 52.88631],
+ },
+ },
+ {
+ type: 'Feature',
+ properties: {},
+ geometry: {
+ type: 'Point',
+ coordinates: [12.23043, 52.88599],
+ },
+ },
+ {
+ type: 'Feature',
+ properties: {},
+ geometry: {
+ type: 'Point',
+ coordinates: [12.22745, 52.88598],
+ },
+ },
+ {
+ type: 'Feature',
+ properties: {},
+ geometry: {
+ type: 'Point',
+ coordinates: [12.2242, 52.88609],
+ },
+ },
+ {
+ type: 'Feature',
+ properties: {},
+ geometry: {
+ type: 'Point',
+ coordinates: [12.2242, 52.88609],
+ },
+ },
+ {
+ type: 'Feature',
+ properties: {},
+ geometry: {
+ type: 'Point',
+ coordinates: [12.1491, 52.8907],
+ },
+ },
+ {
+ type: 'Feature',
+ properties: {},
+ geometry: {
+ type: 'Point',
+ coordinates: [12.14468, 52.89103],
+ },
+ },
+ {
+ type: 'Feature',
+ properties: {},
+ geometry: {
+ type: 'Point',
+ coordinates: [12.14177, 52.89137],
+ },
+ },
+ {
+ type: 'Feature',
+ properties: {},
+ geometry: {
+ type: 'Point',
+ coordinates: [12.13605, 52.89234],
+ },
+ },
+ {
+ type: 'Feature',
+ properties: {},
+ geometry: {
+ type: 'Point',
+ coordinates: [12.08388, 52.90351],
+ },
+ },
+ {
+ type: 'Feature',
+ properties: {},
+ geometry: {
+ type: 'Point',
+ coordinates: [12.08388, 52.90351],
+ },
+ },
+ {
+ type: 'Feature',
+ properties: {},
+ geometry: {
+ type: 'Point',
+ coordinates: [12.07726, 52.90534],
+ },
+ },
+ {
+ type: 'Feature',
+ properties: {},
+ geometry: {
+ type: 'Point',
+ coordinates: [12.07278, 52.90694],
+ },
+ },
+ {
+ type: 'Feature',
+ properties: {},
+ geometry: {
+ type: 'Point',
+ coordinates: [11.94977, 52.96001],
+ },
+ },
+ {
+ type: 'Feature',
+ properties: {},
+ geometry: {
+ type: 'Point',
+ coordinates: [11.94977, 52.96001],
+ },
+ },
+ {
+ type: 'Feature',
+ properties: {},
+ geometry: {
+ type: 'Point',
+ coordinates: [11.94245, 52.96311],
+ },
+ },
+ {
+ type: 'Feature',
+ properties: {},
+ geometry: {
+ type: 'Point',
+ coordinates: [11.93223, 52.96679],
+ },
+ },
+ {
+ type: 'Feature',
+ properties: {},
+ geometry: {
+ type: 'Point',
+ coordinates: [11.92961, 52.96765],
+ },
+ },
+ {
+ type: 'Feature',
+ properties: {},
+ geometry: {
+ type: 'Point',
+ coordinates: [11.87325, 52.98405],
+ },
+ },
+ {
+ type: 'Feature',
+ properties: {},
+ geometry: {
+ type: 'Point',
+ coordinates: [11.86103, 52.98751],
+ },
+ },
+ {
+ type: 'Feature',
+ properties: {},
+ geometry: {
+ type: 'Point',
+ coordinates: [11.8575, 52.98835],
+ },
+ },
+ {
+ type: 'Feature',
+ properties: {},
+ geometry: {
+ type: 'Point',
+ coordinates: [11.85282, 52.98905],
+ },
+ },
+ {
+ type: 'Feature',
+ properties: {},
+ geometry: {
+ type: 'Point',
+ coordinates: [11.84214, 52.98976],
+ },
+ },
+ {
+ type: 'Feature',
+ properties: {},
+ geometry: {
+ type: 'Point',
+ coordinates: [11.78825, 52.99283],
+ },
+ },
+ {
+ type: 'Feature',
+ properties: {},
+ geometry: {
+ type: 'Point',
+ coordinates: [11.78481, 52.99297],
+ },
+ },
+ {
+ type: 'Feature',
+ properties: {},
+ geometry: {
+ type: 'Point',
+ coordinates: [11.77866, 52.9929],
+ },
+ },
+ {
+ type: 'Feature',
+ properties: {},
+ geometry: {
+ type: 'Point',
+ coordinates: [11.77654, 52.99306],
+ },
+ },
+ {
+ type: 'Feature',
+ properties: {},
+ geometry: {
+ type: 'Point',
+ coordinates: [11.77667, 52.99344],
+ },
+ },
+ {
+ type: 'Feature',
+ properties: {},
+ geometry: {
+ type: 'Point',
+ coordinates: [11.77654, 52.99306],
+ },
+ },
+ {
+ type: 'Feature',
+ properties: {},
+ geometry: {
+ type: 'Point',
+ coordinates: [11.77438, 52.99341],
+ },
+ },
+ {
+ type: 'Feature',
+ properties: {},
+ geometry: {
+ type: 'Point',
+ coordinates: [11.77214, 52.99402],
+ },
+ },
+ {
+ type: 'Feature',
+ properties: {},
+ geometry: {
+ type: 'Point',
+ coordinates: [11.76965, 52.99507],
+ },
+ },
+ {
+ type: 'Feature',
+ properties: {},
+ geometry: {
+ type: 'Point',
+ coordinates: [11.76822, 52.99593],
+ },
+ },
+ {
+ type: 'Feature',
+ properties: {},
+ geometry: {
+ type: 'Point',
+ coordinates: [11.76681, 52.99704],
+ },
+ },
+ {
+ type: 'Feature',
+ properties: {},
+ geometry: {
+ type: 'Point',
+ coordinates: [11.76607, 52.99783],
+ },
+ },
+ {
+ type: 'Feature',
+ properties: {},
+ geometry: {
+ type: 'Point',
+ coordinates: [11.7651, 52.99924],
+ },
+ },
+ {
+ type: 'Feature',
+ properties: {},
+ geometry: {
+ type: 'Point',
+ coordinates: [11.76404, 53.00122],
+ },
+ },
+ {
+ type: 'Feature',
+ properties: {},
+ geometry: {
+ type: 'Point',
+ coordinates: [11.76294, 53.00335],
+ },
+ },
+ {
+ type: 'Feature',
+ properties: {},
+ geometry: {
+ type: 'Point',
+ coordinates: [11.76294, 53.00335],
+ },
+ },
+ {
+ type: 'Feature',
+ properties: {},
+ geometry: {
+ type: 'Point',
+ coordinates: [11.76209, 53.00562],
+ },
+ },
+ {
+ type: 'Feature',
+ properties: {},
+ geometry: {
+ type: 'Point',
+ coordinates: [11.76156, 53.00818],
+ },
+ },
+ {
+ type: 'Feature',
+ properties: {},
+ geometry: {
+ type: 'Point',
+ coordinates: [11.75999, 53.01863],
+ },
+ },
+ {
+ type: 'Feature',
+ properties: {},
+ geometry: {
+ type: 'Point',
+ coordinates: [11.75999, 53.01863],
+ },
+ },
+ {
+ type: 'Feature',
+ properties: {},
+ geometry: {
+ type: 'Point',
+ coordinates: [11.75896, 53.02618],
+ },
+ },
+ {
+ type: 'Feature',
+ properties: {},
+ geometry: {
+ type: 'Point',
+ coordinates: [11.75016, 53.08416],
+ },
+ },
+ {
+ type: 'Feature',
+ properties: {},
+ geometry: {
+ type: 'Point',
+ coordinates: [11.75016, 53.08416],
+ },
+ },
+ {
+ type: 'Feature',
+ properties: {},
+ geometry: {
+ type: 'Point',
+ coordinates: [11.73836, 53.16122],
+ },
+ },
+ {
+ type: 'Feature',
+ properties: {},
+ geometry: {
+ type: 'Point',
+ coordinates: [11.73836, 53.16122],
+ },
+ },
+ {
+ type: 'Feature',
+ properties: {},
+ geometry: {
+ type: 'Point',
+ coordinates: [11.73394, 53.19105],
+ },
+ },
+ {
+ type: 'Feature',
+ properties: {},
+ geometry: {
+ type: 'Point',
+ coordinates: [11.73354, 53.19283],
+ },
+ },
+ {
+ type: 'Feature',
+ properties: {},
+ geometry: {
+ type: 'Point',
+ coordinates: [11.73226, 53.19635],
+ },
+ },
+ {
+ type: 'Feature',
+ properties: {},
+ geometry: {
+ type: 'Point',
+ coordinates: [11.7309, 53.19892],
+ },
+ },
+ {
+ type: 'Feature',
+ properties: {},
+ geometry: {
+ type: 'Point',
+ coordinates: [11.72857, 53.20223],
+ },
+ },
+ {
+ type: 'Feature',
+ properties: {},
+ geometry: {
+ type: 'Point',
+ coordinates: [11.72645, 53.2046],
+ },
+ },
+ {
+ type: 'Feature',
+ properties: {},
+ geometry: {
+ type: 'Point',
+ coordinates: [11.72403, 53.20687],
+ },
+ },
+ {
+ type: 'Feature',
+ properties: {},
+ geometry: {
+ type: 'Point',
+ coordinates: [11.72132, 53.20902],
+ },
+ },
+ {
+ type: 'Feature',
+ properties: {},
+ geometry: {
+ type: 'Point',
+ coordinates: [11.71835, 53.21104],
+ },
+ },
+ {
+ type: 'Feature',
+ properties: {},
+ geometry: {
+ type: 'Point',
+ coordinates: [11.71398, 53.21349],
+ },
+ },
+ {
+ type: 'Feature',
+ properties: {},
+ geometry: {
+ type: 'Point',
+ coordinates: [11.66362, 53.23654],
+ },
+ },
+ {
+ type: 'Feature',
+ properties: {},
+ geometry: {
+ type: 'Point',
+ coordinates: [11.66362, 53.23654],
+ },
+ },
+ {
+ type: 'Feature',
+ properties: {},
+ geometry: {
+ type: 'Point',
+ coordinates: [11.65112, 53.24225],
+ },
+ },
+ {
+ type: 'Feature',
+ properties: {},
+ geometry: {
+ type: 'Point',
+ coordinates: [11.65112, 53.24225],
+ },
+ },
+ {
+ type: 'Feature',
+ properties: {},
+ geometry: {
+ type: 'Point',
+ coordinates: [11.57315, 53.27784],
+ },
+ },
+ {
+ type: 'Feature',
+ properties: {},
+ geometry: {
+ type: 'Point',
+ coordinates: [11.56972, 53.27957],
+ },
+ },
+ {
+ type: 'Feature',
+ properties: {},
+ geometry: {
+ type: 'Point',
+ coordinates: [11.56432, 53.28283],
+ },
+ },
+ {
+ type: 'Feature',
+ properties: {},
+ geometry: {
+ type: 'Point',
+ coordinates: [11.56432, 53.28283],
+ },
+ },
+ {
+ type: 'Feature',
+ properties: {},
+ geometry: {
+ type: 'Point',
+ coordinates: [11.5177, 53.31039],
+ },
+ },
+ {
+ type: 'Feature',
+ properties: {},
+ geometry: {
+ type: 'Point',
+ coordinates: [11.51624, 53.30953],
+ },
+ },
+ {
+ type: 'Feature',
+ properties: {},
+ geometry: {
+ type: 'Point',
+ coordinates: [11.5177, 53.31039],
+ },
+ },
+ {
+ type: 'Feature',
+ properties: {},
+ geometry: {
+ type: 'Point',
+ coordinates: [11.51531, 53.31192],
+ },
+ },
+ {
+ type: 'Feature',
+ properties: {},
+ geometry: {
+ type: 'Point',
+ coordinates: [11.51329, 53.31345],
+ },
+ },
+ {
+ type: 'Feature',
+ properties: {},
+ geometry: {
+ type: 'Point',
+ coordinates: [11.511, 53.31557],
+ },
+ },
+ {
+ type: 'Feature',
+ properties: {},
+ geometry: {
+ type: 'Point',
+ coordinates: [11.50921, 53.31767],
+ },
+ },
+ {
+ type: 'Feature',
+ properties: {},
+ geometry: {
+ type: 'Point',
+ coordinates: [11.50822, 53.31915],
+ },
+ },
+ {
+ type: 'Feature',
+ properties: {},
+ geometry: {
+ type: 'Point',
+ coordinates: [11.5074, 53.32076],
+ },
+ },
+ {
+ type: 'Feature',
+ properties: {},
+ geometry: {
+ type: 'Point',
+ coordinates: [11.50624, 53.32469],
+ },
+ },
+ {
+ type: 'Feature',
+ properties: {},
+ geometry: {
+ type: 'Point',
+ coordinates: [11.50574, 53.32604],
+ },
+ },
+ {
+ type: 'Feature',
+ properties: {},
+ geometry: {
+ type: 'Point',
+ coordinates: [11.50486, 53.32756],
+ },
+ },
+ {
+ type: 'Feature',
+ properties: {},
+ geometry: {
+ type: 'Point',
+ coordinates: [11.50385, 53.32882],
+ },
+ },
+ {
+ type: 'Feature',
+ properties: {},
+ geometry: {
+ type: 'Point',
+ coordinates: [11.50245, 53.33014],
+ },
+ },
+ {
+ type: 'Feature',
+ properties: {},
+ geometry: {
+ type: 'Point',
+ coordinates: [11.50027, 53.33172],
+ },
+ },
+ {
+ type: 'Feature',
+ properties: {},
+ geometry: {
+ type: 'Point',
+ coordinates: [11.49907, 53.33241],
+ },
+ },
+ {
+ type: 'Feature',
+ properties: {},
+ geometry: {
+ type: 'Point',
+ coordinates: [11.49366, 53.33506],
+ },
+ },
+ {
+ type: 'Feature',
+ properties: {},
+ geometry: {
+ type: 'Point',
+ coordinates: [11.49366, 53.33506],
+ },
+ },
+ {
+ type: 'Feature',
+ properties: {},
+ geometry: {
+ type: 'Point',
+ coordinates: [11.45045, 53.35549],
+ },
+ },
+ {
+ type: 'Feature',
+ properties: {},
+ geometry: {
+ type: 'Point',
+ coordinates: [11.45045, 53.35549],
+ },
+ },
+ {
+ type: 'Feature',
+ properties: {},
+ geometry: {
+ type: 'Point',
+ coordinates: [11.40358, 53.37763],
+ },
+ },
+ {
+ type: 'Feature',
+ properties: {},
+ geometry: {
+ type: 'Point',
+ coordinates: [11.39713, 53.38052],
+ },
+ },
+ {
+ type: 'Feature',
+ properties: {},
+ geometry: {
+ type: 'Point',
+ coordinates: [11.39326, 53.3819],
+ },
+ },
+ {
+ type: 'Feature',
+ properties: {},
+ geometry: {
+ type: 'Point',
+ coordinates: [11.38919, 53.38305],
+ },
+ },
+ {
+ type: 'Feature',
+ properties: {},
+ geometry: {
+ type: 'Point',
+ coordinates: [11.37464, 53.38622],
+ },
+ },
+ {
+ type: 'Feature',
+ properties: {},
+ geometry: {
+ type: 'Point',
+ coordinates: [11.37464, 53.38622],
+ },
+ },
+ {
+ type: 'Feature',
+ properties: {},
+ geometry: {
+ type: 'Point',
+ coordinates: [11.31781, 53.39847],
+ },
+ },
+ {
+ type: 'Feature',
+ properties: {},
+ geometry: {
+ type: 'Point',
+ coordinates: [11.31781, 53.39847],
+ },
+ },
+ {
+ type: 'Feature',
+ properties: {},
+ geometry: {
+ type: 'Point',
+ coordinates: [11.24191, 53.41474],
+ },
+ },
+ {
+ type: 'Feature',
+ properties: {},
+ geometry: {
+ type: 'Point',
+ coordinates: [11.23624, 53.41587],
+ },
+ },
+ {
+ type: 'Feature',
+ properties: {},
+ geometry: {
+ type: 'Point',
+ coordinates: [11.23324, 53.41619],
+ },
+ },
+ {
+ type: 'Feature',
+ properties: {},
+ geometry: {
+ type: 'Point',
+ coordinates: [11.2305, 53.41627],
+ },
+ },
+ {
+ type: 'Feature',
+ properties: {},
+ geometry: {
+ type: 'Point',
+ coordinates: [11.22814, 53.41618],
+ },
+ },
+ {
+ type: 'Feature',
+ properties: {},
+ geometry: {
+ type: 'Point',
+ coordinates: [11.22597, 53.41597],
+ },
+ },
+ {
+ type: 'Feature',
+ properties: {},
+ geometry: {
+ type: 'Point',
+ coordinates: [11.22395, 53.41566],
+ },
+ },
+ {
+ type: 'Feature',
+ properties: {},
+ geometry: {
+ type: 'Point',
+ coordinates: [11.22151, 53.41512],
+ },
+ },
+ {
+ type: 'Feature',
+ properties: {},
+ geometry: {
+ type: 'Point',
+ coordinates: [11.21897, 53.4144],
+ },
+ },
+ {
+ type: 'Feature',
+ properties: {},
+ geometry: {
+ type: 'Point',
+ coordinates: [11.21576, 53.41327],
+ },
+ },
+ {
+ type: 'Feature',
+ properties: {},
+ geometry: {
+ type: 'Point',
+ coordinates: [11.2153, 53.41361],
+ },
+ },
+ {
+ type: 'Feature',
+ properties: {},
+ geometry: {
+ type: 'Point',
+ coordinates: [11.21199, 53.41173],
+ },
+ },
+ {
+ type: 'Feature',
+ properties: {},
+ geometry: {
+ type: 'Point',
+ coordinates: [11.20864, 53.4102],
+ },
+ },
+ {
+ type: 'Feature',
+ properties: {},
+ geometry: {
+ type: 'Point',
+ coordinates: [11.20778, 53.40993],
+ },
+ },
+ {
+ type: 'Feature',
+ properties: {},
+ geometry: {
+ type: 'Point',
+ coordinates: [11.20612, 53.40964],
+ },
+ },
+ {
+ type: 'Feature',
+ properties: {},
+ geometry: {
+ type: 'Point',
+ coordinates: [11.20612, 53.40964],
+ },
+ },
+ {
+ type: 'Feature',
+ properties: {},
+ geometry: {
+ type: 'Point',
+ coordinates: [11.20701, 53.4091],
+ },
+ },
+ {
+ type: 'Feature',
+ properties: {},
+ geometry: {
+ type: 'Point',
+ coordinates: [11.15773, 53.37663],
+ },
+ },
+ {
+ type: 'Feature',
+ properties: {},
+ geometry: {
+ type: 'Point',
+ coordinates: [11.15606, 53.37572],
+ },
+ },
+ {
+ type: 'Feature',
+ properties: {},
+ geometry: {
+ type: 'Point',
+ coordinates: [11.15427, 53.3749],
+ },
+ },
+ {
+ type: 'Feature',
+ properties: {},
+ geometry: {
+ type: 'Point',
+ coordinates: [11.15106, 53.37375],
+ },
+ },
+ {
+ type: 'Feature',
+ properties: {},
+ geometry: {
+ type: 'Point',
+ coordinates: [11.1476, 53.37287],
+ },
+ },
+ {
+ type: 'Feature',
+ properties: {},
+ geometry: {
+ type: 'Point',
+ coordinates: [11.14299, 53.37216],
+ },
+ },
+ {
+ type: 'Feature',
+ properties: {},
+ geometry: {
+ type: 'Point',
+ coordinates: [11.14299, 53.37216],
+ },
+ },
+ {
+ type: 'Feature',
+ properties: {},
+ geometry: {
+ type: 'Point',
+ coordinates: [11.08354, 53.36499],
+ },
+ },
+ {
+ type: 'Feature',
+ properties: {},
+ geometry: {
+ type: 'Point',
+ coordinates: [11.08354, 53.36499],
+ },
+ },
+ {
+ type: 'Feature',
+ properties: {},
+ geometry: {
+ type: 'Point',
+ coordinates: [11.02743, 53.35819],
+ },
+ },
+ {
+ type: 'Feature',
+ properties: {},
+ geometry: {
+ type: 'Point',
+ coordinates: [11.02384, 53.35785],
+ },
+ },
+ {
+ type: 'Feature',
+ properties: {},
+ geometry: {
+ type: 'Point',
+ coordinates: [11.02009, 53.35773],
+ },
+ },
+ {
+ type: 'Feature',
+ properties: {},
+ geometry: {
+ type: 'Point',
+ coordinates: [10.98705, 53.35799],
+ },
+ },
+ {
+ type: 'Feature',
+ properties: {},
+ geometry: {
+ type: 'Point',
+ coordinates: [10.98405, 53.3581],
+ },
+ },
+ {
+ type: 'Feature',
+ properties: {},
+ geometry: {
+ type: 'Point',
+ coordinates: [10.98183, 53.35829],
+ },
+ },
+ {
+ type: 'Feature',
+ properties: {},
+ geometry: {
+ type: 'Point',
+ coordinates: [10.97962, 53.35856],
+ },
+ },
+ {
+ type: 'Feature',
+ properties: {},
+ geometry: {
+ type: 'Point',
+ coordinates: [10.97674, 53.35906],
+ },
+ },
+ {
+ type: 'Feature',
+ properties: {},
+ geometry: {
+ type: 'Point',
+ coordinates: [10.95201, 53.36442],
+ },
+ },
+ {
+ type: 'Feature',
+ properties: {},
+ geometry: {
+ type: 'Point',
+ coordinates: [10.95201, 53.36442],
+ },
+ },
+ {
+ type: 'Feature',
+ properties: {},
+ geometry: {
+ type: 'Point',
+ coordinates: [10.90455, 53.37471],
+ },
+ },
+ {
+ type: 'Feature',
+ properties: {},
+ geometry: {
+ type: 'Point',
+ coordinates: [10.90024, 53.37551],
+ },
+ },
+ {
+ type: 'Feature',
+ properties: {},
+ geometry: {
+ type: 'Point',
+ coordinates: [10.89731, 53.3759],
+ },
+ },
+ {
+ type: 'Feature',
+ properties: {},
+ geometry: {
+ type: 'Point',
+ coordinates: [10.89434, 53.37617],
+ },
+ },
+ {
+ type: 'Feature',
+ properties: {},
+ geometry: {
+ type: 'Point',
+ coordinates: [10.89135, 53.37631],
+ },
+ },
+ {
+ type: 'Feature',
+ properties: {},
+ geometry: {
+ type: 'Point',
+ coordinates: [10.88684, 53.37635],
+ },
+ },
+ {
+ type: 'Feature',
+ properties: {},
+ geometry: {
+ type: 'Point',
+ coordinates: [10.76786, 53.37606],
+ },
+ },
+ {
+ type: 'Feature',
+ properties: {},
+ geometry: {
+ type: 'Point',
+ coordinates: [10.76411, 53.37619],
+ },
+ },
+ {
+ type: 'Feature',
+ properties: {},
+ geometry: {
+ type: 'Point',
+ coordinates: [10.76042, 53.37662],
+ },
+ },
+ {
+ type: 'Feature',
+ properties: {},
+ geometry: {
+ type: 'Point',
+ coordinates: [10.75756, 53.37718],
+ },
+ },
+ {
+ type: 'Feature',
+ properties: {},
+ geometry: {
+ type: 'Point',
+ coordinates: [10.75411, 53.37813],
+ },
+ },
+ {
+ type: 'Feature',
+ properties: {},
+ geometry: {
+ type: 'Point',
+ coordinates: [10.75411, 53.37813],
+ },
+ },
+ {
+ type: 'Feature',
+ properties: {},
+ geometry: {
+ type: 'Point',
+ coordinates: [10.74951, 53.37959],
+ },
+ },
+ {
+ type: 'Feature',
+ properties: {},
+ geometry: {
+ type: 'Point',
+ coordinates: [10.74639, 53.38083],
+ },
+ },
+ {
+ type: 'Feature',
+ properties: {},
+ geometry: {
+ type: 'Point',
+ coordinates: [10.74343, 53.38242],
+ },
+ },
+ {
+ type: 'Feature',
+ properties: {},
+ geometry: {
+ type: 'Point',
+ coordinates: [10.74114, 53.38403],
+ },
+ },
+ {
+ type: 'Feature',
+ properties: {},
+ geometry: {
+ type: 'Point',
+ coordinates: [10.73225, 53.39182],
+ },
+ },
+ {
+ type: 'Feature',
+ properties: {},
+ geometry: {
+ type: 'Point',
+ coordinates: [10.68993, 53.42813],
+ },
+ },
+ {
+ type: 'Feature',
+ properties: {},
+ geometry: {
+ type: 'Point',
+ coordinates: [10.68993, 53.42813],
+ },
+ },
+ {
+ type: 'Feature',
+ properties: {},
+ geometry: {
+ type: 'Point',
+ coordinates: [10.65985, 53.45385],
+ },
+ },
+ {
+ type: 'Feature',
+ properties: {},
+ geometry: {
+ type: 'Point',
+ coordinates: [10.65601, 53.45662],
+ },
+ },
+ {
+ type: 'Feature',
+ properties: {},
+ geometry: {
+ type: 'Point',
+ coordinates: [10.64984, 53.46022],
+ },
+ },
+ {
+ type: 'Feature',
+ properties: {},
+ geometry: {
+ type: 'Point',
+ coordinates: [10.64984, 53.46022],
+ },
+ },
+ {
+ type: 'Feature',
+ properties: {},
+ geometry: {
+ type: 'Point',
+ coordinates: [10.64982, 53.46022],
+ },
+ },
+ {
+ type: 'Feature',
+ properties: {},
+ geometry: {
+ type: 'Point',
+ coordinates: [10.64982, 53.46022],
+ },
+ },
+ {
+ type: 'Feature',
+ properties: {},
+ geometry: {
+ type: 'Point',
+ coordinates: [10.62314, 53.47542],
+ },
+ },
+ {
+ type: 'Feature',
+ properties: {},
+ geometry: {
+ type: 'Point',
+ coordinates: [10.62268, 53.47521],
+ },
+ },
+ {
+ type: 'Feature',
+ properties: {},
+ geometry: {
+ type: 'Point',
+ coordinates: [10.62181, 53.47606],
+ },
+ },
+ {
+ type: 'Feature',
+ properties: {},
+ geometry: {
+ type: 'Point',
+ coordinates: [10.62098, 53.47663],
+ },
+ },
+ {
+ type: 'Feature',
+ properties: {},
+ geometry: {
+ type: 'Point',
+ coordinates: [10.61977, 53.47735],
+ },
+ },
+ {
+ type: 'Feature',
+ properties: {},
+ geometry: {
+ type: 'Point',
+ coordinates: [10.61131, 53.48209],
+ },
+ },
+ {
+ type: 'Feature',
+ properties: {},
+ geometry: {
+ type: 'Point',
+ coordinates: [10.61131, 53.48209],
+ },
+ },
+ {
+ type: 'Feature',
+ properties: {},
+ geometry: {
+ type: 'Point',
+ coordinates: [10.60795, 53.4839],
+ },
+ },
+ {
+ type: 'Feature',
+ properties: {},
+ geometry: {
+ type: 'Point',
+ coordinates: [10.60315, 53.48606],
+ },
+ },
+ {
+ type: 'Feature',
+ properties: {},
+ geometry: {
+ type: 'Point',
+ coordinates: [10.59996, 53.48726],
+ },
+ },
+ {
+ type: 'Feature',
+ properties: {},
+ geometry: {
+ type: 'Point',
+ coordinates: [10.59079, 53.49017],
+ },
+ },
+ {
+ type: 'Feature',
+ properties: {},
+ geometry: {
+ type: 'Point',
+ coordinates: [10.59079, 53.49017],
+ },
+ },
+ {
+ type: 'Feature',
+ properties: {},
+ geometry: {
+ type: 'Point',
+ coordinates: [10.55908, 53.50015],
+ },
+ },
+ {
+ type: 'Feature',
+ properties: {},
+ geometry: {
+ type: 'Point',
+ coordinates: [10.55908, 53.50015],
+ },
+ },
+ {
+ type: 'Feature',
+ properties: {},
+ geometry: {
+ type: 'Point',
+ coordinates: [10.54596, 53.50428],
+ },
+ },
+ {
+ type: 'Feature',
+ properties: {},
+ geometry: {
+ type: 'Point',
+ coordinates: [10.54324, 53.50506],
+ },
+ },
+ {
+ type: 'Feature',
+ properties: {},
+ geometry: {
+ type: 'Point',
+ coordinates: [10.53969, 53.5058],
+ },
+ },
+ {
+ type: 'Feature',
+ properties: {},
+ geometry: {
+ type: 'Point',
+ coordinates: [10.53749, 53.50611],
+ },
+ },
+ {
+ type: 'Feature',
+ properties: {},
+ geometry: {
+ type: 'Point',
+ coordinates: [10.53526, 53.50631],
+ },
+ },
+ {
+ type: 'Feature',
+ properties: {},
+ geometry: {
+ type: 'Point',
+ coordinates: [10.533, 53.5064],
+ },
+ },
+ {
+ type: 'Feature',
+ properties: {},
+ geometry: {
+ type: 'Point',
+ coordinates: [10.53074, 53.50638],
+ },
+ },
+ {
+ type: 'Feature',
+ properties: {},
+ geometry: {
+ type: 'Point',
+ coordinates: [10.52774, 53.50618],
+ },
+ },
+ {
+ type: 'Feature',
+ properties: {},
+ geometry: {
+ type: 'Point',
+ coordinates: [10.52553, 53.5059],
+ },
+ },
+ {
+ type: 'Feature',
+ properties: {},
+ geometry: {
+ type: 'Point',
+ coordinates: [10.52337, 53.50552],
+ },
+ },
+ {
+ type: 'Feature',
+ properties: {},
+ geometry: {
+ type: 'Point',
+ coordinates: [10.52126, 53.50504],
+ },
+ },
+ {
+ type: 'Feature',
+ properties: {},
+ geometry: {
+ type: 'Point',
+ coordinates: [10.51294, 53.50272],
+ },
+ },
+ {
+ type: 'Feature',
+ properties: {},
+ geometry: {
+ type: 'Point',
+ coordinates: [10.51084, 53.50222],
+ },
+ },
+ {
+ type: 'Feature',
+ properties: {},
+ geometry: {
+ type: 'Point',
+ coordinates: [10.50794, 53.50172],
+ },
+ },
+ {
+ type: 'Feature',
+ properties: {},
+ geometry: {
+ type: 'Point',
+ coordinates: [10.50422, 53.50138],
+ },
+ },
+ {
+ type: 'Feature',
+ properties: {},
+ geometry: {
+ type: 'Point',
+ coordinates: [10.49971, 53.50139],
+ },
+ },
+ {
+ type: 'Feature',
+ properties: {},
+ geometry: {
+ type: 'Point',
+ coordinates: [10.49524, 53.50178],
+ },
+ },
+ {
+ type: 'Feature',
+ properties: {},
+ geometry: {
+ type: 'Point',
+ coordinates: [10.49232, 53.50222],
+ },
+ },
+ {
+ type: 'Feature',
+ properties: {},
+ geometry: {
+ type: 'Point',
+ coordinates: [10.48489, 53.50381],
+ },
+ },
+ {
+ type: 'Feature',
+ properties: {},
+ geometry: {
+ type: 'Point',
+ coordinates: [10.48489, 53.50381],
+ },
+ },
+ {
+ type: 'Feature',
+ properties: {},
+ geometry: {
+ type: 'Point',
+ coordinates: [10.48163, 53.50441],
+ },
+ },
+ {
+ type: 'Feature',
+ properties: {},
+ geometry: {
+ type: 'Point',
+ coordinates: [10.47869, 53.50479],
+ },
+ },
+ {
+ type: 'Feature',
+ properties: {},
+ geometry: {
+ type: 'Point',
+ coordinates: [10.46895, 53.50542],
+ },
+ },
+ {
+ type: 'Feature',
+ properties: {},
+ geometry: {
+ type: 'Point',
+ coordinates: [10.46598, 53.5057],
+ },
+ },
+ {
+ type: 'Feature',
+ properties: {},
+ geometry: {
+ type: 'Point',
+ coordinates: [10.46235, 53.50631],
+ },
+ },
+ {
+ type: 'Feature',
+ properties: {},
+ geometry: {
+ type: 'Point',
+ coordinates: [10.45956, 53.507],
+ },
+ },
+ {
+ type: 'Feature',
+ properties: {},
+ geometry: {
+ type: 'Point',
+ coordinates: [10.45692, 53.50785],
+ },
+ },
+ {
+ type: 'Feature',
+ properties: {},
+ geometry: {
+ type: 'Point',
+ coordinates: [10.45505, 53.50861],
+ },
+ },
+ {
+ type: 'Feature',
+ properties: {},
+ geometry: {
+ type: 'Point',
+ coordinates: [10.42782, 53.52066],
+ },
+ },
+ {
+ type: 'Feature',
+ properties: {},
+ geometry: {
+ type: 'Point',
+ coordinates: [10.42587, 53.52134],
+ },
+ },
+ {
+ type: 'Feature',
+ properties: {},
+ geometry: {
+ type: 'Point',
+ coordinates: [10.42384, 53.52193],
+ },
+ },
+ {
+ type: 'Feature',
+ properties: {},
+ geometry: {
+ type: 'Point',
+ coordinates: [10.42029, 53.52268],
+ },
+ },
+ {
+ type: 'Feature',
+ properties: {},
+ geometry: {
+ type: 'Point',
+ coordinates: [10.41809, 53.523],
+ },
+ },
+ {
+ type: 'Feature',
+ properties: {},
+ geometry: {
+ type: 'Point',
+ coordinates: [10.41586, 53.52321],
+ },
+ },
+ {
+ type: 'Feature',
+ properties: {},
+ geometry: {
+ type: 'Point',
+ coordinates: [10.4136, 53.52331],
+ },
+ },
+ {
+ type: 'Feature',
+ properties: {},
+ geometry: {
+ type: 'Point',
+ coordinates: [10.41134, 53.5233],
+ },
+ },
+ {
+ type: 'Feature',
+ properties: {},
+ geometry: {
+ type: 'Point',
+ coordinates: [10.37228, 53.52093],
+ },
+ },
+ {
+ type: 'Feature',
+ properties: {},
+ geometry: {
+ type: 'Point',
+ coordinates: [10.36926, 53.52083],
+ },
+ },
+ {
+ type: 'Feature',
+ properties: {},
+ geometry: {
+ type: 'Point',
+ coordinates: [10.36626, 53.52092],
+ },
+ },
+ {
+ type: 'Feature',
+ properties: {},
+ geometry: {
+ type: 'Point',
+ coordinates: [10.36256, 53.52134],
+ },
+ },
+ {
+ type: 'Feature',
+ properties: {},
+ geometry: {
+ type: 'Point',
+ coordinates: [10.3604, 53.52174],
+ },
+ },
+ {
+ type: 'Feature',
+ properties: {},
+ geometry: {
+ type: 'Point',
+ coordinates: [10.35832, 53.52227],
+ },
+ },
+ {
+ type: 'Feature',
+ properties: {},
+ geometry: {
+ type: 'Point',
+ coordinates: [10.35568, 53.52313],
+ },
+ },
+ {
+ type: 'Feature',
+ properties: {},
+ geometry: {
+ type: 'Point',
+ coordinates: [10.3502, 53.52552],
+ },
+ },
+ {
+ type: 'Feature',
+ properties: {},
+ geometry: {
+ type: 'Point',
+ coordinates: [10.34828, 53.52623],
+ },
+ },
+ {
+ type: 'Feature',
+ properties: {},
+ geometry: {
+ type: 'Point',
+ coordinates: [10.34487, 53.52718],
+ },
+ },
+ {
+ type: 'Feature',
+ properties: {},
+ geometry: {
+ type: 'Point',
+ coordinates: [10.34107, 53.5279],
+ },
+ },
+ {
+ type: 'Feature',
+ properties: {},
+ geometry: {
+ type: 'Point',
+ coordinates: [10.34107, 53.5279],
+ },
+ },
+ {
+ type: 'Feature',
+ properties: {},
+ geometry: {
+ type: 'Point',
+ coordinates: [10.33396, 53.5291],
+ },
+ },
+ {
+ type: 'Feature',
+ properties: {},
+ geometry: {
+ type: 'Point',
+ coordinates: [10.32878, 53.52967],
+ },
+ },
+ {
+ type: 'Feature',
+ properties: {},
+ geometry: {
+ type: 'Point',
+ coordinates: [10.32427, 53.52993],
+ },
+ },
+ {
+ type: 'Feature',
+ properties: {},
+ geometry: {
+ type: 'Point',
+ coordinates: [10.31961, 53.52997],
+ },
+ },
+ {
+ type: 'Feature',
+ properties: {},
+ geometry: {
+ type: 'Point',
+ coordinates: [10.3196, 53.53001],
+ },
+ },
+ {
+ type: 'Feature',
+ properties: {},
+ geometry: {
+ type: 'Point',
+ coordinates: [10.31932, 53.52997],
+ },
+ },
+ {
+ type: 'Feature',
+ properties: {},
+ geometry: {
+ type: 'Point',
+ coordinates: [10.31483, 53.52992],
+ },
+ },
+ {
+ type: 'Feature',
+ properties: {},
+ geometry: {
+ type: 'Point',
+ coordinates: [10.31475, 53.53004],
+ },
+ },
+ {
+ type: 'Feature',
+ properties: {},
+ geometry: {
+ type: 'Point',
+ coordinates: [10.31334, 53.52995],
+ },
+ },
+ {
+ type: 'Feature',
+ properties: {},
+ geometry: {
+ type: 'Point',
+ coordinates: [10.30808, 53.52934],
+ },
+ },
+ {
+ type: 'Feature',
+ properties: {},
+ geometry: {
+ type: 'Point',
+ coordinates: [10.303, 53.52852],
+ },
+ },
+ {
+ type: 'Feature',
+ properties: {},
+ geometry: {
+ type: 'Point',
+ coordinates: [10.3002, 53.52793],
+ },
+ },
+ {
+ type: 'Feature',
+ properties: {},
+ geometry: {
+ type: 'Point',
+ coordinates: [10.28762, 53.52489],
+ },
+ },
+ {
+ type: 'Feature',
+ properties: {},
+ geometry: {
+ type: 'Point',
+ coordinates: [10.28493, 53.52409],
+ },
+ },
+ {
+ type: 'Feature',
+ properties: {},
+ geometry: {
+ type: 'Point',
+ coordinates: [10.28241, 53.52309],
+ },
+ },
+ {
+ type: 'Feature',
+ properties: {},
+ geometry: {
+ type: 'Point',
+ coordinates: [10.28011, 53.52194],
+ },
+ },
+ {
+ type: 'Feature',
+ properties: {},
+ geometry: {
+ type: 'Point',
+ coordinates: [10.27811, 53.52067],
+ },
+ },
+ {
+ type: 'Feature',
+ properties: {},
+ geometry: {
+ type: 'Point',
+ coordinates: [10.27811, 53.52067],
+ },
+ },
+ {
+ type: 'Feature',
+ properties: {},
+ geometry: {
+ type: 'Point',
+ coordinates: [10.27624, 53.51919],
+ },
+ },
+ {
+ type: 'Feature',
+ properties: {},
+ geometry: {
+ type: 'Point',
+ coordinates: [10.27321, 53.51609],
+ },
+ },
+ {
+ type: 'Feature',
+ properties: {},
+ geometry: {
+ type: 'Point',
+ coordinates: [10.27192, 53.51498],
+ },
+ },
+ {
+ type: 'Feature',
+ properties: {},
+ geometry: {
+ type: 'Point',
+ coordinates: [10.26996, 53.51361],
+ },
+ },
+ {
+ type: 'Feature',
+ properties: {},
+ geometry: {
+ type: 'Point',
+ coordinates: [10.26774, 53.5124],
+ },
+ },
+ {
+ type: 'Feature',
+ properties: {},
+ geometry: {
+ type: 'Point',
+ coordinates: [10.2653, 53.51135],
+ },
+ },
+ {
+ type: 'Feature',
+ properties: {},
+ geometry: {
+ type: 'Point',
+ coordinates: [10.26265, 53.51049],
+ },
+ },
+ {
+ type: 'Feature',
+ properties: {},
+ geometry: {
+ type: 'Point',
+ coordinates: [10.26057, 53.50996],
+ },
+ },
+ {
+ type: 'Feature',
+ properties: {},
+ geometry: {
+ type: 'Point',
+ coordinates: [10.25488, 53.50878],
+ },
+ },
+ {
+ type: 'Feature',
+ properties: {},
+ geometry: {
+ type: 'Point',
+ coordinates: [10.25198, 53.50802],
+ },
+ },
+ {
+ type: 'Feature',
+ properties: {},
+ geometry: {
+ type: 'Point',
+ coordinates: [10.25205, 53.50793],
+ },
+ },
+ {
+ type: 'Feature',
+ properties: {},
+ geometry: {
+ type: 'Point',
+ coordinates: [10.2492, 53.50694],
+ },
+ },
+ {
+ type: 'Feature',
+ properties: {},
+ geometry: {
+ type: 'Point',
+ coordinates: [10.24742, 53.50612],
+ },
+ },
+ {
+ type: 'Feature',
+ properties: {},
+ geometry: {
+ type: 'Point',
+ coordinates: [10.24576, 53.5052],
+ },
+ },
+ {
+ type: 'Feature',
+ properties: {},
+ geometry: {
+ type: 'Point',
+ coordinates: [10.24378, 53.50384],
+ },
+ },
+ {
+ type: 'Feature',
+ properties: {},
+ geometry: {
+ type: 'Point',
+ coordinates: [10.24028, 53.50092],
+ },
+ },
+ {
+ type: 'Feature',
+ properties: {},
+ geometry: {
+ type: 'Point',
+ coordinates: [10.23766, 53.49931],
+ },
+ },
+ {
+ type: 'Feature',
+ properties: {},
+ geometry: {
+ type: 'Point',
+ coordinates: [10.23462, 53.49798],
+ },
+ },
+ {
+ type: 'Feature',
+ properties: {},
+ geometry: {
+ type: 'Point',
+ coordinates: [10.23126, 53.49698],
+ },
+ },
+ {
+ type: 'Feature',
+ properties: {},
+ geometry: {
+ type: 'Point',
+ coordinates: [10.23126, 53.49698],
+ },
+ },
+ {
+ type: 'Feature',
+ properties: {},
+ geometry: {
+ type: 'Point',
+ coordinates: [10.2312, 53.49707],
+ },
+ },
+ {
+ type: 'Feature',
+ properties: {},
+ geometry: {
+ type: 'Point',
+ coordinates: [10.22803, 53.49646],
+ },
+ },
+ {
+ type: 'Feature',
+ properties: {},
+ geometry: {
+ type: 'Point',
+ coordinates: [10.22509, 53.49612],
+ },
+ },
+ {
+ type: 'Feature',
+ properties: {},
+ geometry: {
+ type: 'Point',
+ coordinates: [10.22509, 53.49612],
+ },
+ },
+ {
+ type: 'Feature',
+ properties: {},
+ geometry: {
+ type: 'Point',
+ coordinates: [10.22509, 53.49612],
+ },
+ },
+ {
+ type: 'Feature',
+ properties: {},
+ geometry: {
+ type: 'Point',
+ coordinates: [10.22212, 53.49576],
+ },
+ },
+ {
+ type: 'Feature',
+ properties: {},
+ geometry: {
+ type: 'Point',
+ coordinates: [10.21995, 53.49538],
+ },
+ },
+ {
+ type: 'Feature',
+ properties: {},
+ geometry: {
+ type: 'Point',
+ coordinates: [10.21788, 53.49485],
+ },
+ },
+ {
+ type: 'Feature',
+ properties: {},
+ geometry: {
+ type: 'Point',
+ coordinates: [10.21587, 53.49422],
+ },
+ },
+ {
+ type: 'Feature',
+ properties: {},
+ geometry: {
+ type: 'Point',
+ coordinates: [10.21395, 53.49351],
+ },
+ },
+ {
+ type: 'Feature',
+ properties: {},
+ geometry: {
+ type: 'Point',
+ coordinates: [10.21151, 53.49246],
+ },
+ },
+ {
+ type: 'Feature',
+ properties: {},
+ geometry: {
+ type: 'Point',
+ coordinates: [10.20626, 53.48986],
+ },
+ },
+ {
+ type: 'Feature',
+ properties: {},
+ geometry: {
+ type: 'Point',
+ coordinates: [10.20626, 53.48986],
+ },
+ },
+ {
+ type: 'Feature',
+ properties: {},
+ geometry: {
+ type: 'Point',
+ coordinates: [10.20625, 53.48986],
+ },
+ },
+ {
+ type: 'Feature',
+ properties: {},
+ geometry: {
+ type: 'Point',
+ coordinates: [10.20625, 53.48986],
+ },
+ },
+ {
+ type: 'Feature',
+ properties: {},
+ geometry: {
+ type: 'Point',
+ coordinates: [10.20625, 53.48986],
+ },
+ },
+ {
+ type: 'Feature',
+ properties: {},
+ geometry: {
+ type: 'Point',
+ coordinates: [10.20391, 53.48879],
+ },
+ },
+ {
+ type: 'Feature',
+ properties: {},
+ geometry: {
+ type: 'Point',
+ coordinates: [10.20129, 53.4879],
+ },
+ },
+ {
+ type: 'Feature',
+ properties: {},
+ geometry: {
+ type: 'Point',
+ coordinates: [10.19849, 53.48725],
+ },
+ },
+ {
+ type: 'Feature',
+ properties: {},
+ geometry: {
+ type: 'Point',
+ coordinates: [10.19555, 53.48687],
+ },
+ },
+ {
+ type: 'Feature',
+ properties: {},
+ geometry: {
+ type: 'Point',
+ coordinates: [10.19104, 53.48684],
+ },
+ },
+ {
+ type: 'Feature',
+ properties: {},
+ geometry: {
+ type: 'Point',
+ coordinates: [10.18188, 53.48784],
+ },
+ },
+ {
+ type: 'Feature',
+ properties: {},
+ geometry: {
+ type: 'Point',
+ coordinates: [10.18185, 53.48772],
+ },
+ },
+ {
+ type: 'Feature',
+ properties: {},
+ geometry: {
+ type: 'Point',
+ coordinates: [10.18185, 53.48772],
+ },
+ },
+ {
+ type: 'Feature',
+ properties: {},
+ geometry: {
+ type: 'Point',
+ coordinates: [10.18124, 53.48779],
+ },
+ },
+ {
+ type: 'Feature',
+ properties: {},
+ geometry: {
+ type: 'Point',
+ coordinates: [10.18128, 53.48791],
+ },
+ },
+ {
+ type: 'Feature',
+ properties: {},
+ geometry: {
+ type: 'Point',
+ coordinates: [10.15867, 53.49036],
+ },
+ },
+ {
+ type: 'Feature',
+ properties: {},
+ geometry: {
+ type: 'Point',
+ coordinates: [10.15867, 53.49036],
+ },
+ },
+ {
+ type: 'Feature',
+ properties: {},
+ geometry: {
+ type: 'Point',
+ coordinates: [10.15369, 53.49093],
+ },
+ },
+ {
+ type: 'Feature',
+ properties: {},
+ geometry: {
+ type: 'Point',
+ coordinates: [10.15366, 53.49084],
+ },
+ },
+ {
+ type: 'Feature',
+ properties: {},
+ geometry: {
+ type: 'Point',
+ coordinates: [10.15369, 53.49093],
+ },
+ },
+ {
+ type: 'Feature',
+ properties: {},
+ geometry: {
+ type: 'Point',
+ coordinates: [10.15034, 53.49143],
+ },
+ },
+ {
+ type: 'Feature',
+ properties: {},
+ geometry: {
+ type: 'Point',
+ coordinates: [10.14748, 53.492],
+ },
+ },
+ {
+ type: 'Feature',
+ properties: {},
+ geometry: {
+ type: 'Point',
+ coordinates: [10.14195, 53.49342],
+ },
+ },
+ {
+ type: 'Feature',
+ properties: {},
+ geometry: {
+ type: 'Point',
+ coordinates: [10.13934, 53.49431],
+ },
+ },
+ {
+ type: 'Feature',
+ properties: {},
+ geometry: {
+ type: 'Point',
+ coordinates: [10.13687, 53.49534],
+ },
+ },
+ {
+ type: 'Feature',
+ properties: {},
+ geometry: {
+ type: 'Point',
+ coordinates: [10.13064, 53.49832],
+ },
+ },
+ {
+ type: 'Feature',
+ properties: {},
+ geometry: {
+ type: 'Point',
+ coordinates: [10.13064, 53.49832],
+ },
+ },
+ {
+ type: 'Feature',
+ properties: {},
+ geometry: {
+ type: 'Point',
+ coordinates: [10.12307, 53.50231],
+ },
+ },
+ {
+ type: 'Feature',
+ properties: {},
+ geometry: {
+ type: 'Point',
+ coordinates: [10.11319, 53.5073],
+ },
+ },
+ {
+ type: 'Feature',
+ properties: {},
+ geometry: {
+ type: 'Point',
+ coordinates: [10.11319, 53.5073],
+ },
+ },
+ {
+ type: 'Feature',
+ properties: {},
+ geometry: {
+ type: 'Point',
+ coordinates: [10.11296, 53.50715],
+ },
+ },
+ {
+ type: 'Feature',
+ properties: {},
+ geometry: {
+ type: 'Point',
+ coordinates: [10.11265, 53.50732],
+ },
+ },
+ {
+ type: 'Feature',
+ properties: {},
+ geometry: {
+ type: 'Point',
+ coordinates: [10.09793, 53.5148],
+ },
+ },
+ {
+ type: 'Feature',
+ properties: {},
+ geometry: {
+ type: 'Point',
+ coordinates: [10.09799, 53.51483],
+ },
+ },
+ {
+ type: 'Feature',
+ properties: {},
+ geometry: {
+ type: 'Point',
+ coordinates: [10.09793, 53.5148],
+ },
+ },
+ {
+ type: 'Feature',
+ properties: {},
+ geometry: {
+ type: 'Point',
+ coordinates: [10.09685, 53.51534],
+ },
+ },
+ {
+ type: 'Feature',
+ properties: {},
+ geometry: {
+ type: 'Point',
+ coordinates: [10.09693, 53.5154],
+ },
+ },
+ {
+ type: 'Feature',
+ properties: {},
+ geometry: {
+ type: 'Point',
+ coordinates: [10.07175, 53.52804],
+ },
+ },
+ {
+ type: 'Feature',
+ properties: {},
+ geometry: {
+ type: 'Point',
+ coordinates: [10.06978, 53.52904],
+ },
+ },
+ {
+ type: 'Feature',
+ properties: {},
+ geometry: {
+ type: 'Point',
+ coordinates: [10.06973, 53.52901],
+ },
+ },
+ {
+ type: 'Feature',
+ properties: {},
+ geometry: {
+ type: 'Point',
+ coordinates: [10.06969, 53.52899],
+ },
+ },
+ {
+ type: 'Feature',
+ properties: {},
+ geometry: {
+ type: 'Point',
+ coordinates: [10.06647, 53.53056],
+ },
+ },
+ {
+ type: 'Feature',
+ properties: {},
+ geometry: {
+ type: 'Point',
+ coordinates: [10.06655, 53.53063],
+ },
+ },
+ {
+ type: 'Feature',
+ properties: {},
+ geometry: {
+ type: 'Point',
+ coordinates: [10.05948, 53.53359],
+ },
+ },
+ {
+ type: 'Feature',
+ properties: {},
+ geometry: {
+ type: 'Point',
+ coordinates: [10.05426, 53.53536],
+ },
+ },
+ {
+ type: 'Feature',
+ properties: {},
+ geometry: {
+ type: 'Point',
+ coordinates: [10.05258, 53.53586],
+ },
+ },
+ {
+ type: 'Feature',
+ properties: {},
+ geometry: {
+ type: 'Point',
+ coordinates: [10.05257, 53.53585],
+ },
+ },
+ {
+ type: 'Feature',
+ properties: {},
+ geometry: {
+ type: 'Point',
+ coordinates: [10.05254, 53.5358],
+ },
+ },
+ {
+ type: 'Feature',
+ properties: {},
+ geometry: {
+ type: 'Point',
+ coordinates: [10.05088, 53.5361],
+ },
+ },
+ {
+ type: 'Feature',
+ properties: {},
+ geometry: {
+ type: 'Point',
+ coordinates: [10.04571, 53.53672],
+ },
+ },
+ {
+ type: 'Feature',
+ properties: {},
+ geometry: {
+ type: 'Point',
+ coordinates: [10.03906, 53.53792],
+ },
+ },
+ {
+ type: 'Feature',
+ properties: {},
+ geometry: {
+ type: 'Point',
+ coordinates: [10.03905, 53.5379],
+ },
+ },
+ {
+ type: 'Feature',
+ properties: {},
+ geometry: {
+ type: 'Point',
+ coordinates: [10.03906, 53.53792],
+ },
+ },
+ {
+ type: 'Feature',
+ properties: {},
+ geometry: {
+ type: 'Point',
+ coordinates: [10.03188, 53.53976],
+ },
+ },
+ {
+ type: 'Feature',
+ properties: {},
+ geometry: {
+ type: 'Point',
+ coordinates: [10.02942, 53.54022],
+ },
+ },
+ {
+ type: 'Feature',
+ properties: {},
+ geometry: {
+ type: 'Point',
+ coordinates: [10.02807, 53.54062],
+ },
+ },
+ {
+ type: 'Feature',
+ properties: {},
+ geometry: {
+ type: 'Point',
+ coordinates: [10.02363, 53.54233],
+ },
+ },
+ {
+ type: 'Feature',
+ properties: {},
+ geometry: {
+ type: 'Point',
+ coordinates: [10.02165, 53.54297],
+ },
+ },
+ {
+ type: 'Feature',
+ properties: {},
+ geometry: {
+ type: 'Point',
+ coordinates: [10.01983, 53.54376],
+ },
+ },
+ {
+ type: 'Feature',
+ properties: {},
+ geometry: {
+ type: 'Point',
+ coordinates: [10.01789, 53.54445],
+ },
+ },
+ {
+ type: 'Feature',
+ properties: {},
+ geometry: {
+ type: 'Point',
+ coordinates: [10.01648, 53.54477],
+ },
+ },
+ {
+ type: 'Feature',
+ properties: {},
+ geometry: {
+ type: 'Point',
+ coordinates: [10.01353, 53.54515],
+ },
+ },
+ {
+ type: 'Feature',
+ properties: {},
+ geometry: {
+ type: 'Point',
+ coordinates: [10.00972, 53.54659],
+ },
+ },
+ {
+ type: 'Feature',
+ properties: {},
+ geometry: {
+ type: 'Point',
+ coordinates: [10.00864, 53.54722],
+ },
+ },
+ {
+ type: 'Feature',
+ properties: {},
+ geometry: {
+ type: 'Point',
+ coordinates: [10.00785, 53.54797],
+ },
+ },
+ {
+ type: 'Feature',
+ properties: {},
+ geometry: {
+ type: 'Point',
+ coordinates: [10.00749, 53.54884],
+ },
+ },
+ {
+ type: 'Feature',
+ properties: {},
+ geometry: {
+ type: 'Point',
+ coordinates: [10.00728, 53.55017],
+ },
+ },
+ {
+ type: 'Feature',
+ properties: {},
+ geometry: {
+ type: 'Point',
+ coordinates: [10.00731, 53.55131],
+ },
+ },
+ {
+ type: 'Feature',
+ properties: {},
+ geometry: {
+ type: 'Point',
+ coordinates: [10.00683, 53.55267],
+ },
+ },
+ {
+ type: 'Feature',
+ properties: {},
+ geometry: {
+ type: 'Point',
+ coordinates: [10.00703, 53.55368],
+ },
+ },
+ {
+ type: 'Feature',
+ properties: {},
+ geometry: {
+ type: 'Point',
+ coordinates: [10.007, 53.55371],
+ },
+ },
+ {
+ type: 'Feature',
+ properties: {
+ type: 'stop',
+ id: '8002549',
+ name: 'Hamburg Hbf',
+ location: {
+ type: 'location',
+ id: '8002549',
+ latitude: 53.553533,
+ longitude: 10.00636,
+ },
+ products: {
+ nationalExpress: true,
+ national: true,
+ regionalExpress: true,
+ regional: true,
+ suburban: true,
+ bus: true,
+ ferry: false,
+ subway: true,
+ tram: false,
+ taxi: false,
+ },
+ },
+ geometry: {
+ type: 'Point',
+ coordinates: [10.00636, 53.55354],
+ },
+ },
+ ],
},
- 'tripId': '1|244757|0|80|27072020',
- 'line': {
- 'type': 'line',
- 'id': 'ice-696',
- 'fahrtNr': '696',
- 'name': 'ICE 696',
- 'public': true,
- 'adminCode': '80____',
- 'productName': 'ICE',
- 'mode': 'train',
- 'product': 'nationalExpress',
- 'operator': {
- 'type': 'operator',
- 'id': 'db-fernverkehr-ag',
- 'name': 'DB Fernverkehr AG'
- }
+ tripId: '1|244757|0|80|27072020',
+ line: {
+ type: 'line',
+ id: 'ice-696',
+ fahrtNr: '696',
+ name: 'ICE 696',
+ public: true,
+ adminCode: '80____',
+ productName: 'ICE',
+ mode: 'train',
+ product: 'nationalExpress',
+ operator: {
+ type: 'operator',
+ id: 'db-fernverkehr-ag',
+ name: 'DB Fernverkehr AG',
+ },
},
- 'direction': 'Kiel Hbf',
- 'arrivalPlatform': '5',
- 'plannedArrivalPlatform': '5',
- 'departurePlatform': '7',
- 'plannedDeparturePlatform': '7',
- 'loadFactor': 'low-to-medium'
- }
+ direction: 'Kiel Hbf',
+ arrivalPlatform: '5',
+ plannedArrivalPlatform: '5',
+ departurePlatform: '7',
+ plannedDeparturePlatform: '7',
+ loadFactor: 'low-to-medium',
+ },
],
- 'refreshToken': '¶HKI¶T$A=1@O=Berlin Hbf (tief)@L=8098160@a=128@$A=1@O=Hamburg Hbf@L=8002549@a=128@$202007271038$202007271234$ICE 696$$1$$$',
- 'price': {
- 'amount': 69.9,
- 'currency': 'EUR',
- 'hint': null
- }
-}
+ refreshToken: '¶HKI¶T$A=1@O=Berlin Hbf (tief)@L=8098160@a=128@$A=1@O=Hamburg Hbf@L=8002549@a=128@$202007271038$202007271234$ICE 696$$1$$$',
+ price: {
+ amount: 69.9,
+ currency: 'EUR',
+ hint: null,
+ },
+};
export {
dbJourneyPolyline,
-}
+};
diff --git a/test/fixtures/db-journey.js b/test/fixtures/db-journey.js
index b14246b8..a72e2dd5 100644
--- a/test/fixtures/db-journey.js
+++ b/test/fixtures/db-journey.js
@@ -23,7 +23,7 @@ const dbJourney = {
subway: false,
tram: true,
taxi: false,
- }
+ },
},
destination: {
type: 'stop',
@@ -68,8 +68,8 @@ const dbJourney = {
subway: false,
tram: true,
taxi: false,
- }
- }
+ },
+ },
},
arrival: '2020-04-11T05:20:00+02:00',
plannedArrival: '2020-04-11T05:20:00+02:00',
@@ -126,8 +126,8 @@ const dbJourney = {
subway: false,
tram: true,
taxi: false,
- }
- }
+ },
+ },
},
destination: {
type: 'stop',
@@ -150,7 +150,7 @@ const dbJourney = {
subway: true,
tram: true,
taxi: false,
- }
+ },
},
arrival: '2020-04-11T09:01:00+02:00',
plannedArrival: '2020-04-11T09:01:00+02:00',
@@ -176,7 +176,7 @@ const dbJourney = {
type: 'operator',
id: 'db-fernverkehr-ag',
name: 'DB Fernverkehr AG',
- }
+ },
},
direction: 'München Hbf',
arrivalPlatform: '9',
@@ -184,19 +184,19 @@ const dbJourney = {
departurePlatform: '11',
plannedDeparturePlatform: '11',
remarks: [
- {
+ {
text: 'Komfort Check-in möglich (Infos unter bahn.de/kci)',
type: 'hint',
code: 'komfort-checkin',
summary: 'Komfort-Checkin available',
- }
- ]
- }
+ },
+ ],
+ },
],
refreshToken: '¶HKI¶D$A=1@O=Köln Hbf@L=8000207@a=128@$A=1@O=Köln Messe/Deutz Gl.11-12@L=8073368@a=128@$202004110517$202004110520$$$1$§T$A=1@O=Köln Messe/Deutz Gl.11-12@L=8073368@a=128@$A=1@O=Nürnberg Hbf@L=8000284@a=128@$202004110520$202004110901$ICE 523$$1$',
price: {amount: 49.9, currency: 'EUR', hint: null},
-}
+};
export {
dbJourney,
-}
+};
diff --git a/test/fixtures/db-stop.js b/test/fixtures/db-stop.js
index 2d865f91..86ed940b 100644
--- a/test/fixtures/db-stop.js
+++ b/test/fixtures/db-stop.js
@@ -1,15 +1,15 @@
const facilities = {
'3SZentrale': '030/2971055',
- parkingLots: true,
- bicycleParkingRacks: true,
- localPublicTransport: true,
- toilets: true,
- lockers: true,
- travelShop: false,
- stepFreeAccess: true,
- boardingAid: 'ja, um voranmeldung unter 01806 512 512* wird gebeten',
- taxis: true,
-}
+ 'parkingLots': true,
+ 'bicycleParkingRacks': true,
+ 'localPublicTransport': true,
+ 'toilets': true,
+ 'lockers': true,
+ 'travelShop': false,
+ 'stepFreeAccess': true,
+ 'boardingAid': 'ja, um voranmeldung unter 01806 512 512* wird gebeten',
+ 'taxis': true,
+};
const reisezentrumOpeningHours = {
Mo: '08:00-20:00',
@@ -26,9 +26,9 @@ const reisezentrumOpeningHours = {
['Do', '08:00-20:00'],
['Fr', '08:00-20:00'],
['Sa', '10:00-18:00'],
- ['So', '10:00-18:00']
+ ['So', '10:00-18:00'],
],
-}
+};
const station = {
type: 'station',
@@ -38,7 +38,7 @@ const station = {
type: 'location',
id: '8011155',
latitude: 52.521526,
- longitude: 13.411088
+ longitude: 13.411088,
},
products: {
nationalExpress: false,
@@ -50,7 +50,7 @@ const station = {
ferry: false,
subway: true,
tram: true,
- taxi: false
+ taxi: false,
},
transitAuthority: 'VBB',
ids: {
@@ -59,7 +59,7 @@ const station = {
},
facilities,
reisezentrumOpeningHours,
-}
+};
const dbStop = {
...station,
@@ -75,7 +75,7 @@ const dbStop = {
type: 'location',
id: '372948',
latitude: 52.523513,
- longitude: 13.411366
+ longitude: 13.411366,
},
products: {
nationalExpress: false,
@@ -87,7 +87,7 @@ const dbStop = {
ferry: false,
subway: true,
tram: true,
- taxi: false
+ taxi: false,
},
station,
transitAuthority: 'VBB',
@@ -105,7 +105,7 @@ const dbStop = {
type: 'location',
id: '727273',
latitude: 52.52087,
- longitude: 13.411609
+ longitude: 13.411609,
},
products: {
nationalExpress: false,
@@ -117,7 +117,7 @@ const dbStop = {
ferry: false,
subway: true,
tram: true,
- taxi: false
+ taxi: false,
},
station,
transitAuthority: 'VBB',
@@ -135,7 +135,7 @@ const dbStop = {
type: 'location',
id: '727460',
latitude: 52.521967,
- longitude: 13.41116
+ longitude: 13.41116,
},
products: {
nationalExpress: false,
@@ -147,7 +147,7 @@ const dbStop = {
ferry: false,
subway: true,
tram: true,
- taxi: false
+ taxi: false,
},
station,
transitAuthority: 'VBB',
@@ -165,7 +165,7 @@ const dbStop = {
type: 'location',
id: '727484',
latitude: 52.522722,
- longitude: 13.410288
+ longitude: 13.410288,
},
products: {
nationalExpress: false,
@@ -177,7 +177,7 @@ const dbStop = {
ferry: false,
subway: true,
tram: true,
- taxi: false
+ taxi: false,
},
station,
transitAuthority: 'VBB',
@@ -195,7 +195,7 @@ const dbStop = {
type: 'location',
id: '728658',
latitude: 52.52318,
- longitude: 13.413946
+ longitude: 13.413946,
},
products: {
nationalExpress: false,
@@ -207,11 +207,11 @@ const dbStop = {
ferry: false,
subway: true,
tram: true,
- taxi: false
+ taxi: false,
},
station,
transitAuthority: 'VBB',
- facilities
+ facilities,
}, {
type: 'stop',
id: '728659',
@@ -224,7 +224,7 @@ const dbStop = {
type: 'location',
id: '728659',
latitude: 52.521742,
- longitude: 13.414045
+ longitude: 13.414045,
},
products: {
nationalExpress: false,
@@ -236,7 +236,7 @@ const dbStop = {
ferry: false,
subway: true,
tram: true,
- taxi: false
+ taxi: false,
},
station,
transitAuthority: 'VBB',
@@ -254,7 +254,7 @@ const dbStop = {
type: 'location',
id: '728660',
latitude: 52.521661,
- longitude: 13.414045
+ longitude: 13.414045,
},
products: {
nationalExpress: false,
@@ -266,7 +266,7 @@ const dbStop = {
ferry: false,
subway: true,
tram: true,
- taxi: false
+ taxi: false,
},
station,
transitAuthority: 'VBB',
@@ -284,7 +284,7 @@ const dbStop = {
type: 'location',
id: '728735',
latitude: 52.520322,
- longitude: 13.415708
+ longitude: 13.415708,
},
products: {
nationalExpress: false,
@@ -296,11 +296,11 @@ const dbStop = {
ferry: false,
subway: true,
tram: true,
- taxi: false
+ taxi: false,
},
station,
transitAuthority: 'VBB',
- facilities
+ facilities,
}, {
type: 'stop',
id: '732533',
@@ -313,7 +313,7 @@ const dbStop = {
type: 'location',
id: '732533',
latitude: 52.521023,
- longitude: 13.412661
+ longitude: 13.412661,
},
products: {
nationalExpress: false,
@@ -325,7 +325,7 @@ const dbStop = {
ferry: false,
subway: true,
tram: true,
- taxi: false
+ taxi: false,
},
station,
transitAuthority: 'VBB',
@@ -343,7 +343,7 @@ const dbStop = {
type: 'location',
id: '732535',
latitude: 52.522119,
- longitude: 13.414683
+ longitude: 13.414683,
},
products: {
nationalExpress: false,
@@ -355,11 +355,11 @@ const dbStop = {
ferry: false,
subway: true,
tram: true,
- taxi: false
+ taxi: false,
},
station,
transitAuthority: 'VBB',
- facilities
+ facilities,
}, {
type: 'stop',
id: '732536',
@@ -372,7 +372,7 @@ const dbStop = {
type: 'location',
id: '732536',
latitude: 52.520825,
- longitude: 13.414926
+ longitude: 13.414926,
},
products: {
nationalExpress: false,
@@ -384,11 +384,11 @@ const dbStop = {
ferry: false,
subway: true,
tram: true,
- taxi: false
+ taxi: false,
},
station,
transitAuthority: 'VBB',
- facilities
+ facilities,
}, {
type: 'stop',
id: '8089001',
@@ -401,7 +401,7 @@ const dbStop = {
type: 'location',
id: '8089001',
latitude: 52.521643,
- longitude: 13.411097
+ longitude: 13.411097,
},
products: {
nationalExpress: false,
@@ -413,7 +413,7 @@ const dbStop = {
ferry: false,
subway: true,
tram: true,
- taxi: false
+ taxi: false,
},
transitAuthority: 'VBB',
station,
@@ -430,7 +430,7 @@ const dbStop = {
type: 'location',
id: '732594',
latitude: 52.522066,
- longitude: 13.41658
+ longitude: 13.41658,
},
products: {
nationalExpress: false,
@@ -442,196 +442,196 @@ const dbStop = {
ferry: false,
subway: false,
tram: false,
- taxi: false
+ taxi: false,
},
transitAuthority: 'VBB',
}],
entrances: [{
type: 'location', id: '608011155',
- latitude: 52.521814, longitude: 13.411456
+ latitude: 52.521814, longitude: 13.411456,
}, {
type: 'location', id: '718011155',
- latitude: 52.521373, longitude: 13.413317
+ latitude: 52.521373, longitude: 13.413317,
}, {
type: 'location', id: '708011155',
- latitude: 52.522317, longitude: 13.412895
+ latitude: 52.522317, longitude: 13.412895,
}, {
type: 'location', id: '698011155',
- latitude: 52.520852, longitude: 13.412274
+ latitude: 52.520852, longitude: 13.412274,
}, {
type: 'location', id: '688011155',
- latitude: 52.521176, longitude: 13.412463
+ latitude: 52.521176, longitude: 13.412463,
}, {
type: 'location', id: '678011155',
- latitude: 52.520933, longitude: 13.41285
+ latitude: 52.520933, longitude: 13.41285,
}, {
type: 'location', id: '668011155',
- latitude: 52.520798, longitude: 13.411717
+ latitude: 52.520798, longitude: 13.411717,
}, {
type: 'location', id: '658011155',
- latitude: 52.52096, longitude: 13.414908
+ latitude: 52.52096, longitude: 13.414908,
}, {
type: 'location', id: '648011155',
- latitude: 52.521724, longitude: 13.41027
+ latitude: 52.521724, longitude: 13.41027,
}, {
type: 'location', id: '638011155',
- latitude: 52.52211, longitude: 13.410881
+ latitude: 52.52211, longitude: 13.410881,
}, {
type: 'location', id: '628011155',
- latitude: 52.522119, longitude: 13.414647
+ latitude: 52.522119, longitude: 13.414647,
}, {
type: 'location', id: '618011155',
- latitude: 52.521409, longitude: 13.410728
+ latitude: 52.521409, longitude: 13.410728,
}, {
type: 'location', id: '8089001',
- latitude: 52.521643, longitude: 13.411097
+ latitude: 52.521643, longitude: 13.411097,
}, {
type: 'location', id: '608089001',
- latitude: 52.521409, longitude: 13.410728
+ latitude: 52.521409, longitude: 13.410728,
}, {
type: 'location', id: '718089001',
- latitude: 52.521373, longitude: 13.413317
+ latitude: 52.521373, longitude: 13.413317,
}, {
type: 'location', id: '708089001',
- latitude: 52.522317, longitude: 13.412895
+ latitude: 52.522317, longitude: 13.412895,
}, {
type: 'location', id: '698089001',
- latitude: 52.520852, longitude: 13.412274
+ latitude: 52.520852, longitude: 13.412274,
}, {
type: 'location', id: '688089001',
- latitude: 52.521176, longitude: 13.412463
+ latitude: 52.521176, longitude: 13.412463,
}, {
type: 'location', id: '678089001',
- latitude: 52.520933, longitude: 13.41285
+ latitude: 52.520933, longitude: 13.41285,
}, {
type: 'location', id: '668089001',
- latitude: 52.520798, longitude: 13.411717
+ latitude: 52.520798, longitude: 13.411717,
}, {
type: 'location', id: '658089001',
- latitude: 52.52096, longitude: 13.414908
+ latitude: 52.52096, longitude: 13.414908,
}, {
type: 'location', id: '648089001',
- latitude: 52.521724, longitude: 13.41027
+ latitude: 52.521724, longitude: 13.41027,
}, {
type: 'location', id: '638089001',
- latitude: 52.52211, longitude: 13.410881
+ latitude: 52.52211, longitude: 13.410881,
}, {
type: 'location', id: '628089001',
- latitude: 52.522119, longitude: 13.414647
+ latitude: 52.522119, longitude: 13.414647,
}, {
type: 'location', id: '618089001',
- latitude: 52.521814, longitude: 13.411456
+ latitude: 52.521814, longitude: 13.411456,
}, {
type: 'location', id: '600732533',
- latitude: 52.520933, longitude: 13.41285
+ latitude: 52.520933, longitude: 13.41285,
}, {
type: 'location', id: '710732533',
- latitude: 52.522317, longitude: 13.412895
+ latitude: 52.522317, longitude: 13.412895,
}, {
type: 'location', id: '700732533',
- latitude: 52.520852, longitude: 13.412274
+ latitude: 52.520852, longitude: 13.412274,
}, {
type: 'location', id: '690732533',
- latitude: 52.520798, longitude: 13.411717
+ latitude: 52.520798, longitude: 13.411717,
}, {
type: 'location', id: '680732533',
- latitude: 52.52096, longitude: 13.414908
+ latitude: 52.52096, longitude: 13.414908,
}, {
type: 'location', id: '670732533',
- latitude: 52.521724, longitude: 13.41027
+ latitude: 52.521724, longitude: 13.41027,
}, {
type: 'location', id: '660732533',
- latitude: 52.52211, longitude: 13.410881
+ latitude: 52.52211, longitude: 13.410881,
}, {
type: 'location', id: '650732533',
- latitude: 52.521409, longitude: 13.410728
+ latitude: 52.521409, longitude: 13.410728,
}, {
type: 'location', id: '640732533',
- latitude: 52.521814, longitude: 13.411456
+ latitude: 52.521814, longitude: 13.411456,
}, {
type: 'location', id: '630732533',
- latitude: 52.522119, longitude: 13.414647
+ latitude: 52.522119, longitude: 13.414647,
}, {
type: 'location', id: '620732533',
- latitude: 52.521373, longitude: 13.413317
+ latitude: 52.521373, longitude: 13.413317,
}, {
type: 'location', id: '610732533',
- latitude: 52.521176, longitude: 13.412463
+ latitude: 52.521176, longitude: 13.412463,
}, {
type: 'location', id: '600728660',
- latitude: 52.521373, longitude: 13.413317
+ latitude: 52.521373, longitude: 13.413317,
}, {
type: 'location', id: '710728660',
- latitude: 52.520852, longitude: 13.412274
+ latitude: 52.520852, longitude: 13.412274,
}, {
type: 'location', id: '700728660',
- latitude: 52.521176, longitude: 13.412463
+ latitude: 52.521176, longitude: 13.412463,
}, {
type: 'location', id: '690728660',
- latitude: 52.520933, longitude: 13.41285
+ latitude: 52.520933, longitude: 13.41285,
}, {
type: 'location', id: '680728660',
- latitude: 52.520798, longitude: 13.411717
+ latitude: 52.520798, longitude: 13.411717,
}, {
type: 'location', id: '670728660',
- latitude: 52.521724, longitude: 13.41027
+ latitude: 52.521724, longitude: 13.41027,
}, {
type: 'location', id: '660728660',
- latitude: 52.52211, longitude: 13.410881
+ latitude: 52.52211, longitude: 13.410881,
}, {
type: 'location', id: '650728660',
- latitude: 52.521409, longitude: 13.410728
+ latitude: 52.521409, longitude: 13.410728,
}, {
type: 'location', id: '640728660',
- latitude: 52.521814, longitude: 13.411456
+ latitude: 52.521814, longitude: 13.411456,
}, {
type: 'location', id: '630728660',
- latitude: 52.522317, longitude: 13.412895
+ latitude: 52.522317, longitude: 13.412895,
}, {
type: 'location', id: '620728660',
- latitude: 52.522119, longitude: 13.414647
+ latitude: 52.522119, longitude: 13.414647,
}, {
type: 'location', id: '610728660',
- latitude: 52.52096, longitude: 13.414908
+ latitude: 52.52096, longitude: 13.414908,
}, {
type: 'location', id: '600728659',
- latitude: 52.522119, longitude: 13.414647
+ latitude: 52.522119, longitude: 13.414647,
}, {
type: 'location', id: '710728659',
- latitude: 52.520852, longitude: 13.412274
+ latitude: 52.520852, longitude: 13.412274,
}, {
type: 'location', id: '700728659',
- latitude: 52.521176, longitude: 13.412463
+ latitude: 52.521176, longitude: 13.412463,
}, {
type: 'location', id: '690728659',
- latitude: 52.520933, longitude: 13.41285
+ latitude: 52.520933, longitude: 13.41285,
}, {
type: 'location', id: '680728659',
- latitude: 52.520798, longitude: 13.411717
+ latitude: 52.520798, longitude: 13.411717,
}, {
type: 'location', id: '670728659',
- latitude: 52.521724, longitude: 13.41027
+ latitude: 52.521724, longitude: 13.41027,
}, {
type: 'location', id: '660728659',
- latitude: 52.52211, longitude: 13.410881
+ latitude: 52.52211, longitude: 13.410881,
}, {
type: 'location', id: '650728659',
- latitude: 52.521409, longitude: 13.410728
+ latitude: 52.521409, longitude: 13.410728,
}, {
type: 'location', id: '640728659',
- latitude: 52.521814, longitude: 13.411456
+ latitude: 52.521814, longitude: 13.411456,
}, {
type: 'location', id: '630728659',
- latitude: 52.521373, longitude: 13.413317
+ latitude: 52.521373, longitude: 13.413317,
}, {
type: 'location', id: '620728659',
- latitude: 52.52096, longitude: 13.414908
+ latitude: 52.52096, longitude: 13.414908,
}, {
type: 'location', id: '610728659',
- latitude: 52.522317, longitude: 13.412895
+ latitude: 52.522317, longitude: 13.412895,
}],
-}
+};
export {
dbStop,
-}
+};
diff --git a/test/fixtures/insa-stop.js b/test/fixtures/insa-stop.js
index d46bec54..61fea900 100644
--- a/test/fixtures/insa-stop.js
+++ b/test/fixtures/insa-stop.js
@@ -9,7 +9,7 @@ const insaStop = {
type: 'location',
id: '7341',
latitude: 52.096849,
- longitude: 11.637444
+ longitude: 11.637444,
},
products: {
nationalExpress: false,
@@ -18,10 +18,10 @@ const insaStop = {
suburban: false,
tram: false,
bus: true,
- tourismTrain: false
+ tourismTrain: false,
},
-}
+};
export {
insaStop,
-}
+};
diff --git a/test/fixtures/oebb-trip.js b/test/fixtures/oebb-trip.js
index fb693464..70e0ee77 100644
--- a/test/fixtures/oebb-trip.js
+++ b/test/fixtures/oebb-trip.js
@@ -1,13 +1,13 @@
const point = (lon, lat) => ({
type: 'Point',
coordinates: [lon, lat],
-})
+});
const feature = (geometry, props = {}) => ({
type: 'Feature',
properties: props,
geometry: geometry,
-})
+});
const wienFlughafen = {
type: 'stop',
@@ -17,7 +17,7 @@ const wienFlughafen = {
type: 'location',
id: '8100353',
latitude: 48.121163,
- longitude: 16.562418
+ longitude: 16.562418,
},
products: {
nationalExpress: true,
@@ -29,9 +29,9 @@ const wienFlughafen = {
ferry: false,
subway: false,
tram: false,
- onCall: false
- }
-}
+ onCall: false,
+ },
+};
const salzburgHbf = {
type: 'stop',
@@ -41,7 +41,7 @@ const salzburgHbf = {
type: 'location',
id: '8100002',
latitude: 47.812851,
- longitude: 13.045604
+ longitude: 13.045604,
},
products: {
nationalExpress: true,
@@ -53,15 +53,15 @@ const salzburgHbf = {
ferry: false,
subway: false,
tram: false,
- onCall: false
- }
-}
+ onCall: false,
+ },
+};
const öbbWestbahnTickets = {
type: 'hint',
code: 'O5',
- text: 'Hinweis: Gegenseitige Anerkennung von ÖBB- und WESTbahn-Tickets (Wien Hbf - Salzburg Hbf)'
-}
+ text: 'Hinweis: Gegenseitige Anerkennung von ÖBB- und WESTbahn-Tickets (Wien Hbf - Salzburg Hbf)',
+};
const corona = {
id: '483655',
@@ -81,18 +81,18 @@ const corona = {
ferry: true,
subway: true,
tram: true,
- onCall: true
+ onCall: true,
},
edges: [{
icoCrd: {x: 14768356, y: 48156724, type: 'WGS84'},
icon: null,
fromLocation: null,
- toLocation: null
+ toLocation: null,
}],
validFrom: '2020-05-15T00:00:00+02:00',
validUntil: '2020-06-30T23:59:00+02:00',
- modified: '2020-05-28T13:48:14+02:00'
-}
+ modified: '2020-05-28T13:48:14+02:00',
+};
const oebbTrip = {
id: '2|#VN#0#ST#1591790769#PI#0#ZI#398470#TA#0#DA#110620#1S#8100353#1T#1633#LS#8100002#LT#1948#PU#81#RT#1#CA#RJ#ZE#742#ZB#RJ 742 #',
@@ -116,7 +116,7 @@ const oebbTrip = {
productName: 'RJ',
mode: 'train',
product: 'nationalExpress',
- operator: {type: 'operator', id: 'nahreisezug', name: 'Nahreisezug'}
+ operator: {type: 'operator', id: 'nahreisezug', name: 'Nahreisezug'},
},
direction: 'Salzburg Hbf',
arrivalPlatform: '6A-C',
@@ -148,7 +148,7 @@ const oebbTrip = {
type: 'location',
id: '8103000',
latitude: 48.184564,
- longitude: 16.378526
+ longitude: 16.378526,
},
products: {
nationalExpress: true,
@@ -160,8 +160,8 @@ const oebbTrip = {
ferry: false,
subway: false,
tram: false,
- onCall: false
- }
+ onCall: false,
+ },
},
arrival: '2020-06-11T16:48:00+02:00',
plannedArrival: '2020-06-11T16:48:00+02:00',
@@ -178,7 +178,7 @@ const oebbTrip = {
remarks: [
öbbWestbahnTickets,
corona,
- ]
+ ],
},
{
stop: {
@@ -189,7 +189,7 @@ const oebbTrip = {
type: 'location',
id: '8100514',
latitude: 48.174585,
- longitude: 16.333733
+ longitude: 16.333733,
},
products: {
nationalExpress: true,
@@ -201,8 +201,8 @@ const oebbTrip = {
ferry: false,
subway: false,
tram: false,
- onCall: false
- }
+ onCall: false,
+ },
},
arrival: '2020-06-11T17:00:00+02:00',
plannedArrival: '2020-06-11T17:00:00+02:00',
@@ -219,7 +219,7 @@ const oebbTrip = {
remarks: [
öbbWestbahnTickets,
corona,
- ]
+ ],
},
{
stop: {
@@ -230,7 +230,7 @@ const oebbTrip = {
type: 'location',
id: '8102059',
latitude: 48.295167,
- longitude: 15.996538
+ longitude: 15.996538,
},
products: {
nationalExpress: true,
@@ -242,8 +242,8 @@ const oebbTrip = {
ferry: false,
subway: false,
tram: false,
- onCall: false
- }
+ onCall: false,
+ },
},
arrival: '2020-06-11T17:15:00+02:00',
plannedArrival: '2020-06-11T17:15:00+02:00',
@@ -260,7 +260,7 @@ const oebbTrip = {
remarks: [
öbbWestbahnTickets,
corona,
- ]
+ ],
},
{
stop: {
@@ -271,7 +271,7 @@ const oebbTrip = {
type: 'location',
id: '8100008',
latitude: 48.20825,
- longitude: 15.624681
+ longitude: 15.624681,
},
products: {
nationalExpress: true,
@@ -283,8 +283,8 @@ const oebbTrip = {
ferry: false,
subway: false,
tram: false,
- onCall: false
- }
+ onCall: false,
+ },
},
arrival: '2020-06-11T17:28:00+02:00',
plannedArrival: '2020-06-11T17:28:00+02:00',
@@ -301,7 +301,7 @@ const oebbTrip = {
remarks: [
öbbWestbahnTickets,
corona,
- ]
+ ],
},
{
stop: {
@@ -312,7 +312,7 @@ const oebbTrip = {
type: 'location',
id: '8100012',
latitude: 48.121477,
- longitude: 14.878199
+ longitude: 14.878199,
},
products: {
nationalExpress: true,
@@ -324,8 +324,8 @@ const oebbTrip = {
ferry: false,
subway: false,
tram: false,
- onCall: false
- }
+ onCall: false,
+ },
},
arrival: '2020-06-11T18:00:00+02:00',
plannedArrival: '2020-06-11T18:00:00+02:00',
@@ -342,7 +342,7 @@ const oebbTrip = {
remarks: [
öbbWestbahnTickets,
corona,
- ]
+ ],
},
{
stop: {
@@ -353,7 +353,7 @@ const oebbTrip = {
type: 'location',
id: '8100009',
latitude: 48.17873,
- longitude: 14.522083
+ longitude: 14.522083,
},
products: {
nationalExpress: true,
@@ -365,8 +365,8 @@ const oebbTrip = {
ferry: false,
subway: false,
tram: false,
- onCall: false
- }
+ onCall: false,
+ },
},
arrival: '2020-06-11T18:16:00+02:00',
plannedArrival: '2020-06-11T18:16:00+02:00',
@@ -383,7 +383,7 @@ const oebbTrip = {
remarks: [
öbbWestbahnTickets,
corona,
- ]
+ ],
},
{
stop: {
@@ -394,7 +394,7 @@ const oebbTrip = {
type: 'location',
id: '8100013',
latitude: 48.29016,
- longitude: 14.291941
+ longitude: 14.291941,
},
products: {
nationalExpress: true,
@@ -406,8 +406,8 @@ const oebbTrip = {
ferry: false,
subway: false,
tram: false,
- onCall: false
- }
+ onCall: false,
+ },
},
arrival: '2020-06-11T18:30:00+02:00',
plannedArrival: '2020-06-11T18:30:00+02:00',
@@ -424,7 +424,7 @@ const oebbTrip = {
remarks: [
öbbWestbahnTickets,
corona,
- ]
+ ],
},
{
stop: {
@@ -435,7 +435,7 @@ const oebbTrip = {
type: 'location',
id: '8100014',
latitude: 48.166208,
- longitude: 14.027271
+ longitude: 14.027271,
},
products: {
nationalExpress: true,
@@ -447,8 +447,8 @@ const oebbTrip = {
ferry: false,
subway: false,
tram: false,
- onCall: false
- }
+ onCall: false,
+ },
},
arrival: '2020-06-11T18:44:00+02:00',
plannedArrival: '2020-06-11T18:44:00+02:00',
@@ -465,7 +465,7 @@ const oebbTrip = {
remarks: [
öbbWestbahnTickets,
corona,
- ]
+ ],
},
{
stop: {
@@ -476,7 +476,7 @@ const oebbTrip = {
type: 'location',
id: '8100017',
latitude: 48.012654,
- longitude: 13.720883
+ longitude: 13.720883,
},
products: {
nationalExpress: true,
@@ -488,8 +488,8 @@ const oebbTrip = {
ferry: false,
subway: false,
tram: false,
- onCall: false
- }
+ onCall: false,
+ },
},
arrival: '2020-06-11T18:58:00+02:00',
plannedArrival: '2020-06-11T18:58:00+02:00',
@@ -506,7 +506,7 @@ const oebbTrip = {
remarks: [
öbbWestbahnTickets,
corona,
- ]
+ ],
},
{
stop: {
@@ -517,7 +517,7 @@ const oebbTrip = {
type: 'location',
id: '8100507',
latitude: 48.010002,
- longitude: 13.663936
+ longitude: 13.663936,
},
products: {
nationalExpress: true,
@@ -529,8 +529,8 @@ const oebbTrip = {
ferry: false,
subway: false,
tram: false,
- onCall: false
- }
+ onCall: false,
+ },
},
arrival: '2020-06-11T19:04:00+02:00',
plannedArrival: '2020-06-11T19:04:00+02:00',
@@ -547,7 +547,7 @@ const oebbTrip = {
remarks: [
öbbWestbahnTickets,
corona,
- ]
+ ],
},
{
stop: {
@@ -558,7 +558,7 @@ const oebbTrip = {
type: 'location',
id: '8100134',
latitude: 47.954512,
- longitude: 13.224714
+ longitude: 13.224714,
},
products: {
nationalExpress: true,
@@ -570,8 +570,8 @@ const oebbTrip = {
ferry: false,
subway: false,
tram: false,
- onCall: false
- }
+ onCall: false,
+ },
},
arrival: '2020-06-11T19:30:00+02:00',
plannedArrival: '2020-06-11T19:30:00+02:00',
@@ -588,7 +588,7 @@ const oebbTrip = {
remarks: [
öbbWestbahnTickets,
corona,
- ]
+ ],
},
{
stop: salzburgHbf,
@@ -607,19 +607,19 @@ const oebbTrip = {
remarks: [
öbbWestbahnTickets,
corona,
- ]
- }
+ ],
+ },
],
remarks: [
{
type: 'hint',
code: 'FR',
- text: 'Fahrradmitnahme reservierungspflichtig'
+ text: 'Fahrradmitnahme reservierungspflichtig',
},
{
type: 'hint',
code: 'FK',
- text: 'Fahrradmitnahme begrenzt möglich'
+ text: 'Fahrradmitnahme begrenzt möglich',
},
{type: 'hint', code: 'RM', text: 'Reservierung möglich'},
{type: 'hint', code: 'BR', text: 'Bordrestaurant'},
@@ -627,12 +627,12 @@ const oebbTrip = {
{
type: 'hint',
code: 'OA',
- text: 'Rollstuhlstellplatz - Voranmeldung unter +43 5 1717'
+ text: 'Rollstuhlstellplatz - Voranmeldung unter +43 5 1717',
},
{
type: 'hint',
code: 'EF',
- text: 'Fahrzeuggebundene Einstiegshilfe'
+ text: 'Fahrzeuggebundene Einstiegshilfe',
},
{type: 'hint', code: 'OC', text: 'rollstuhltaugliches WC'},
{type: 'hint', code: 'HD', text: 'Ruhezone'},
@@ -642,11 +642,11 @@ const oebbTrip = {
id: '483653',
type: 'warning',
summary: 'Aktuelle Lage',
- text: 'Wegen der aktuellen Corona-Situation wurde der Fahrplan österreichweit angepasst.\n' +
- 'Der Fernverkehr fährt innerhalb Österreichs wieder verstärkt. Der Regelbetrieb für S-Bahnen und Regionalzüge ist wieder aufgenommen.\n' +
- 'Einschränkungen im grenzüberschreitenden Verkehr bleiben bis auf Weiteres bestehen.\n' +
- 'Informationen dazu erhalten Sie auf SCOTTY mobil, im Internet auf www.oebb.at und beim ÖBB-Kundenservice unter +43-5-1717.\n' +
- ' Wir bitten Sie in allen öffentlichen Verkehrsmitteln und im gesamten Bahnhofsbereich ein Mund-Nasenschutz zu tragen. Bitte halten Sie auch einen Sicherheitsabstand zu anderen Personen ein. Nähere Informationen des Bundesministeriums finden Sie hier.\n',
+ text: 'Wegen der aktuellen Corona-Situation wurde der Fahrplan österreichweit angepasst.\n'
+ + 'Der Fernverkehr fährt innerhalb Österreichs wieder verstärkt. Der Regelbetrieb für S-Bahnen und Regionalzüge ist wieder aufgenommen.\n'
+ + 'Einschränkungen im grenzüberschreitenden Verkehr bleiben bis auf Weiteres bestehen.\n'
+ + 'Informationen dazu erhalten Sie auf SCOTTY mobil, im Internet auf www.oebb.at und beim ÖBB-Kundenservice unter +43-5-1717.\n'
+ + ' Wir bitten Sie in allen öffentlichen Verkehrsmitteln und im gesamten Bahnhofsbereich ein Mund-Nasenschutz zu tragen. Bitte halten Sie auch einen Sicherheitsabstand zu anderen Personen ein. Nähere Informationen des Bundesministeriums finden Sie hier.\n',
icon: {type: 'HIM5', title: null},
priority: 100,
category: 5,
@@ -660,12 +660,12 @@ const oebbTrip = {
ferry: false,
subway: false,
tram: false,
- onCall: false
+ onCall: false,
},
validFrom: '2020-05-18T00:00:00+02:00',
validUntil: '2020-06-30T23:59:00+02:00',
- modified: '2020-05-28T13:47:56+02:00'
- }
+ modified: '2020-05-28T13:47:56+02:00',
+ },
],
polyline: {
type: 'FeatureCollection',
@@ -718,7 +718,7 @@ const oebbTrip = {
type: 'location',
id: '8199506',
latitude: 48.139555,
- longitude: 16.435221
+ longitude: 16.435221,
},
products: {
nationalExpress: false,
@@ -730,10 +730,10 @@ const oebbTrip = {
ferry: false,
subway: false,
tram: false,
- onCall: false
- }
+ onCall: false,
+ },
},
- geometry: point(16.43523, 48.13958)
+ geometry: point(16.43523, 48.13958),
},
feature(point(16.43308, 48.14005)),
feature(point(16.4315, 48.14055)),
@@ -769,7 +769,7 @@ const oebbTrip = {
type: 'location',
id: '8103000',
latitude: 48.184564,
- longitude: 16.378526
+ longitude: 16.378526,
},
products: {
nationalExpress: true,
@@ -781,10 +781,10 @@ const oebbTrip = {
ferry: false,
subway: false,
tram: false,
- onCall: false
- }
+ onCall: false,
+ },
},
- geometry: point(16.37852, 48.18457)
+ geometry: point(16.37852, 48.18457),
},
feature(point(16.37616, 48.18488)),
feature(point(16.37427, 48.18495)),
@@ -809,7 +809,7 @@ const oebbTrip = {
type: 'location',
id: '8100514',
latitude: 48.174585,
- longitude: 16.333733
+ longitude: 16.333733,
},
products: {
nationalExpress: true,
@@ -821,10 +821,10 @@ const oebbTrip = {
ferry: false,
subway: false,
tram: false,
- onCall: false
- }
+ onCall: false,
+ },
},
- geometry: point(16.33373, 48.17459)
+ geometry: point(16.33373, 48.17459),
},
feature(point(16.3287, 48.17346)),
feature(point(16.32447, 48.17195)),
@@ -867,7 +867,7 @@ const oebbTrip = {
type: 'location',
id: '8199501',
latitude: 48.216493,
- longitude: 16.196431
+ longitude: 16.196431,
},
products: {
nationalExpress: false,
@@ -879,10 +879,10 @@ const oebbTrip = {
ferry: false,
subway: false,
tram: false,
- onCall: false
- }
+ onCall: false,
+ },
},
- geometry: point(16.19643, 48.2165)
+ geometry: point(16.19643, 48.2165),
},
feature(point(16.19266, 48.21819)),
feature(point(16.18994, 48.2197)),
@@ -910,7 +910,7 @@ const oebbTrip = {
type: 'location',
id: '8102059',
latitude: 48.295167,
- longitude: 15.996538
+ longitude: 15.996538,
},
products: {
nationalExpress: true,
@@ -922,10 +922,10 @@ const oebbTrip = {
ferry: false,
subway: false,
tram: false,
- onCall: false
- }
+ onCall: false,
+ },
},
- geometry: point(15.99654, 48.29517)
+ geometry: point(15.99654, 48.29517),
},
feature(point(15.97902, 48.29573)),
feature(point(15.94482, 48.29681)),
@@ -1006,7 +1006,7 @@ const oebbTrip = {
type: 'location',
id: '8100008',
latitude: 48.20825,
- longitude: 15.624681
+ longitude: 15.624681,
},
products: {
nationalExpress: true,
@@ -1018,10 +1018,10 @@ const oebbTrip = {
ferry: false,
subway: false,
tram: false,
- onCall: false
- }
+ onCall: false,
+ },
},
- geometry: point(15.62468, 48.20825)
+ geometry: point(15.62468, 48.20825),
},
feature(point(15.62117, 48.20838)),
feature(point(15.61982, 48.20854)),
@@ -1103,7 +1103,7 @@ const oebbTrip = {
type: 'location',
id: '8100006',
latitude: 48.207944,
- longitude: 15.216346
+ longitude: 15.216346,
},
products: {
nationalExpress: false,
@@ -1115,10 +1115,10 @@ const oebbTrip = {
ferry: false,
subway: false,
tram: false,
- onCall: false
- }
+ onCall: false,
+ },
},
- geometry: point(15.21635, 48.20794)
+ geometry: point(15.21635, 48.20794),
},
feature(point(15.20289, 48.20773)),
feature(point(15.18148, 48.20714)),
@@ -1164,7 +1164,7 @@ const oebbTrip = {
type: 'location',
id: '8100012',
latitude: 48.121477,
- longitude: 14.878199
+ longitude: 14.878199,
},
products: {
nationalExpress: true,
@@ -1176,10 +1176,10 @@ const oebbTrip = {
ferry: false,
subway: false,
tram: false,
- onCall: false
- }
+ onCall: false,
+ },
},
- geometry: point(14.8782, 48.12148)
+ geometry: point(14.8782, 48.12148),
},
feature(point(14.87397, 48.1214)),
feature(point(14.87116, 48.12117)),
@@ -1258,7 +1258,7 @@ const oebbTrip = {
type: 'location',
id: '8100009',
latitude: 48.17873,
- longitude: 14.522083
+ longitude: 14.522083,
},
products: {
nationalExpress: true,
@@ -1270,10 +1270,10 @@ const oebbTrip = {
ferry: false,
subway: false,
tram: false,
- onCall: false
- }
+ onCall: false,
+ },
},
- geometry: point(14.52208, 48.17873)
+ geometry: point(14.52208, 48.17873),
},
feature(point(14.51228, 48.19552)),
feature(point(14.51102, 48.198)),
@@ -1351,7 +1351,7 @@ const oebbTrip = {
type: 'location',
id: '8100013',
latitude: 48.29016,
- longitude: 14.291941
+ longitude: 14.291941,
},
products: {
nationalExpress: true,
@@ -1363,10 +1363,10 @@ const oebbTrip = {
ferry: false,
subway: false,
tram: false,
- onCall: false
- }
+ onCall: false,
+ },
},
- geometry: point(14.29194, 48.29016)
+ geometry: point(14.29194, 48.29016),
},
feature(point(14.28644, 48.28392)),
feature(point(14.28542, 48.28301)),
@@ -1388,7 +1388,7 @@ const oebbTrip = {
type: 'location',
id: '8101165',
latitude: 48.274015,
- longitude: 14.253871
+ longitude: 14.253871,
},
products: {
nationalExpress: false,
@@ -1400,10 +1400,10 @@ const oebbTrip = {
ferry: false,
subway: false,
tram: false,
- onCall: false
- }
+ onCall: false,
+ },
},
- geometry: point(14.25387, 48.27402)
+ geometry: point(14.25387, 48.27402),
},
feature(point(14.24863, 48.27396)),
feature(point(14.24531, 48.27367)),
@@ -1422,7 +1422,7 @@ const oebbTrip = {
type: 'location',
id: '8101389',
latitude: 48.257448,
- longitude: 14.209339
+ longitude: 14.209339,
},
products: {
nationalExpress: false,
@@ -1434,10 +1434,10 @@ const oebbTrip = {
ferry: false,
subway: false,
tram: false,
- onCall: false
- }
+ onCall: false,
+ },
},
- geometry: point(14.20934, 48.25745)
+ geometry: point(14.20934, 48.25745),
},
feature(point(14.18643, 48.24575)),
feature(point(14.15117, 48.2276)),
@@ -1452,7 +1452,7 @@ const oebbTrip = {
type: 'location',
id: '8101204',
latitude: 48.200996,
- longitude: 14.099491
+ longitude: 14.099491,
},
products: {
nationalExpress: false,
@@ -1464,10 +1464,10 @@ const oebbTrip = {
ferry: false,
subway: false,
tram: false,
- onCall: false
- }
+ onCall: false,
+ },
},
- geometry: point(14.09949, 48.201)
+ geometry: point(14.09949, 48.201),
},
feature(point(14.07166, 48.18672)),
feature(point(14.03896, 48.16978)),
@@ -1485,7 +1485,7 @@ const oebbTrip = {
type: 'location',
id: '8100014',
latitude: 48.166208,
- longitude: 14.027271
+ longitude: 14.027271,
},
products: {
nationalExpress: true,
@@ -1497,10 +1497,10 @@ const oebbTrip = {
ferry: false,
subway: false,
tram: false,
- onCall: false
- }
+ onCall: false,
+ },
},
- geometry: point(14.02727, 48.16621)
+ geometry: point(14.02727, 48.16621),
},
feature(point(14.02361, 48.1651)),
feature(point(14.01975, 48.16375)),
@@ -1522,7 +1522,7 @@ const oebbTrip = {
type: 'location',
id: '8199518',
latitude: 48.101198,
- longitude: 13.899058
+ longitude: 13.899058,
},
products: {
nationalExpress: false,
@@ -1534,10 +1534,10 @@ const oebbTrip = {
ferry: false,
subway: false,
tram: false,
- onCall: false
- }
+ onCall: false,
+ },
},
- geometry: point(13.90023, 48.10178)
+ geometry: point(13.90023, 48.10178),
},
feature(point(13.89709, 48.09997)),
feature(point(13.89427, 48.09856)),
@@ -1556,7 +1556,7 @@ const oebbTrip = {
type: 'location',
id: '8199519',
latitude: 48.094321,
- longitude: 13.872297
+ longitude: 13.872297,
},
products: {
nationalExpress: false,
@@ -1568,10 +1568,10 @@ const oebbTrip = {
ferry: false,
subway: false,
tram: false,
- onCall: false
- }
+ onCall: false,
+ },
},
- geometry: point(13.87004, 48.09435)
+ geometry: point(13.87004, 48.09435),
},
feature(point(13.84047, 48.09589)),
feature(point(13.83635, 48.09583)),
@@ -1585,7 +1585,7 @@ const oebbTrip = {
type: 'location',
id: '8101278',
latitude: 48.095471,
- longitude: 13.832529
+ longitude: 13.832529,
},
products: {
nationalExpress: false,
@@ -1597,10 +1597,10 @@ const oebbTrip = {
ferry: false,
subway: false,
tram: false,
- onCall: false
- }
+ onCall: false,
+ },
},
- geometry: point(13.83253, 48.09547)
+ geometry: point(13.83253, 48.09547),
},
feature(point(13.82899, 48.09485)),
feature(point(13.82521, 48.09386)),
@@ -1629,7 +1629,7 @@ const oebbTrip = {
type: 'location',
id: '8100017',
latitude: 48.012654,
- longitude: 13.720883
+ longitude: 13.720883,
},
products: {
nationalExpress: true,
@@ -1641,10 +1641,10 @@ const oebbTrip = {
ferry: false,
subway: false,
tram: false,
- onCall: false
- }
+ onCall: false,
+ },
},
- geometry: point(13.72088, 48.01266)
+ geometry: point(13.72088, 48.01266),
},
feature(point(13.71806, 48.00964)),
feature(point(13.71741, 48.00904)),
@@ -1672,7 +1672,7 @@ const oebbTrip = {
type: 'location',
id: '8100507',
latitude: 48.010002,
- longitude: 13.663936
+ longitude: 13.663936,
},
products: {
nationalExpress: true,
@@ -1684,10 +1684,10 @@ const oebbTrip = {
ferry: false,
subway: false,
tram: false,
- onCall: false
- }
+ onCall: false,
+ },
},
- geometry: point(13.66394, 48.01)
+ geometry: point(13.66394, 48.01),
},
feature(point(13.66038, 48.01116)),
feature(point(13.65788, 48.01184)),
@@ -1740,7 +1740,7 @@ const oebbTrip = {
type: 'location',
id: '8100508',
latitude: 47.99792,
- longitude: 13.489321
+ longitude: 13.489321,
},
products: {
nationalExpress: false,
@@ -1752,10 +1752,10 @@ const oebbTrip = {
ferry: false,
subway: false,
tram: false,
- onCall: false
- }
+ onCall: false,
+ },
},
- geometry: point(13.48932, 47.99792)
+ geometry: point(13.48932, 47.99792),
},
feature(point(13.4877, 47.99737)),
feature(point(13.48626, 47.997)),
@@ -1856,7 +1856,7 @@ const oebbTrip = {
type: 'location',
id: '8100020',
latitude: 47.966683,
- longitude: 13.239124
+ longitude: 13.239124,
},
products: {
nationalExpress: false,
@@ -1868,10 +1868,10 @@ const oebbTrip = {
ferry: false,
subway: false,
tram: false,
- onCall: false
- }
+ onCall: false,
+ },
},
- geometry: point(13.23912, 47.96669)
+ geometry: point(13.23912, 47.96669),
},
feature(point(13.23454, 47.96389)),
feature(point(13.23295, 47.96274)),
@@ -1886,7 +1886,7 @@ const oebbTrip = {
type: 'location',
id: '8100134',
latitude: 47.954512,
- longitude: 13.224714
+ longitude: 13.224714,
},
products: {
nationalExpress: true,
@@ -1898,10 +1898,10 @@ const oebbTrip = {
ferry: false,
subway: false,
tram: false,
- onCall: false
- }
+ onCall: false,
+ },
},
- geometry: point(13.22471, 47.95451)
+ geometry: point(13.22471, 47.95451),
},
feature(point(13.22338, 47.95317)),
feature(point(13.22247, 47.95247)),
@@ -2019,10 +2019,10 @@ const oebbTrip = {
feature(point(13.04872, 47.81824)),
feature(point(13.04627, 47.81381)),
feature(point(13.0456, 47.81285), salzburgHbf),
- ]
+ ],
},
-}
+};
export {
oebbTrip,
-}
+};
diff --git a/test/fixtures/rejseplanen-trip.js b/test/fixtures/rejseplanen-trip.js
index 0a39cb09..e4636c4e 100644
--- a/test/fixtures/rejseplanen-trip.js
+++ b/test/fixtures/rejseplanen-trip.js
@@ -16,7 +16,7 @@ const rejseplanenTrip = {
productName: 'IC',
mode: 'train',
product: 'national-train',
- operator: { type: 'operator', id: 'dsb', name: 'DSB' },
+ operator: {type: 'operator', id: 'dsb', name: 'DSB'},
},
origin: {
@@ -33,7 +33,7 @@ const rejseplanenTrip = {
'national-train': true,
'national-train-2': true,
'local-train': true,
- o: false,
+ 'o': false,
's-tog': false,
},
},
@@ -58,7 +58,7 @@ const rejseplanenTrip = {
'national-train': true,
'national-train-2': true,
'local-train': true,
- o: true,
+ 'o': true,
's-tog': false,
},
},
@@ -70,8 +70,8 @@ const rejseplanenTrip = {
arrivalPrognosisType: 'prognosed',
remarks: [
- { type: 'hint', code: 'RE', text: 'Reservierung empfohlen' },
- { type: 'hint', code: 'TD', text: 'Mulighed for internet' },
+ {type: 'hint', code: 'RE', text: 'Reservierung empfohlen'},
+ {type: 'hint', code: 'TD', text: 'Mulighed for internet'},
],
stopovers: [
@@ -90,7 +90,7 @@ const rejseplanenTrip = {
'national-train': true,
'national-train-2': true,
'local-train': true,
- o: false,
+ 'o': false,
's-tog': false,
},
},
@@ -129,7 +129,7 @@ const rejseplanenTrip = {
'national-train': true,
'national-train-2': false,
'local-train': true,
- o: false,
+ 'o': false,
's-tog': false,
},
},
@@ -161,7 +161,7 @@ const rejseplanenTrip = {
'national-train': true,
'national-train-2': false,
'local-train': true,
- o: false,
+ 'o': false,
's-tog': false,
},
},
@@ -193,7 +193,7 @@ const rejseplanenTrip = {
'national-train': true,
'national-train-2': false,
'local-train': true,
- o: false,
+ 'o': false,
's-tog': false,
},
},
@@ -225,7 +225,7 @@ const rejseplanenTrip = {
'national-train': true,
'national-train-2': false,
'local-train': true,
- o: false,
+ 'o': false,
's-tog': false,
},
},
@@ -257,7 +257,7 @@ const rejseplanenTrip = {
'national-train': true,
'national-train-2': true,
'local-train': false,
- o: false,
+ 'o': false,
's-tog': false,
},
},
@@ -289,7 +289,7 @@ const rejseplanenTrip = {
'national-train': true,
'national-train-2': true,
'local-train': false,
- o: false,
+ 'o': false,
's-tog': false,
},
},
@@ -321,7 +321,7 @@ const rejseplanenTrip = {
'national-train': true,
'national-train-2': true,
'local-train': false,
- o: false,
+ 'o': false,
's-tog': false,
},
},
@@ -353,7 +353,7 @@ const rejseplanenTrip = {
'national-train': true,
'national-train-2': false,
'local-train': true,
- o: true,
+ 'o': true,
's-tog': false,
},
},
@@ -385,7 +385,7 @@ const rejseplanenTrip = {
'national-train': true,
'national-train-2': false,
'local-train': true,
- o: true,
+ 'o': true,
's-tog': false,
},
},
@@ -417,7 +417,7 @@ const rejseplanenTrip = {
'national-train': true,
'national-train-2': true,
'local-train': true,
- o: true,
+ 'o': true,
's-tog': false,
},
},
@@ -435,8 +435,8 @@ const rejseplanenTrip = {
departurePrognosisType: null,
},
],
-}
+};
export {
rejseplanenTrip,
-}
+};
diff --git a/test/fixtures/rsag-journey.js b/test/fixtures/rsag-journey.js
index a989770b..e91445fd 100644
--- a/test/fixtures/rsag-journey.js
+++ b/test/fixtures/rsag-journey.js
@@ -17,8 +17,8 @@ const rsagJourneys = {
operator: {
type: 'operator',
id: 'db-regio-ag-nordost',
- name: 'DB Regio AG Nordost'
- }
+ name: 'DB Regio AG Nordost',
+ },
},
reachable: true,
currentLocation: {
@@ -38,17 +38,17 @@ const rsagJourneys = {
longitude: 12.131078,
},
products: {
- ice: true,
+ 'ice': true,
'ic-ec': true,
'long-distance-train': false,
'regional-train': true,
's-bahn': true,
- bus: false,
- ferry: false,
+ 'bus': false,
+ 'ferry': false,
'u-bahn': false,
- tram: false,
+ 'tram': false,
'on-call': false,
- }
+ },
},
departure: '2021-01-19T14:14:00+01:00',
plannedDeparture: '2021-01-19T14:14:00+01:00',
@@ -68,17 +68,17 @@ const rsagJourneys = {
longitude: 12.172833,
},
products: {
- ice: false,
+ 'ice': false,
'ic-ec': true,
'long-distance-train': false,
'regional-train': true,
's-bahn': true,
- bus: false,
- ferry: false,
+ 'bus': false,
+ 'ferry': false,
'u-bahn': false,
- tram: false,
+ 'tram': false,
'on-call': false,
- }
+ },
},
arrival: '2021-01-19T14:44:00+01:00',
plannedArrival: '2021-01-19T14:44:00+01:00',
@@ -92,8 +92,8 @@ const rsagJourneys = {
],
refreshToken: '¶HKI¶T$A=1@O=Rostock Hbf@L=8010304@a=128@$A=1@O=Güstrow@L=8010153@a=128@$202101191414$202101191444$ S2$$1$$$$',
cycle: {min: 3600},
-}
+};
export {
rsagJourneys,
-}
+};
diff --git a/test/fixtures/vbb-departures.js b/test/fixtures/vbb-departures.js
index 77200fca..29da24f6 100644
--- a/test/fixtures/vbb-departures.js
+++ b/test/fixtures/vbb-departures.js
@@ -10,7 +10,7 @@ const vbbDepartures = [
type: 'location',
id: '900100004',
latitude: 52.515503,
- longitude: 13.418027
+ longitude: 13.418027,
},
products: {
suburban: true,
@@ -19,7 +19,7 @@ const vbbDepartures = [
bus: true,
ferry: false,
express: false,
- regional: false
+ regional: false,
},
lines: [
{
@@ -131,8 +131,8 @@ const vbbDepartures = [
productName: 'Bus',
mode: 'bus',
product: 'bus',
- }
- ]
+ },
+ ],
},
when: '2021-10-12T17:44:00+02:00',
plannedWhen: '2021-10-12T17:44:00+02:00',
@@ -143,13 +143,13 @@ const vbbDepartures = [
direction: 'S Erkner Bhf',
origin: null,
destination: {
- type: "stop",
- id: "900310004",
+ type: 'stop',
+ id: '900310004',
stationDHID: 'de:12067:900310004',
- name: "S Erkner Bhf",
+ name: 'S Erkner Bhf',
location: {
- type: "location",
- id: "900310004",
+ type: 'location',
+ id: '900310004',
latitude: 52.428398,
longitude: 13.752246,
},
@@ -177,20 +177,20 @@ const vbbDepartures = [
operator: {
type: 'operator',
id: 's-bahn-berlin-gmbh',
- name: 'S-Bahn Berlin GmbH'
+ name: 'S-Bahn Berlin GmbH',
},
},
remarks: [
- { type: 'hint', code: 'OPERATOR', text: 'DBS' },
- { type: 'hint', code: 'bf', text: 'barrierefrei' },
- { type: 'hint', code: 'FB', text: 'Fahrradmitnahme möglich' },
+ {type: 'hint', code: 'OPERATOR', text: 'DBS'},
+ {type: 'hint', code: 'bf', text: 'barrierefrei'},
+ {type: 'hint', code: 'FB', text: 'Fahrradmitnahme möglich'},
{
id: '118634',
type: 'warning',
summary: 'Gemeinsam sicher unterwegs - mit Abstand und medizinischer Maske (in Berlin: FFP2)!',
- text: 'An Haltestellen und Bahnhöfen sowie in Fahrzeugen. Maskenmuffel riskieren mindestens 50 Euro.\n' +
- 'Weitere Informationen',
- icon: { type: 'HIM0', title: null },
+ text: 'An Haltestellen und Bahnhöfen sowie in Fahrzeugen. Maskenmuffel riskieren mindestens 50 Euro.\n'
+ + 'Weitere Informationen',
+ icon: {type: 'HIM0', title: null},
priority: 100,
products: {
suburban: true,
@@ -199,14 +199,14 @@ const vbbDepartures = [
bus: true,
ferry: true,
express: true,
- regional: true
+ regional: true,
},
company: 'VBB',
- categories: [ 0 ],
+ categories: [0],
validFrom: '2021-04-24T00:00:00+02:00',
validUntil: '2022-12-31T00:00:00+01:00',
- modified: '2021-06-12T07:43:36+02:00'
- }
+ modified: '2021-06-12T07:43:36+02:00',
+ },
],
currentTripPosition: {
type: 'location',
@@ -225,7 +225,7 @@ const vbbDepartures = [
type: 'location',
id: '900100004',
latitude: 52.515503,
- longitude: 13.418027
+ longitude: 13.418027,
},
products: {
suburban: true,
@@ -234,7 +234,7 @@ const vbbDepartures = [
bus: true,
ferry: false,
express: false,
- regional: false
+ regional: false,
},
lines: [
{
@@ -346,8 +346,8 @@ const vbbDepartures = [
productName: 'Bus',
mode: 'bus',
product: 'bus',
- }
- ]
+ },
+ ],
},
when: '2021-10-12T17:45:00+02:00',
plannedWhen: '2021-10-12T17:45:00+02:00',
@@ -370,19 +370,19 @@ const vbbDepartures = [
operator: {
type: 'operator',
id: 'berliner-verkehrsbetriebe',
- name: 'Berliner Verkehrsbetriebe'
+ name: 'Berliner Verkehrsbetriebe',
},
},
remarks: [
- { type: 'hint', code: 'OPERATOR', text: 'BVG' },
- { type: 'hint', code: 'bf', text: 'barrierefrei' },
+ {type: 'hint', code: 'OPERATOR', text: 'BVG'},
+ {type: 'hint', code: 'bf', text: 'barrierefrei'},
{
id: '118634',
type: 'warning',
summary: 'Gemeinsam sicher unterwegs - mit Abstand und medizinischer Maske (in Berlin: FFP2)!',
- text: 'An Haltestellen und Bahnhöfen sowie in Fahrzeugen. Maskenmuffel riskieren mindestens 50 Euro.\n' +
- 'Weitere Informationen',
- icon: { type: 'HIM0', title: null },
+ text: 'An Haltestellen und Bahnhöfen sowie in Fahrzeugen. Maskenmuffel riskieren mindestens 50 Euro.\n'
+ + 'Weitere Informationen',
+ icon: {type: 'HIM0', title: null},
priority: 100,
products: {
suburban: true,
@@ -391,24 +391,24 @@ const vbbDepartures = [
bus: true,
ferry: true,
express: true,
- regional: true
+ regional: true,
},
company: 'VBB',
- categories: [ 0 ],
+ categories: [0],
validFrom: '2021-04-24T00:00:00+02:00',
validUntil: '2022-12-31T00:00:00+01:00',
- modified: '2021-06-12T07:43:36+02:00'
- }
+ modified: '2021-06-12T07:43:36+02:00',
+ },
],
origin: null,
destination: {
- type: "stop",
- id: "900005207",
+ type: 'stop',
+ id: '900005207',
stationDHID: 'de:11000:900005207',
- name: "Philharmonie Süd (Berlin)",
+ name: 'Philharmonie Süd (Berlin)',
location: {
- type: "location",
- id: "900005207",
+ type: 'location',
+ id: '900005207',
latitude: 52.508761,
longitude: 13.370025,
},
@@ -439,7 +439,7 @@ const vbbDepartures = [
type: 'location',
id: '900100004',
latitude: 52.515503,
- longitude: 13.418027
+ longitude: 13.418027,
},
products: {
suburban: true,
@@ -448,7 +448,7 @@ const vbbDepartures = [
bus: true,
ferry: false,
express: false,
- regional: false
+ regional: false,
},
lines: [
{
@@ -560,8 +560,8 @@ const vbbDepartures = [
productName: 'Bus',
mode: 'bus',
product: 'bus',
- }
- ]
+ },
+ ],
},
when: '2021-10-12T17:45:00+02:00',
plannedWhen: '2021-10-12T17:45:00+02:00',
@@ -584,20 +584,20 @@ const vbbDepartures = [
operator: {
type: 'operator',
id: 'berliner-verkehrsbetriebe',
- name: 'Berliner Verkehrsbetriebe'
+ name: 'Berliner Verkehrsbetriebe',
},
},
remarks: [
- { type: 'hint', code: 'OPERATOR', text: 'BVG' },
- { type: 'hint', code: 'bf', text: 'barrierefrei' },
- { type: 'hint', code: 'FB', text: 'Fahrradmitnahme möglich' },
+ {type: 'hint', code: 'OPERATOR', text: 'BVG'},
+ {type: 'hint', code: 'bf', text: 'barrierefrei'},
+ {type: 'hint', code: 'FB', text: 'Fahrradmitnahme möglich'},
{
id: '118634',
type: 'warning',
summary: 'Gemeinsam sicher unterwegs - mit Abstand und medizinischer Maske (in Berlin: FFP2)!',
- text: 'An Haltestellen und Bahnhöfen sowie in Fahrzeugen. Maskenmuffel riskieren mindestens 50 Euro.\n' +
- 'Weitere Informationen',
- icon: { type: 'HIM0', title: null },
+ text: 'An Haltestellen und Bahnhöfen sowie in Fahrzeugen. Maskenmuffel riskieren mindestens 50 Euro.\n'
+ + 'Weitere Informationen',
+ icon: {type: 'HIM0', title: null},
priority: 100,
products: {
suburban: true,
@@ -606,24 +606,24 @@ const vbbDepartures = [
bus: true,
ferry: true,
express: true,
- regional: true
+ regional: true,
},
company: 'VBB',
- categories: [ 0 ],
+ categories: [0],
validFrom: '2021-04-24T00:00:00+02:00',
validUntil: '2022-12-31T00:00:00+01:00',
- modified: '2021-06-12T07:43:36+02:00'
- }
+ modified: '2021-06-12T07:43:36+02:00',
+ },
],
origin: null,
destination: {
- type: "stop",
- id: "900079221",
+ type: 'stop',
+ id: '900079221',
stationDHID: 'de:11000:900079221',
- name: "S+U Hermannstr. (Berlin)",
+ name: 'S+U Hermannstr. (Berlin)',
location: {
- type: "location",
- id: "900079221",
+ type: 'location',
+ id: '900079221',
latitude: 52.467339,
longitude: 13.43143,
},
@@ -654,7 +654,7 @@ const vbbDepartures = [
type: 'location',
id: '900100004',
latitude: 52.515503,
- longitude: 13.418027
+ longitude: 13.418027,
},
products: {
suburban: true,
@@ -663,7 +663,7 @@ const vbbDepartures = [
bus: true,
ferry: false,
express: false,
- regional: false
+ regional: false,
},
lines: [
{
@@ -775,8 +775,8 @@ const vbbDepartures = [
productName: 'Bus',
mode: 'bus',
product: 'bus',
- }
- ]
+ },
+ ],
},
when: '2021-10-12T17:45:00+02:00',
plannedWhen: '2021-10-12T17:45:00+02:00',
@@ -799,20 +799,20 @@ const vbbDepartures = [
operator: {
type: 'operator',
id: 'berliner-verkehrsbetriebe',
- name: 'Berliner Verkehrsbetriebe'
+ name: 'Berliner Verkehrsbetriebe',
},
},
remarks: [
- { type: 'hint', code: 'OPERATOR', text: 'BVG' },
- { type: 'hint', code: 'bf', text: 'barrierefrei' },
- { type: 'hint', code: 'FB', text: 'Fahrradmitnahme möglich' },
+ {type: 'hint', code: 'OPERATOR', text: 'BVG'},
+ {type: 'hint', code: 'bf', text: 'barrierefrei'},
+ {type: 'hint', code: 'FB', text: 'Fahrradmitnahme möglich'},
{
id: '118634',
type: 'warning',
summary: 'Gemeinsam sicher unterwegs - mit Abstand und medizinischer Maske (in Berlin: FFP2)!',
- text: 'An Haltestellen und Bahnhöfen sowie in Fahrzeugen. Maskenmuffel riskieren mindestens 50 Euro.\n' +
- 'Weitere Informationen',
- icon: { type: 'HIM0', title: null },
+ text: 'An Haltestellen und Bahnhöfen sowie in Fahrzeugen. Maskenmuffel riskieren mindestens 50 Euro.\n'
+ + 'Weitere Informationen',
+ icon: {type: 'HIM0', title: null},
priority: 100,
products: {
suburban: true,
@@ -821,14 +821,14 @@ const vbbDepartures = [
bus: true,
ferry: true,
express: true,
- regional: true
+ regional: true,
},
company: 'VBB',
- categories: [ 0 ],
+ categories: [0],
validFrom: '2021-04-24T00:00:00+02:00',
validUntil: '2022-12-31T00:00:00+01:00',
- modified: '2021-06-12T07:43:36+02:00'
- }
+ modified: '2021-06-12T07:43:36+02:00',
+ },
],
origin: null,
destination: {
@@ -869,7 +869,7 @@ const vbbDepartures = [
type: 'location',
id: '900100004',
latitude: 52.515503,
- longitude: 13.418027
+ longitude: 13.418027,
},
products: {
suburban: true,
@@ -878,7 +878,7 @@ const vbbDepartures = [
bus: true,
ferry: false,
express: false,
- regional: false
+ regional: false,
},
lines: [
{
@@ -990,8 +990,8 @@ const vbbDepartures = [
productName: 'Bus',
mode: 'bus',
product: 'bus',
- }
- ]
+ },
+ ],
},
when: '2021-10-12T17:45:00+02:00',
plannedWhen: '2021-10-12T17:45:00+02:00',
@@ -1014,20 +1014,20 @@ const vbbDepartures = [
operator: {
type: 'operator',
id: 's-bahn-berlin-gmbh',
- name: 'S-Bahn Berlin GmbH'
+ name: 'S-Bahn Berlin GmbH',
},
},
remarks: [
- { type: 'hint', code: 'OPERATOR', text: 'DBS' },
- { type: 'hint', code: 'bf', text: 'barrierefrei' },
- { type: 'hint', code: 'FB', text: 'Fahrradmitnahme möglich' },
+ {type: 'hint', code: 'OPERATOR', text: 'DBS'},
+ {type: 'hint', code: 'bf', text: 'barrierefrei'},
+ {type: 'hint', code: 'FB', text: 'Fahrradmitnahme möglich'},
{
id: '118634',
type: 'warning',
summary: 'Gemeinsam sicher unterwegs - mit Abstand und medizinischer Maske (in Berlin: FFP2)!',
- text: 'An Haltestellen und Bahnhöfen sowie in Fahrzeugen. Maskenmuffel riskieren mindestens 50 Euro.\n' +
- 'Weitere Informationen',
- icon: { type: 'HIM0', title: null },
+ text: 'An Haltestellen und Bahnhöfen sowie in Fahrzeugen. Maskenmuffel riskieren mindestens 50 Euro.\n'
+ + 'Weitere Informationen',
+ icon: {type: 'HIM0', title: null},
priority: 100,
products: {
suburban: true,
@@ -1036,14 +1036,14 @@ const vbbDepartures = [
bus: true,
ferry: true,
express: true,
- regional: true
+ regional: true,
},
company: 'VBB',
- categories: [ 0 ],
+ categories: [0],
validFrom: '2021-04-24T00:00:00+02:00',
validUntil: '2022-12-31T00:00:00+01:00',
- modified: '2021-06-12T07:43:36+02:00'
- }
+ modified: '2021-06-12T07:43:36+02:00',
+ },
],
origin: null,
destination: {
@@ -1084,7 +1084,7 @@ const vbbDepartures = [
type: 'location',
id: '900100004',
latitude: 52.515503,
- longitude: 13.418027
+ longitude: 13.418027,
},
products: {
suburban: true,
@@ -1093,7 +1093,7 @@ const vbbDepartures = [
bus: true,
ferry: false,
express: false,
- regional: false
+ regional: false,
},
lines: [
{
@@ -1205,8 +1205,8 @@ const vbbDepartures = [
productName: 'Bus',
mode: 'bus',
product: 'bus',
- }
- ]
+ },
+ ],
},
when: '2021-10-12T17:47:00+02:00',
plannedWhen: '2021-10-12T17:47:00+02:00',
@@ -1229,20 +1229,20 @@ const vbbDepartures = [
operator: {
type: 'operator',
id: 's-bahn-berlin-gmbh',
- name: 'S-Bahn Berlin GmbH'
+ name: 'S-Bahn Berlin GmbH',
},
},
remarks: [
- { type: 'hint', code: 'OPERATOR', text: 'DBS' },
- { type: 'hint', code: 'bf', text: 'barrierefrei' },
- { type: 'hint', code: 'FB', text: 'Fahrradmitnahme möglich' },
+ {type: 'hint', code: 'OPERATOR', text: 'DBS'},
+ {type: 'hint', code: 'bf', text: 'barrierefrei'},
+ {type: 'hint', code: 'FB', text: 'Fahrradmitnahme möglich'},
{
id: '118634',
type: 'warning',
summary: 'Gemeinsam sicher unterwegs - mit Abstand und medizinischer Maske (in Berlin: FFP2)!',
- text: 'An Haltestellen und Bahnhöfen sowie in Fahrzeugen. Maskenmuffel riskieren mindestens 50 Euro.\n' +
- 'Weitere Informationen',
- icon: { type: 'HIM0', title: null },
+ text: 'An Haltestellen und Bahnhöfen sowie in Fahrzeugen. Maskenmuffel riskieren mindestens 50 Euro.\n'
+ + 'Weitere Informationen',
+ icon: {type: 'HIM0', title: null},
priority: 100,
products: {
suburban: true,
@@ -1251,14 +1251,14 @@ const vbbDepartures = [
bus: true,
ferry: true,
express: true,
- regional: true
+ regional: true,
},
company: 'VBB',
- categories: [ 0 ],
+ categories: [0],
validFrom: '2021-04-24T00:00:00+02:00',
validUntil: '2022-12-31T00:00:00+01:00',
- modified: '2021-06-12T07:43:36+02:00'
- }
+ modified: '2021-06-12T07:43:36+02:00',
+ },
],
origin: null,
destination: {
@@ -1299,7 +1299,7 @@ const vbbDepartures = [
type: 'location',
id: '900100004',
latitude: 52.515503,
- longitude: 13.418027
+ longitude: 13.418027,
},
products: {
suburban: true,
@@ -1308,7 +1308,7 @@ const vbbDepartures = [
bus: true,
ferry: false,
express: false,
- regional: false
+ regional: false,
},
lines: [
{
@@ -1420,8 +1420,8 @@ const vbbDepartures = [
productName: 'Bus',
mode: 'bus',
product: 'bus',
- }
- ]
+ },
+ ],
},
when: '2021-10-12T17:48:00+02:00',
plannedWhen: '2021-10-12T17:48:00+02:00',
@@ -1444,20 +1444,20 @@ const vbbDepartures = [
operator: {
type: 'operator',
id: 's-bahn-berlin-gmbh',
- name: 'S-Bahn Berlin GmbH'
+ name: 'S-Bahn Berlin GmbH',
},
},
remarks: [
- { type: 'hint', code: 'OPERATOR', text: 'DBS' },
- { type: 'hint', code: 'bf', text: 'barrierefrei' },
- { type: 'hint', code: 'FB', text: 'Fahrradmitnahme möglich' },
+ {type: 'hint', code: 'OPERATOR', text: 'DBS'},
+ {type: 'hint', code: 'bf', text: 'barrierefrei'},
+ {type: 'hint', code: 'FB', text: 'Fahrradmitnahme möglich'},
{
id: '118634',
type: 'warning',
summary: 'Gemeinsam sicher unterwegs - mit Abstand und medizinischer Maske (in Berlin: FFP2)!',
- text: 'An Haltestellen und Bahnhöfen sowie in Fahrzeugen. Maskenmuffel riskieren mindestens 50 Euro.\n' +
- 'Weitere Informationen',
- icon: { type: 'HIM0', title: null },
+ text: 'An Haltestellen und Bahnhöfen sowie in Fahrzeugen. Maskenmuffel riskieren mindestens 50 Euro.\n'
+ + 'Weitere Informationen',
+ icon: {type: 'HIM0', title: null},
priority: 100,
products: {
suburban: true,
@@ -1466,14 +1466,14 @@ const vbbDepartures = [
bus: true,
ferry: true,
express: true,
- regional: true
+ regional: true,
},
company: 'VBB',
- categories: [ 0 ],
+ categories: [0],
validFrom: '2021-04-24T00:00:00+02:00',
validUntil: '2022-12-31T00:00:00+01:00',
- modified: '2021-06-12T07:43:36+02:00'
- }
+ modified: '2021-06-12T07:43:36+02:00',
+ },
],
origin: null,
destination: {
@@ -1514,7 +1514,7 @@ const vbbDepartures = [
type: 'location',
id: '900100004',
latitude: 52.515503,
- longitude: 13.418027
+ longitude: 13.418027,
},
products: {
suburban: true,
@@ -1523,7 +1523,7 @@ const vbbDepartures = [
bus: true,
ferry: false,
express: false,
- regional: false
+ regional: false,
},
lines: [
{
@@ -1635,8 +1635,8 @@ const vbbDepartures = [
productName: 'Bus',
mode: 'bus',
product: 'bus',
- }
- ]
+ },
+ ],
},
when: '2021-10-12T17:49:00+02:00',
plannedWhen: '2021-10-12T17:49:00+02:00',
@@ -1659,20 +1659,20 @@ const vbbDepartures = [
operator: {
type: 'operator',
id: 's-bahn-berlin-gmbh',
- name: 'S-Bahn Berlin GmbH'
+ name: 'S-Bahn Berlin GmbH',
},
},
remarks: [
- { type: 'hint', code: 'OPERATOR', text: 'DBS' },
- { type: 'hint', code: 'bf', text: 'barrierefrei' },
- { type: 'hint', code: 'FB', text: 'Fahrradmitnahme möglich' },
+ {type: 'hint', code: 'OPERATOR', text: 'DBS'},
+ {type: 'hint', code: 'bf', text: 'barrierefrei'},
+ {type: 'hint', code: 'FB', text: 'Fahrradmitnahme möglich'},
{
id: '118634',
type: 'warning',
summary: 'Gemeinsam sicher unterwegs - mit Abstand und medizinischer Maske (in Berlin: FFP2)!',
- text: 'An Haltestellen und Bahnhöfen sowie in Fahrzeugen. Maskenmuffel riskieren mindestens 50 Euro.\n' +
- 'Weitere Informationen',
- icon: { type: 'HIM0', title: null },
+ text: 'An Haltestellen und Bahnhöfen sowie in Fahrzeugen. Maskenmuffel riskieren mindestens 50 Euro.\n'
+ + 'Weitere Informationen',
+ icon: {type: 'HIM0', title: null},
priority: 100,
products: {
suburban: true,
@@ -1681,14 +1681,14 @@ const vbbDepartures = [
bus: true,
ferry: true,
express: true,
- regional: true
+ regional: true,
},
company: 'VBB',
- categories: [ 0 ],
+ categories: [0],
validFrom: '2021-04-24T00:00:00+02:00',
validUntil: '2022-12-31T00:00:00+01:00',
- modified: '2021-06-12T07:43:36+02:00'
- }
+ modified: '2021-06-12T07:43:36+02:00',
+ },
],
origin: null,
destination: {
@@ -1729,7 +1729,7 @@ const vbbDepartures = [
type: 'location',
id: '900100004',
latitude: 52.515503,
- longitude: 13.418027
+ longitude: 13.418027,
},
products: {
suburban: true,
@@ -1738,7 +1738,7 @@ const vbbDepartures = [
bus: true,
ferry: false,
express: false,
- regional: false
+ regional: false,
},
lines: [
{
@@ -1850,8 +1850,8 @@ const vbbDepartures = [
productName: 'Bus',
mode: 'bus',
product: 'bus',
- }
- ]
+ },
+ ],
},
when: '2021-10-12T17:50:00+02:00',
plannedWhen: '2021-10-12T17:50:00+02:00',
@@ -1874,20 +1874,20 @@ const vbbDepartures = [
operator: {
type: 'operator',
id: 'berliner-verkehrsbetriebe',
- name: 'Berliner Verkehrsbetriebe'
+ name: 'Berliner Verkehrsbetriebe',
},
},
remarks: [
- { type: 'hint', code: 'OPERATOR', text: 'BVG' },
- { type: 'hint', code: 'bf', text: 'barrierefrei' },
- { type: 'hint', code: 'FB', text: 'Fahrradmitnahme möglich' },
+ {type: 'hint', code: 'OPERATOR', text: 'BVG'},
+ {type: 'hint', code: 'bf', text: 'barrierefrei'},
+ {type: 'hint', code: 'FB', text: 'Fahrradmitnahme möglich'},
{
id: '118634',
type: 'warning',
summary: 'Gemeinsam sicher unterwegs - mit Abstand und medizinischer Maske (in Berlin: FFP2)!',
- text: 'An Haltestellen und Bahnhöfen sowie in Fahrzeugen. Maskenmuffel riskieren mindestens 50 Euro.\n' +
- 'Weitere Informationen',
- icon: { type: 'HIM0', title: null },
+ text: 'An Haltestellen und Bahnhöfen sowie in Fahrzeugen. Maskenmuffel riskieren mindestens 50 Euro.\n'
+ + 'Weitere Informationen',
+ icon: {type: 'HIM0', title: null},
priority: 100,
products: {
suburban: true,
@@ -1896,14 +1896,14 @@ const vbbDepartures = [
bus: true,
ferry: true,
express: true,
- regional: true
+ regional: true,
},
company: 'VBB',
- categories: [ 0 ],
+ categories: [0],
validFrom: '2021-04-24T00:00:00+02:00',
validUntil: '2022-12-31T00:00:00+01:00',
- modified: '2021-06-12T07:43:36+02:00'
- }
+ modified: '2021-06-12T07:43:36+02:00',
+ },
],
origin: null,
destination: {
@@ -1944,7 +1944,7 @@ const vbbDepartures = [
type: 'location',
id: '900100004',
latitude: 52.515503,
- longitude: 13.418027
+ longitude: 13.418027,
},
products: {
suburban: true,
@@ -1953,7 +1953,7 @@ const vbbDepartures = [
bus: true,
ferry: false,
express: false,
- regional: false
+ regional: false,
},
lines: [
{
@@ -2065,8 +2065,8 @@ const vbbDepartures = [
productName: 'Bus',
mode: 'bus',
product: 'bus',
- }
- ]
+ },
+ ],
},
when: '2021-10-12T17:50:00+02:00',
plannedWhen: '2021-10-12T17:50:00+02:00',
@@ -2089,20 +2089,20 @@ const vbbDepartures = [
operator: {
type: 'operator',
id: 'berliner-verkehrsbetriebe',
- name: 'Berliner Verkehrsbetriebe'
+ name: 'Berliner Verkehrsbetriebe',
},
},
remarks: [
- { type: 'hint', code: 'OPERATOR', text: 'BVG' },
- { type: 'hint', code: 'bf', text: 'barrierefrei' },
- { type: 'hint', code: 'FB', text: 'Fahrradmitnahme möglich' },
+ {type: 'hint', code: 'OPERATOR', text: 'BVG'},
+ {type: 'hint', code: 'bf', text: 'barrierefrei'},
+ {type: 'hint', code: 'FB', text: 'Fahrradmitnahme möglich'},
{
id: '118634',
type: 'warning',
summary: 'Gemeinsam sicher unterwegs - mit Abstand und medizinischer Maske (in Berlin: FFP2)!',
- text: 'An Haltestellen und Bahnhöfen sowie in Fahrzeugen. Maskenmuffel riskieren mindestens 50 Euro.\n' +
- 'Weitere Informationen',
- icon: { type: 'HIM0', title: null },
+ text: 'An Haltestellen und Bahnhöfen sowie in Fahrzeugen. Maskenmuffel riskieren mindestens 50 Euro.\n'
+ + 'Weitere Informationen',
+ icon: {type: 'HIM0', title: null},
priority: 100,
products: {
suburban: true,
@@ -2111,14 +2111,14 @@ const vbbDepartures = [
bus: true,
ferry: true,
express: true,
- regional: true
+ regional: true,
},
company: 'VBB',
- categories: [ 0 ],
+ categories: [0],
validFrom: '2021-04-24T00:00:00+02:00',
validUntil: '2022-12-31T00:00:00+01:00',
- modified: '2021-06-12T07:43:36+02:00'
- }
+ modified: '2021-06-12T07:43:36+02:00',
+ },
],
origin: null,
destination: {
@@ -2159,7 +2159,7 @@ const vbbDepartures = [
type: 'location',
id: '900100004',
latitude: 52.515503,
- longitude: 13.418027
+ longitude: 13.418027,
},
products: {
suburban: true,
@@ -2168,7 +2168,7 @@ const vbbDepartures = [
bus: true,
ferry: false,
express: false,
- regional: false
+ regional: false,
},
lines: [
{
@@ -2280,8 +2280,8 @@ const vbbDepartures = [
productName: 'Bus',
mode: 'bus',
product: 'bus',
- }
- ]
+ },
+ ],
},
when: '2021-10-12T17:51:00+02:00',
plannedWhen: '2021-10-12T17:51:00+02:00',
@@ -2304,19 +2304,19 @@ const vbbDepartures = [
operator: {
type: 'operator',
id: 'berliner-verkehrsbetriebe',
- name: 'Berliner Verkehrsbetriebe'
+ name: 'Berliner Verkehrsbetriebe',
},
},
remarks: [
- { type: 'hint', code: 'OPERATOR', text: 'BVG' },
- { type: 'hint', code: 'bf', text: 'barrierefrei' },
+ {type: 'hint', code: 'OPERATOR', text: 'BVG'},
+ {type: 'hint', code: 'bf', text: 'barrierefrei'},
{
id: '118634',
type: 'warning',
summary: 'Gemeinsam sicher unterwegs - mit Abstand und medizinischer Maske (in Berlin: FFP2)!',
- text: 'An Haltestellen und Bahnhöfen sowie in Fahrzeugen. Maskenmuffel riskieren mindestens 50 Euro.\n' +
- 'Weitere Informationen',
- icon: { type: 'HIM0', title: null },
+ text: 'An Haltestellen und Bahnhöfen sowie in Fahrzeugen. Maskenmuffel riskieren mindestens 50 Euro.\n'
+ + 'Weitere Informationen',
+ icon: {type: 'HIM0', title: null},
priority: 100,
products: {
suburban: true,
@@ -2325,14 +2325,14 @@ const vbbDepartures = [
bus: true,
ferry: true,
express: true,
- regional: true
+ regional: true,
},
company: 'VBB',
- categories: [ 0 ],
+ categories: [0],
validFrom: '2021-04-24T00:00:00+02:00',
validUntil: '2022-12-31T00:00:00+01:00',
- modified: '2021-06-12T07:43:36+02:00'
- }
+ modified: '2021-06-12T07:43:36+02:00',
+ },
],
origin: null,
destination: {
@@ -2373,7 +2373,7 @@ const vbbDepartures = [
type: 'location',
id: '900100004',
latitude: 52.515503,
- longitude: 13.418027
+ longitude: 13.418027,
},
products: {
suburban: true,
@@ -2382,7 +2382,7 @@ const vbbDepartures = [
bus: true,
ferry: false,
express: false,
- regional: false
+ regional: false,
},
lines: [
{
@@ -2494,8 +2494,8 @@ const vbbDepartures = [
productName: 'Bus',
mode: 'bus',
product: 'bus',
- }
- ]
+ },
+ ],
},
when: '2021-10-12T17:51:00+02:00',
plannedWhen: '2021-10-12T17:51:00+02:00',
@@ -2518,20 +2518,20 @@ const vbbDepartures = [
operator: {
type: 'operator',
id: 's-bahn-berlin-gmbh',
- name: 'S-Bahn Berlin GmbH'
+ name: 'S-Bahn Berlin GmbH',
},
},
remarks: [
- { type: 'hint', code: 'OPERATOR', text: 'DBS' },
- { type: 'hint', code: 'bf', text: 'barrierefrei' },
- { type: 'hint', code: 'FB', text: 'Fahrradmitnahme möglich' },
+ {type: 'hint', code: 'OPERATOR', text: 'DBS'},
+ {type: 'hint', code: 'bf', text: 'barrierefrei'},
+ {type: 'hint', code: 'FB', text: 'Fahrradmitnahme möglich'},
{
id: '118634',
type: 'warning',
summary: 'Gemeinsam sicher unterwegs - mit Abstand und medizinischer Maske (in Berlin: FFP2)!',
- text: 'An Haltestellen und Bahnhöfen sowie in Fahrzeugen. Maskenmuffel riskieren mindestens 50 Euro.\n' +
- 'Weitere Informationen',
- icon: { type: 'HIM0', title: null },
+ text: 'An Haltestellen und Bahnhöfen sowie in Fahrzeugen. Maskenmuffel riskieren mindestens 50 Euro.\n'
+ + 'Weitere Informationen',
+ icon: {type: 'HIM0', title: null},
priority: 100,
products: {
suburban: true,
@@ -2540,14 +2540,14 @@ const vbbDepartures = [
bus: true,
ferry: true,
express: true,
- regional: true
+ regional: true,
},
company: 'VBB',
- categories: [ 0 ],
+ categories: [0],
validFrom: '2021-04-24T00:00:00+02:00',
validUntil: '2022-12-31T00:00:00+01:00',
- modified: '2021-06-12T07:43:36+02:00'
- }
+ modified: '2021-06-12T07:43:36+02:00',
+ },
],
origin: null,
destination: {
@@ -2576,9 +2576,9 @@ const vbbDepartures = [
latitude: 52.498604,
longitude: 13.467252,
},
- }
-]
+ },
+];
export {
vbbDepartures,
-}
+};
diff --git a/test/fixtures/vbb-journeys.js b/test/fixtures/vbb-journeys.js
index 3c7905a8..9537c7ab 100644
--- a/test/fixtures/vbb-journeys.js
+++ b/test/fixtures/vbb-journeys.js
@@ -9,7 +9,7 @@ const vbbJourneys = [{
type: 'location',
id: '900042101',
latitude: 52.496581,
- longitude: 13.330616
+ longitude: 13.330616,
},
products: {
suburban: false,
@@ -29,7 +29,7 @@ const vbbJourneys = [{
type: 'location',
id: '900001201',
latitude: 52.536179,
- longitude: 13.343839
+ longitude: 13.343839,
},
products: {
suburban: true,
@@ -64,7 +64,7 @@ const vbbJourneys = [{
operator: {
type: 'operator',
id: 'berliner-verkehrsbetriebe',
- name: 'Berliner Verkehrsbetriebe'
+ name: 'Berliner Verkehrsbetriebe',
},
},
direction: 'U Osloer Str. (Berlin)',
@@ -124,7 +124,7 @@ const vbbJourneys = [{
type: 'location',
id: '900001201',
latitude: 52.536179,
- longitude: 13.343839
+ longitude: 13.343839,
},
products: {
suburban: true,
@@ -144,7 +144,7 @@ const vbbJourneys = [{
type: 'location',
id: '900007102',
latitude: 52.548638,
- longitude: 13.388372
+ longitude: 13.388372,
},
products: {
suburban: true,
@@ -179,7 +179,7 @@ const vbbJourneys = [{
operator: {
type: 'operator',
id: 's-bahn-berlin-gmbh',
- name: 'S-Bahn Berlin GmbH'
+ name: 'S-Bahn Berlin GmbH',
},
},
direction: 'Ringbahn S 41',
@@ -229,7 +229,7 @@ const vbbJourneys = [{
validUntil: '2022-12-31T00:00:00+01:00',
modified: '2020-11-04T11:22:50+01:00',
},
- ],
+ ],
}, {
origin: {
type: 'stop',
@@ -239,7 +239,7 @@ const vbbJourneys = [{
type: 'location',
id: '900007102',
latitude: 52.548638,
- longitude: 13.388372
+ longitude: 13.388372,
},
products: {
suburban: true,
@@ -259,7 +259,7 @@ const vbbJourneys = [{
type: 'location',
id: '900350127',
latitude: 52.833668,
- longitude: 13.797031
+ longitude: 13.797031,
},
products: {
suburban: false,
@@ -314,7 +314,7 @@ const vbbJourneys = [{
operator: {
type: 'operator',
id: 'db-regio-ag',
- name: 'DB Regio AG'
+ name: 'DB Regio AG',
},
},
direction: 'Ostseebad Binz, Bahnhof',
@@ -336,7 +336,7 @@ const vbbJourneys = [{
operator: {
type: 'operator',
id: 'db-regio-ag',
- name: 'DB Regio AG'
+ name: 'DB Regio AG',
},
},
direction: 'Stralsund, Hauptbahnhof',
@@ -344,7 +344,7 @@ const vbbJourneys = [{
plannedWhen: '2020-12-07T18:22:00+01:00',
delay: null,
}],
- remarks: [
+ remarks: [
{
type: 'hint',
code: 'OPERATOR',
@@ -405,19 +405,19 @@ const vbbJourneys = [{
validUntil: '2022-12-31T00:00:00+01:00',
modified: '2020-11-04T11:22:50+01:00',
},
- ],
+ ],
}],
refreshToken: '¶HKI¶T$A=1@O=U Spichernstr. (Berlin)@L=900042101@a=128@$A=1@O=S+U Westhafen (Berlin)@L=900001201@a=128@$202012071408$202012071416$ U9$$1$$$$§T$A=1@O=S+U Westhafen (Berlin)@L=900001201@a=128@$A=1@O=S+U Gesundbrunnen Bhf (Berlin)@L=900007102@a=128@$202012071420$202012071425$ S41$$1$$$$§T$A=1@O=S+U Gesundbrunnen Bhf (Berlin)@L=900007102@a=128@$A=1@O=Eberswalde, Hauptbahnhof@L=900350127@a=128@$202012071352$202012071417$ICE 1710$$3$$$$',
cycle: {min: 7200},
remarks: [{
type: 'status',
code: 'text.realtime.connection.alternative.summary',
- text: 'Journey suggestion according to current traffic.'
+ text: 'Journey suggestion according to current traffic.',
}, {
type: 'status',
code: 'text.realtime.connection.alternative.detail',
- text: 'Journey suggestion according to current traffic situation. Please note the current real-time information.'
- }]
+ text: 'Journey suggestion according to current traffic situation. Please note the current real-time information.',
+ }],
},
{
type: 'journey',
@@ -430,7 +430,7 @@ const vbbJourneys = [{
type: 'location',
id: '900042101',
latitude: 52.496581,
- longitude: 13.330616
+ longitude: 13.330616,
},
products: {
suburban: false,
@@ -450,7 +450,7 @@ const vbbJourneys = [{
type: 'location',
id: '900001201',
latitude: 52.536179,
- longitude: 13.343839
+ longitude: 13.343839,
},
products: {
suburban: true,
@@ -485,7 +485,7 @@ const vbbJourneys = [{
operator: {
type: 'operator',
id: 'berliner-verkehrsbetriebe',
- name: 'Berliner Verkehrsbetriebe'
+ name: 'Berliner Verkehrsbetriebe',
},
},
direction: 'U Osloer Str. (Berlin)',
@@ -494,7 +494,7 @@ const vbbJourneys = [{
departurePlatform: null,
plannedDeparturePlatform: null,
cycle: {min: 240, max: 300, nr: 26},
- remarks: [
+ remarks: [
{
type: 'hint',
code: 'OPERATOR',
@@ -535,7 +535,7 @@ const vbbJourneys = [{
validUntil: '2022-12-31T00:00:00+01:00',
modified: '2020-11-04T11:22:50+01:00',
},
- ],
+ ],
}, {
origin: {
type: 'stop',
@@ -545,7 +545,7 @@ const vbbJourneys = [{
type: 'location',
id: '900001201',
latitude: 52.536179,
- longitude: 13.343839
+ longitude: 13.343839,
},
products: {
suburban: true,
@@ -565,7 +565,7 @@ const vbbJourneys = [{
type: 'location',
id: '900007102',
latitude: 52.548638,
- longitude: 13.388372
+ longitude: 13.388372,
},
products: {
suburban: true,
@@ -600,7 +600,7 @@ const vbbJourneys = [{
operator: {
type: 'operator',
id: 's-bahn-berlin-gmbh',
- name: 'S-Bahn Berlin GmbH'
+ name: 'S-Bahn Berlin GmbH',
},
},
direction: 'Ringbahn S 41',
@@ -666,7 +666,7 @@ const vbbJourneys = [{
type: 'location',
id: '900007102',
latitude: 52.548638,
- longitude: 13.388372
+ longitude: 13.388372,
},
products: {
suburban: true,
@@ -686,7 +686,7 @@ const vbbJourneys = [{
type: 'location',
id: '900350127',
latitude: 52.833668,
- longitude: 13.797031
+ longitude: 13.797031,
},
products: {
suburban: false,
@@ -741,7 +741,7 @@ const vbbJourneys = [{
operator: {
type: 'operator',
id: 'db-regio-ag',
- name: 'DB Regio AG'
+ name: 'DB Regio AG',
},
},
direction: 'Tantow, Bahnhof',
@@ -763,7 +763,7 @@ const vbbJourneys = [{
operator: {
type: 'operator',
id: 'db-regio-ag',
- name: 'DB Regio AG'
+ name: 'DB Regio AG',
},
},
direction: 'Schwedt, Bahnhof',
@@ -785,7 +785,7 @@ const vbbJourneys = [{
operator: {
type: 'operator',
id: 'db-regio-ag',
- name: 'DB Regio AG'
+ name: 'DB Regio AG',
},
},
direction: 'Eberswalde, Hauptbahnhof',
@@ -807,7 +807,7 @@ const vbbJourneys = [{
operator: {
type: 'operator',
id: 'db-regio-ag',
- name: 'DB Regio AG'
+ name: 'DB Regio AG',
},
},
direction: 'Stralsund, Hauptbahnhof',
@@ -829,7 +829,7 @@ const vbbJourneys = [{
operator: {
type: 'operator',
id: 'db-regio-ag',
- name: 'DB Regio AG'
+ name: 'DB Regio AG',
},
},
direction: 'Szczecin, Glowny',
@@ -900,10 +900,10 @@ const vbbJourneys = [{
remarks: [{
type: 'status',
code: 'text.realtime.connection.cancelled',
- text: 'A section of this itinerary is cancelled or unusable.'
+ text: 'A section of this itinerary is cancelled or unusable.',
}],
-}]
+}];
export {
vbbJourneys,
-}
+};
diff --git a/test/fixtures/vbb-on-demand-trip.js b/test/fixtures/vbb-on-demand-trip.js
index 32a5dfb7..2032a894 100644
--- a/test/fixtures/vbb-on-demand-trip.js
+++ b/test/fixtures/vbb-on-demand-trip.js
@@ -14,7 +14,7 @@ const vbbOnDemandTrip = {
operator: {
type: 'operator',
id: 'verkehrsgesellschaft-teltow-flaming-mbh',
- name: 'Verkehrsgesellschaft Teltow-Fläming mbH'
+ name: 'Verkehrsgesellschaft Teltow-Fläming mbH',
},
},
@@ -86,15 +86,15 @@ const vbbOnDemandTrip = {
},
company: 'VBB',
categories: [
- 0
+ 0,
],
validFrom: '2021-04-24T00:00:00+02:00',
validUntil: '2022-12-31T00:00:00+01:00',
modified: '2021-06-12T07:43:36+02:00',
- }
- ]
-}
+ },
+ ],
+};
export {
vbbOnDemandTrip,
-}
+};
diff --git a/test/fixtures/vsn-departures.js b/test/fixtures/vsn-departures.js
index 2e2964e0..cb807cbe 100644
--- a/test/fixtures/vsn-departures.js
+++ b/test/fixtures/vsn-departures.js
@@ -30,7 +30,7 @@ const vsnDepartures = {
type: 'location',
id: '9013927',
latitude: 53.083478,
- longitude: 8.813833
+ longitude: 8.813833,
},
products: {
nationalExpress: true,
@@ -45,7 +45,7 @@ const vsnDepartures = {
anrufSammelTaxi: true,
},
isMeta: true,
- }
+ },
},
when: '2020-08-01T18:42:00+02:00',
plannedWhen: '2020-08-01T17:44:00+02:00',
@@ -96,8 +96,8 @@ const vsnDepartures = {
},
},
remarks: [],
-}
+};
export {
vsnDepartures,
-}
+};
diff --git a/test/fixtures/vsn-remarks.js b/test/fixtures/vsn-remarks.js
index 727a5053..64d72515 100644
--- a/test/fixtures/vsn-remarks.js
+++ b/test/fixtures/vsn-remarks.js
@@ -4,7 +4,7 @@ const vsnRemarks = [
type: 'warning',
summary: 'Hinweis zum Flughafenbus X15',
text: 'Der Flughafenbus X15 ist eine Linie der Regionalverkehr Münsterland GmbH (RVM). Es gilt der Westfalentarif. Infos gibt es online unter www.rvm-online.de sowie telefonisch unter der Rufnummer 0180 650 40 30.',
- icon: { type: 'HIM0', title: null },
+ icon: {type: 'HIM0', title: null},
priority: 6,
company: 'VOS',
products: {
@@ -17,16 +17,16 @@ const vsnRemarks = [
ferry: true,
subway: true,
tram: true,
- anrufSammelTaxi: true
+ anrufSammelTaxi: true,
},
- categories: [ 0 ],
+ categories: [0],
edges: [
{
- icoCrd: { x: 7875575, y: 52201492 },
+ icoCrd: {x: 7875575, y: 52201492},
icon: null,
fromLocation: null,
- toLocation: null
- }
+ toLocation: null,
+ },
],
events: [
{
@@ -34,8 +34,8 @@ const vsnRemarks = [
toLocation: null,
start: '2020-02-03T11:11:00+01:00',
end: '2020-12-13T00:00:00+01:00',
- sections: []
- }
+ sections: [],
+ },
],
affectedLines: [
{
@@ -43,21 +43,21 @@ const vsnRemarks = [
id: 'bus-x15',
fahrtNr: null,
name: 'Bus X15',
- public: true
- }
+ public: true,
+ },
],
validFrom: '2020-02-03T11:11:00+01:00',
validUntil: '2020-12-13T00:00:00+01:00',
- modified: '2020-02-03T11:24:29+01:00'
+ modified: '2020-02-03T11:24:29+01:00',
},
{
id: 'HIM_FREETEXT_9156',
type: 'warning',
summary: 'Sperrung Weserbrücke Lauenförde-Beverungen',
- text: 'Aufgrund der Sperrung können die Haltestellen in Beverungen nicht bedient werden.\n' +
- 'Lauenförde-Beverungen\n' +
- 'Baustellenfahrplan Linie 556',
- icon: { type: 'HIM0', title: null },
+ text: 'Aufgrund der Sperrung können die Haltestellen in Beverungen nicht bedient werden.\n'
+ + 'Lauenförde-Beverungen\n'
+ + 'Baustellenfahrplan Linie 556',
+ icon: {type: 'HIM0', title: null},
priority: 6,
company: 'VSN',
products: {
@@ -70,16 +70,16 @@ const vsnRemarks = [
ferry: true,
subway: true,
tram: true,
- anrufSammelTaxi: true
+ anrufSammelTaxi: true,
},
- categories: [ 0 ],
+ categories: [0],
edges: [
{
- icoCrd: { x: 9395422, y: 51748714 },
+ icoCrd: {x: 9395422, y: 51748714},
icon: null,
fromLocation: null,
- toLocation: null
- }
+ toLocation: null,
+ },
],
events: [
{
@@ -87,8 +87,8 @@ const vsnRemarks = [
toLocation: null,
start: '2019-12-15T00:00:00+01:00',
end: '2020-12-12T23:59:00+01:00',
- sections: []
- }
+ sections: [],
+ },
],
affectedLines: [
{
@@ -96,28 +96,28 @@ const vsnRemarks = [
id: 'bus-554',
fahrtNr: null,
name: 'Bus 554',
- public: true
+ public: true,
},
{
type: 'line',
id: 'bus-556',
fahrtNr: null,
name: 'Bus 556',
- public: true
- }
+ public: true,
+ },
],
validFrom: '2019-12-15T00:00:00+01:00',
validUntil: '2020-12-12T23:59:00+01:00',
- modified: '2019-12-09T13:55:14+01:00'
+ modified: '2019-12-09T13:55:14+01:00',
},
{
id: 'HIM_FREETEXT_9155',
type: 'warning',
summary: 'Sperrung Weserbrücke Lauenförde-Beverungen',
- text: 'Aufgrund der Sperrung können die Haltestellen in Beverungen nicht bedient werden.\n' +
- 'Lauenförde-Beverungen\n' +
- 'Baustellenfahrplan Linie 554',
- icon: { type: 'HIM0', title: null },
+ text: 'Aufgrund der Sperrung können die Haltestellen in Beverungen nicht bedient werden.\n'
+ + 'Lauenförde-Beverungen\n'
+ + 'Baustellenfahrplan Linie 554',
+ icon: {type: 'HIM0', title: null},
priority: 6,
company: 'VSN',
products: {
@@ -130,16 +130,16 @@ const vsnRemarks = [
ferry: true,
subway: true,
tram: true,
- anrufSammelTaxi: true
+ anrufSammelTaxi: true,
},
- categories: [ 0 ],
+ categories: [0],
edges: [
{
- icoCrd: { x: 9435051, y: 51783147 },
+ icoCrd: {x: 9435051, y: 51783147},
icon: null,
fromLocation: null,
- toLocation: null
- }
+ toLocation: null,
+ },
],
events: [
{
@@ -147,8 +147,8 @@ const vsnRemarks = [
toLocation: null,
start: '2019-12-15T00:00:00+01:00',
end: '2020-12-12T23:59:00+01:00',
- sections: []
- }
+ sections: [],
+ },
],
affectedLines: [
{
@@ -156,44 +156,44 @@ const vsnRemarks = [
id: 'bus-509',
fahrtNr: null,
name: 'Bus 509',
- public: true
+ public: true,
},
{
type: 'line',
id: 'bus-554',
fahrtNr: null,
name: 'Bus 554',
- public: true
+ public: true,
},
{
type: 'line',
id: 'bus-556',
fahrtNr: null,
name: 'Bus 556',
- public: true
- }
+ public: true,
+ },
],
validFrom: '2019-12-15T00:00:00+01:00',
validUntil: '2020-12-12T23:59:00+01:00',
- modified: '2019-12-09T13:55:45+01:00'
+ modified: '2019-12-09T13:55:45+01:00',
},
{
id: 'HIM_FREETEXT_14527',
type: 'warning',
summary: 'Verlegung einer Stromleitung in der Lindenstraße (Umleitung verschoben)',
- text: 'Betrifft die Linien 91, 92, 94, N7\n' +
- '\n' +
- 'Beginn der Umleitung verschoben auf voraussichtlich 16. März bis Juni 2020\n' +
- '\n' +
- 'Die Bauarbeiten sollten ursprünglich bereits am 2. März beginnen. Ab diesem Datum wurde auch die Umleitung der Buslinien geplant. Bitte beachten Sie, dass die Fahrpläne an den Haltestellen sowie die Fahrplanauskunft im Internet ab 2. März den Bauplan anzeigen, obwohl die Busse bis zum Beginn der Bauarbeiten noch in der regulären Linienführung fahren.\n' +
- '\n' +
- 'Umleitung ab Baubeginn:\n' +
- 'Die Linien 91, 92, 94 und N7 werden in Richtung Vegesack zwischen (H) Bf Blumenthal und (H) Bremer Vulkan über die Straßen Zur Westpier und Am Werfttor umgeleitet.\n' +
- '\n' +
- 'Haltestellenänderungen in Richtung Vegesack:\n' +
- '(H) Wätjens Park > verlegt vor die Kreuzung Lüssumer Str./Zur Westpier\n' +
- '(H) Margaretenallee > entfällt \n',
- icon: { type: 'HIM0', title: null },
+ text: 'Betrifft die Linien 91, 92, 94, N7\n'
+ + '\n'
+ + 'Beginn der Umleitung verschoben auf voraussichtlich 16. März bis Juni 2020\n'
+ + '\n'
+ + 'Die Bauarbeiten sollten ursprünglich bereits am 2. März beginnen. Ab diesem Datum wurde auch die Umleitung der Buslinien geplant. Bitte beachten Sie, dass die Fahrpläne an den Haltestellen sowie die Fahrplanauskunft im Internet ab 2. März den Bauplan anzeigen, obwohl die Busse bis zum Beginn der Bauarbeiten noch in der regulären Linienführung fahren.\n'
+ + '\n'
+ + 'Umleitung ab Baubeginn:\n'
+ + 'Die Linien 91, 92, 94 und N7 werden in Richtung Vegesack zwischen (H) Bf Blumenthal und (H) Bremer Vulkan über die Straßen Zur Westpier und Am Werfttor umgeleitet.\n'
+ + '\n'
+ + 'Haltestellenänderungen in Richtung Vegesack:\n'
+ + '(H) Wätjens Park > verlegt vor die Kreuzung Lüssumer Str./Zur Westpier\n'
+ + '(H) Margaretenallee > entfällt \n',
+ icon: {type: 'HIM0', title: null},
priority: 6,
company: 'BSAG',
products: {
@@ -206,17 +206,17 @@ const vsnRemarks = [
ferry: false,
subway: false,
tram: false,
- anrufSammelTaxi: false
+ anrufSammelTaxi: false,
},
- categories: [ 0 ],
+ categories: [0],
events: [
{
fromLocation: null,
toLocation: null,
start: '2020-02-21T11:31:00+01:00',
end: '2020-06-30T23:59:00+02:00',
- sections: []
- }
+ sections: [],
+ },
],
affectedLines: [
{
@@ -224,51 +224,51 @@ const vsnRemarks = [
id: 'bus-91',
fahrtNr: null,
name: 'Bus 91',
- public: true
+ public: true,
},
{
type: 'line',
id: 'bus-92',
fahrtNr: null,
name: 'Bus 92',
- public: true
+ public: true,
},
{
type: 'line',
id: 'bus-94',
fahrtNr: null,
name: 'Bus 94',
- public: true
+ public: true,
},
{
type: 'line',
id: 'bus-n7',
fahrtNr: null,
name: 'Bus N7',
- public: true
- }
+ public: true,
+ },
],
validFrom: '2020-02-21T11:31:00+01:00',
validUntil: '2020-06-30T23:59:00+02:00',
- modified: '2020-02-21T11:34:47+01:00'
+ modified: '2020-02-21T11:34:47+01:00',
},
{
id: 'HIM_FREETEXT_14525',
type: 'warning',
summary: 'Verlegung einer Stromleitung in der Lindenstraße',
- text: 'Betrifft die Linien 91, 92, 94, N7\n' +
- '\n' +
- 'Beginn der Umleitung verschoben auf voraussichtlich 16. März bis Juni 2020\n' +
- '\n' +
- 'Die Bauarbeiten sollten ursprünglich bereits am 2. März beginnen. Ab diesem Datum wurde auch die Umleitung der Buslinien geplant. Bitte beachten Sie, dass die Fahrpläne an den Haltestellen sowie die Fahrplanauskunft im Internet ab 2. März den Bauplan anzeigen, obwohl die Busse bis zum Beginn der Bauarbeiten noch in der regulären Linienführung fahren.\n' +
- '\n' +
- 'Umleitung ab Baubeginn:\n' +
- 'Die Linien 91, 92, 94 und N7 werden in Richtung Vegesack zwischen (H) Bf Blumenthal und (H) Bremer Vulkan über die Straßen Zur Westpier und Am Werfttor umgeleitet.\n' +
- '\n' +
- 'Haltestellenänderungen in Richtung Vegesack:\n' +
- '(H) Wätjens Park > verlegt vor die Kreuzung Lüssumer Str./Zur Westpier\n' +
- '(H) Margaretenallee > entfällt \n',
- icon: { type: 'HIM0', title: null },
+ text: 'Betrifft die Linien 91, 92, 94, N7\n'
+ + '\n'
+ + 'Beginn der Umleitung verschoben auf voraussichtlich 16. März bis Juni 2020\n'
+ + '\n'
+ + 'Die Bauarbeiten sollten ursprünglich bereits am 2. März beginnen. Ab diesem Datum wurde auch die Umleitung der Buslinien geplant. Bitte beachten Sie, dass die Fahrpläne an den Haltestellen sowie die Fahrplanauskunft im Internet ab 2. März den Bauplan anzeigen, obwohl die Busse bis zum Beginn der Bauarbeiten noch in der regulären Linienführung fahren.\n'
+ + '\n'
+ + 'Umleitung ab Baubeginn:\n'
+ + 'Die Linien 91, 92, 94 und N7 werden in Richtung Vegesack zwischen (H) Bf Blumenthal und (H) Bremer Vulkan über die Straßen Zur Westpier und Am Werfttor umgeleitet.\n'
+ + '\n'
+ + 'Haltestellenänderungen in Richtung Vegesack:\n'
+ + '(H) Wätjens Park > verlegt vor die Kreuzung Lüssumer Str./Zur Westpier\n'
+ + '(H) Margaretenallee > entfällt \n',
+ icon: {type: 'HIM0', title: null},
priority: 6,
company: 'BSAG',
products: {
@@ -281,17 +281,17 @@ const vsnRemarks = [
ferry: false,
subway: false,
tram: false,
- anrufSammelTaxi: false
+ anrufSammelTaxi: false,
},
- categories: [ 0 ],
+ categories: [0],
events: [
{
fromLocation: null,
toLocation: null,
start: '2020-02-21T11:01:00+01:00',
end: '2020-06-30T23:59:00+02:00',
- sections: []
- }
+ sections: [],
+ },
],
affectedLines: [
{
@@ -299,36 +299,36 @@ const vsnRemarks = [
id: 'bus-91',
fahrtNr: null,
name: 'Bus 91',
- public: true
+ public: true,
},
{
type: 'line',
id: 'bus-92',
fahrtNr: null,
name: 'Bus 92',
- public: true
+ public: true,
},
{
type: 'line',
id: 'bus-94',
fahrtNr: null,
name: 'Bus 94',
- public: true
+ public: true,
},
{
type: 'line',
id: 'bus-n7',
fahrtNr: null,
name: 'Bus N7',
- public: true
- }
+ public: true,
+ },
],
validFrom: '2020-02-21T11:01:00+01:00',
validUntil: '2020-06-30T23:59:00+02:00',
- modified: '2020-02-21T13:31:05+01:00'
- }
-]
+ modified: '2020-02-21T13:31:05+01:00',
+ },
+];
export {
vsnRemarks,
-}
+};
diff --git a/test/format/db-journeys-query.js b/test/format/db-journeys-query.js
index 0cd1d123..df353bd2 100644
--- a/test/format/db-journeys-query.js
+++ b/test/format/db-journeys-query.js
@@ -1,11 +1,11 @@
-import tap from 'tap'
+import tap from 'tap';
-import {createClient} from '../../index.js'
-import {profile as rawProfile} from '../../p/db/index.js'
-import {data as loyaltyCards} from '../../p/db/loyalty-cards.js'
+import {createClient} from '../../index.js';
+import {profile as rawProfile} from '../../p/db/index.js';
+import {data as loyaltyCards} from '../../p/db/loyalty-cards.js';
-const client = createClient(rawProfile, 'public-transport/hafas-client:test')
-const {profile} = client
+const client = createClient(rawProfile, 'public-transport/hafas-client:test');
+const {profile} = client;
const opt = {
results: null,
@@ -32,7 +32,7 @@ const opt = {
type: loyaltyCards.BAHNCARD,
discount: 25,
},
-}
+};
const berlinWienQuery0 = Object.freeze({
getPasslist: false,
@@ -60,14 +60,14 @@ const berlinWienQuery0 = Object.freeze({
outDate: '20230912',
outTime: '080910',
outFrwd: true,
-})
+});
tap.test('formats a journeys() request correctly (DB)', (t) => {
- const ctx = {profile, opt}
+ const ctx = {profile, opt};
// transformJourneysQuery() mutates its 2nd argument!
- const query = {...berlinWienQuery0}
- const req = profile.transformJourneysQuery(ctx, query)
+ const query = {...berlinWienQuery0};
+ const req = profile.transformJourneysQuery(ctx, query);
t.same(req, {
...berlinWienQuery0,
@@ -80,6 +80,6 @@ tap.test('formats a journeys() request correctly (DB)', (t) => {
}],
cType: 'PK',
},
- })
- t.end()
-})
+ });
+ t.end();
+});
diff --git a/test/format/products-filter.js b/test/format/products-filter.js
index 9c0d9b7d..6de98da4 100644
--- a/test/format/products-filter.js
+++ b/test/format/products-filter.js
@@ -1,50 +1,50 @@
-import tap from 'tap'
-import {formatProductsFilter as format} from '../../format/products-filter.js'
+import tap from 'tap';
+import {formatProductsFilter as format} from '../../format/products-filter.js';
const products = [
{
id: 'train',
bitmasks: [1, 2],
- default: true
+ default: true,
},
{
id: 'bus',
bitmasks: [4],
- default: true
+ default: true,
},
{
id: 'tram',
bitmasks: [8, 32],
- default: false
+ default: false,
},
-]
+];
const ctx = {
common: {},
opt: {},
- profile: {products}
-}
+ profile: {products},
+};
tap.test('formatProductsFilter works without customisations', (t) => {
- const expected = 1 | 2 | 4
- const filter = {}
+ const expected = 1 | 2 | 4;
+ const filter = {};
t.same(format(ctx, filter), {
type: 'PROD',
mode: 'INC',
- value: expected + ''
- })
- t.end()
-})
+ value: String(expected),
+ });
+ t.end();
+});
tap.test('formatProductsFilter works with customisations', (t) => {
- t.equal(+format(ctx, {
- bus: true
- }).value, 1 | 2 | 4)
- t.equal(+format(ctx, {
- bus: false
- }).value, 1 | 2)
- t.equal(+format(ctx, {
- tram: true
- }).value, 1 | 2 | 4 | 8 | 32)
- t.end()
-})
+ t.equal(Number(format(ctx, {
+ bus: true,
+ }).value), 1 | 2 | 4);
+ t.equal(Number(format(ctx, {
+ bus: false,
+ }).value), 1 | 2);
+ t.equal(Number(format(ctx, {
+ tram: true,
+ }).value), 1 | 2 | 4 | 8 | 32);
+ t.end();
+});
diff --git a/test/insa-stop.js b/test/insa-stop.js
index 4866865c..a2ac407d 100644
--- a/test/insa-stop.js
+++ b/test/insa-stop.js
@@ -1,28 +1,28 @@
// todo: use import assertions once they're supported by Node.js & ESLint
// https://github.com/tc39/proposal-import-assertions
-import {createRequire} from 'module'
-const require = createRequire(import.meta.url)
+import {createRequire} from 'module';
+const require = createRequire(import.meta.url);
-import tap from 'tap'
+import tap from 'tap';
-import {createClient} from '../index.js'
-import {profile as rawProfile} from '../p/insa/index.js'
-const res = require('./fixtures/insa-stop.json')
-import {insaStop as expected} from './fixtures/insa-stop.js'
+import {createClient} from '../index.js';
+import {profile as rawProfile} from '../p/insa/index.js';
+const res = require('./fixtures/insa-stop.json');
+import {insaStop as expected} from './fixtures/insa-stop.js';
-const client = createClient(rawProfile, 'public-transport/hafas-client:test')
-const {profile} = client
+const client = createClient(rawProfile, 'public-transport/hafas-client:test');
+const {profile} = client;
const opt = {
linesOfStops: false, // parse & expose lines at the stop/station?
remarks: true,
-}
+};
tap.test('parses a stop() response correctly (INSA)', (t) => {
- const common = profile.parseCommon({profile, opt, res})
- const ctx = {profile, opt, common, res}
- const stop = profile.parseLocation(ctx, res.locL[0])
+ const common = profile.parseCommon({profile, opt, res});
+ const ctx = {profile, opt, common, res};
+ const stop = profile.parseLocation(ctx, res.locL[0]);
- t.same(stop, expected)
- t.end()
-})
+ t.same(stop, expected);
+ t.end();
+});
diff --git a/test/lib/request.js b/test/lib/request.js
index c6295fdc..6e463570 100644
--- a/test/lib/request.js
+++ b/test/lib/request.js
@@ -1,143 +1,143 @@
// todo: use import assertions once they're supported by Node.js & ESLint
// https://github.com/tc39/proposal-import-assertions
-import {createRequire} from 'module'
-const require = createRequire(import.meta.url)
+import {createRequire} from 'module';
+const require = createRequire(import.meta.url);
-import tap from 'tap'
-import forEach from 'lodash/forEach.js'
+import tap from 'tap';
+import forEach from 'lodash/forEach.js';
import {
checkIfResponseIsOk as checkIfResIsOk,
request,
-} from '../../lib/request.js'
+} from '../../lib/request.js';
import {
INVALID_REQUEST,
NOT_FOUND,
HafasError,
HafasInvalidRequestError,
HafasNotFoundError,
-} from '../../lib/errors.js'
-import {formatTripReq} from '../../format/trip-req.js'
+} from '../../lib/errors.js';
+import {formatTripReq} from '../../format/trip-req.js';
-const resParameter = require('../fixtures/error-parameter.json')
-const resNoMatch = require('../fixtures/error-no-match.json')
-const resH9360 = require('../fixtures/error-h9360.json')
-const resLocation = require('../fixtures/error-location.json')
+const resParameter = require('../fixtures/error-parameter.json');
+const resNoMatch = require('../fixtures/error-no-match.json');
+const resH9360 = require('../fixtures/error-h9360.json');
+const resLocation = require('../fixtures/error-location.json');
-const USER_AGENT = 'public-transport/hafas-client:test'
+const USER_AGENT = 'public-transport/hafas-client:test';
-const secret = Symbol('secret')
+const secret = Symbol('secret');
tap.test('checkIfResponseIsOk properly throws HAFAS "H9360" errors', (t) => {
try {
checkIfResIsOk({
body: resH9360,
errProps: {secret},
- })
+ });
} catch (err) {
- t.ok(err)
+ t.ok(err);
- t.ok(err instanceof HafasError)
- t.equal(err.isHafasError, true)
- t.equal(err.message.slice(0, 7), 'H9360: ')
- t.ok(err.message.length > 7)
+ t.ok(err instanceof HafasError);
+ t.equal(err.isHafasError, true);
+ t.equal(err.message.slice(0, 7), 'H9360: ');
+ t.ok(err.message.length > 7);
- t.ok(err instanceof HafasInvalidRequestError)
- t.equal(err.isCausedByServer, false)
- t.equal(err.code, INVALID_REQUEST)
- t.equal(err.hafasCode, 'H9360')
+ t.ok(err instanceof HafasInvalidRequestError);
+ t.equal(err.isCausedByServer, false);
+ t.equal(err.code, INVALID_REQUEST);
+ t.equal(err.hafasCode, 'H9360');
- t.equal(err.hafasResponseId, resH9360.id)
- t.equal(err.hafasMessage, 'HAFAS Kernel: Date outside of the timetable period.')
- t.equal(err.hafasDescription, 'Fehler bei der Datumseingabe oder Datum außerhalb der Fahrplanperiode (01.05.2022 - 10.12.2022)')
- t.equal(err.secret, secret)
+ t.equal(err.hafasResponseId, resH9360.id);
+ t.equal(err.hafasMessage, 'HAFAS Kernel: Date outside of the timetable period.');
+ t.equal(err.hafasDescription, 'Fehler bei der Datumseingabe oder Datum außerhalb der Fahrplanperiode (01.05.2022 - 10.12.2022)');
+ t.equal(err.secret, secret);
- t.end()
+ t.end();
}
-})
+});
tap.test('checkIfResponseIsOk properly throws HAFAS "LOCATION" errors', (t) => {
try {
checkIfResIsOk({
body: resLocation,
errProps: {secret},
- })
+ });
} catch (err) {
- t.ok(err)
+ t.ok(err);
- t.ok(err instanceof HafasError)
- t.equal(err.isHafasError, true)
- t.equal(err.message.slice(0, 10), 'LOCATION: ')
- t.ok(err.message.length > 10)
+ t.ok(err instanceof HafasError);
+ t.equal(err.isHafasError, true);
+ t.equal(err.message.slice(0, 10), 'LOCATION: ');
+ t.ok(err.message.length > 10);
- t.ok(err instanceof HafasNotFoundError)
- t.equal(err.isCausedByServer, false)
- t.equal(err.code, NOT_FOUND)
- t.equal(err.hafasCode, 'LOCATION')
+ t.ok(err instanceof HafasNotFoundError);
+ t.equal(err.isCausedByServer, false);
+ t.equal(err.code, NOT_FOUND);
+ t.equal(err.hafasCode, 'LOCATION');
- t.equal(err.hafasResponseId, resLocation.id)
- t.equal(err.hafasMessage, 'HCI Service: location missing or invalid')
- t.equal(err.hafasDescription, 'Während der Suche ist ein interner Fehler aufgetreten')
- t.equal(err.secret, secret)
+ t.equal(err.hafasResponseId, resLocation.id);
+ t.equal(err.hafasMessage, 'HCI Service: location missing or invalid');
+ t.equal(err.hafasDescription, 'Während der Suche ist ein interner Fehler aufgetreten');
+ t.equal(err.secret, secret);
- t.end()
+ t.end();
}
-})
+});
tap.test('checkIfResponseIsOk properly throws HAFAS "NO_MATCH" errors', (t) => {
try {
checkIfResIsOk({
body: resNoMatch,
errProps: {secret},
- })
+ });
} catch (err) {
- t.ok(err)
+ t.ok(err);
- t.ok(err instanceof HafasError)
- t.equal(err.isHafasError, true)
- t.equal(err.message.slice(0, 10), 'NO_MATCH: ')
- t.ok(err.message.length > 10)
+ t.ok(err instanceof HafasError);
+ t.equal(err.isHafasError, true);
+ t.equal(err.message.slice(0, 10), 'NO_MATCH: ');
+ t.ok(err.message.length > 10);
- t.ok(err instanceof HafasNotFoundError)
- t.equal(err.isCausedByServer, false)
- t.equal(err.code, NOT_FOUND)
- t.equal(err.hafasCode, 'NO_MATCH')
+ t.ok(err instanceof HafasNotFoundError);
+ t.equal(err.isCausedByServer, false);
+ t.equal(err.code, NOT_FOUND);
+ t.equal(err.hafasCode, 'NO_MATCH');
- t.equal(err.hafasResponseId, resNoMatch.id)
- t.equal(err.hafasMessage, 'Nothing found.')
- t.equal(err.hafasDescription, 'Während der Suche ist leider ein interner Fehler aufgetreten. Bitte wenden Sie sich an unsere Serviceauskunft unter Tel. 0421 596059.')
- t.equal(err.secret, secret)
+ t.equal(err.hafasResponseId, resNoMatch.id);
+ t.equal(err.hafasMessage, 'Nothing found.');
+ t.equal(err.hafasDescription, 'Während der Suche ist leider ein interner Fehler aufgetreten. Bitte wenden Sie sich an unsere Serviceauskunft unter Tel. 0421 596059.');
+ t.equal(err.secret, secret);
- t.end()
+ t.end();
}
-})
+});
tap.test('checkIfResponseIsOk properly throws HAFAS "PARAMETER" errors', (t) => {
try {
checkIfResIsOk({
body: resParameter,
errProps: {secret},
- })
+ });
} catch (err) {
- t.ok(err)
+ t.ok(err);
- t.ok(err instanceof HafasError)
- t.equal(err.isHafasError, true)
- t.equal(err.message.slice(0, 11), 'PARAMETER: ')
- t.ok(err.message.length > 11)
+ t.ok(err instanceof HafasError);
+ t.equal(err.isHafasError, true);
+ t.equal(err.message.slice(0, 11), 'PARAMETER: ');
+ t.ok(err.message.length > 11);
- t.ok(err instanceof HafasInvalidRequestError)
- t.equal(err.isCausedByServer, false)
- t.equal(err.code, INVALID_REQUEST)
- t.equal(err.hafasCode, 'PARAMETER')
+ t.ok(err instanceof HafasInvalidRequestError);
+ t.equal(err.isCausedByServer, false);
+ t.equal(err.code, INVALID_REQUEST);
+ t.equal(err.hafasCode, 'PARAMETER');
- t.equal(err.hafasResponseId, resParameter.id)
- t.equal(err.hafasMessage, 'HCI Service: parameter invalid')
- t.equal(err.hafasDescription, 'Während der Suche ist ein interner Fehler aufgetreten')
- t.equal(err.secret, secret)
+ t.equal(err.hafasResponseId, resParameter.id);
+ t.equal(err.hafasMessage, 'HCI Service: parameter invalid');
+ t.equal(err.hafasDescription, 'Während der Suche ist ein interner Fehler aufgetreten');
+ t.equal(err.secret, secret);
- t.end()
+ t.end();
}
-})
+});
tap.test('checkIfResponseIsOk properly parses an unknown HAFAS errors', (t) => {
const body = {
@@ -147,40 +147,42 @@ tap.test('checkIfResponseIsOk properly parses an unknown HAFAS errors', (t) => {
errTxt: 'random errTxt',
errTxtOut: 'even more random errTxtOut',
svcResL: [],
- }
+ };
try {
checkIfResIsOk({
body,
errProps: {secret},
- })
+ });
} catch (err) {
- t.ok(err)
+ t.ok(err);
- t.ok(err instanceof HafasError)
- t.equal(err.isHafasError, true)
- t.equal(err.message, `${body.err}: ${body.errTxt}`)
+ t.ok(err instanceof HafasError);
+ t.equal(err.isHafasError, true);
+ t.equal(err.message, `${body.err}: ${body.errTxt}`);
- t.equal(err.isCausedByServer, false)
- t.equal(err.code, null)
- t.equal(err.hafasCode, body.err)
+ t.equal(err.isCausedByServer, false);
+ t.equal(err.code, null);
+ t.equal(err.hafasCode, body.err);
- t.equal(err.hafasResponseId, body.id)
- t.equal(err.hafasMessage, body.errTxt)
- t.equal(err.hafasDescription, body.errTxtOut)
- t.equal(err.secret, secret)
+ t.equal(err.hafasResponseId, body.id);
+ t.equal(err.hafasMessage, body.errTxt);
+ t.equal(err.hafasDescription, body.errTxtOut);
+ t.equal(err.secret, secret);
- t.end()
+ t.end();
}
-})
+});
const freeze = (val) => {
if (
'object' === typeof val
&& val !== null
&& !Array.isArray(val)
- ) Object.freeze(val)
-}
+ ) {
+ Object.freeze(val);
+ }
+};
const ctx = {
// random but unique
opt: {
@@ -205,33 +207,33 @@ const ctx = {
transformReq: (_, req) => req,
},
-}
-forEach(ctx, freeze)
+};
+forEach(ctx, freeze);
tap.test('lib/request calls profile.transformReqBody & profile.transformReq properly', async (t) => {
const customTransformReqBody = (ctx, reqBody) => {
- const p = 'transformReqBody call: '
- t.same(ctx, customCtx, 'ctx should be the passed-in ctx')
+ const p = 'transformReqBody call: ';
+ t.same(ctx, customCtx, 'ctx should be the passed-in ctx');
- t.ok(reqBody, 'reqBody')
- t.equal(reqBody.client, ctx.profile.client, p + 'reqBody.client')
- t.equal(reqBody.ext, ctx.profile.ext, p + 'reqBody.ext')
- t.equal(reqBody.var, ctx.profile.var, p + 'reqBody.var')
- t.equal(reqBody.auth, ctx.profile.auth, p + 'reqBody.auth')
- t.equal(reqBody.lang, ctx.opt.language, p + 'reqBody.lang')
+ t.ok(reqBody, 'reqBody');
+ t.equal(reqBody.client, ctx.profile.client, p + 'reqBody.client');
+ t.equal(reqBody.ext, ctx.profile.ext, p + 'reqBody.ext');
+ t.equal(reqBody.var, ctx.profile.var, p + 'reqBody.var');
+ t.equal(reqBody.auth, ctx.profile.auth, p + 'reqBody.auth');
+ t.equal(reqBody.lang, ctx.opt.language, p + 'reqBody.lang');
// We test if lib/request.js handles returning a new object.
return {
...reqBody,
- }
- }
+ };
+ };
const customTransformReq = (ctx, req) => {
- const p = 'transformReq call: '
- t.same(ctx, customCtx, p + 'ctx should be the passed-in ctx')
+ const p = 'transformReq call: ';
+ t.same(ctx, customCtx, p + 'ctx should be the passed-in ctx');
- t.equal(typeof req.body, 'string', p + 'req.body')
- t.ok(req.body, p + 'req.body')
+ t.equal(typeof req.body, 'string', p + 'req.body');
+ t.ok(req.body, p + 'req.body');
// We test if lib/request.js handles returning a new object.
return {
@@ -239,8 +241,8 @@ tap.test('lib/request calls profile.transformReqBody & profile.transformReq prop
// From node-fetch, used by isomorphic-fetch:
// > req/res timeout in ms, it resets on redirect. 0 to disable (OS limit applies). Signal is recommended instead.
timeout: 100,
- }
- }
+ };
+ };
const customCtx = {
...ctx,
@@ -249,12 +251,12 @@ tap.test('lib/request calls profile.transformReqBody & profile.transformReq prop
transformReqBody: customTransformReqBody,
transformReq: customTransformReq,
},
- }
- const tripReq = formatTripReq(customCtx, 'unknown-trip-id')
+ };
+ const tripReq = formatTripReq(customCtx, 'unknown-trip-id');
// todo: set 1s timeout
await t.rejects(async () => {
- await request(customCtx, USER_AGENT, tripReq)
- })
- t.end()
-})
+ await request(customCtx, USER_AGENT, tripReq);
+ });
+ t.end();
+});
diff --git a/test/mobiliteit-lu-line.js b/test/mobiliteit-lu-line.js
index 8b7b3199..cd6de6d0 100644
--- a/test/mobiliteit-lu-line.js
+++ b/test/mobiliteit-lu-line.js
@@ -1,15 +1,15 @@
-import tap from 'tap'
+import tap from 'tap';
-import {createClient} from '../index.js'
-import {profile as rawProfile} from '../p/mobiliteit-lu/index.js'
+import {createClient} from '../index.js';
+import {profile as rawProfile} from '../p/mobiliteit-lu/index.js';
-const client = createClient(rawProfile, 'public-transport/hafas-client:test')
-const {profile} = client
+const client = createClient(rawProfile, 'public-transport/hafas-client:test');
+const {profile} = client;
const opt = {
linesOfStops: false, // parse & expose lines at the stop/station?
remarks: true,
-}
+};
tap.test('parses a line correctly (mobiliteit.lu)', (t) => {
const rawLine = {
@@ -30,10 +30,10 @@ tap.test('parses a line correctly (mobiliteit.lu)', (t) => {
catCode: '1',
admin: 'C88---',
},
- }
+ };
- const ctx = {profile, opt}
- const stop = profile.parseLine(ctx, rawLine)
+ const ctx = {profile, opt};
+ const stop = profile.parseLine(ctx, rawLine);
t.same(stop, {
type: 'line',
@@ -45,6 +45,6 @@ tap.test('parses a line correctly (mobiliteit.lu)', (t) => {
productName: 'IC',
mode: 'train',
product: 'national-train',
- })
- t.end()
-})
+ });
+ t.end();
+});
diff --git a/test/oebb-trip.js b/test/oebb-trip.js
index 214e8bce..c35310de 100644
--- a/test/oebb-trip.js
+++ b/test/oebb-trip.js
@@ -1,17 +1,17 @@
// todo: use import assertions once they're supported by Node.js & ESLint
// https://github.com/tc39/proposal-import-assertions
-import {createRequire} from 'module'
-const require = createRequire(import.meta.url)
+import {createRequire} from 'module';
+const require = createRequire(import.meta.url);
-import tap from 'tap'
+import tap from 'tap';
-import {createClient} from '../index.js'
-import {profile as rawProfile} from '../p/oebb/index.js'
-const res = require('./fixtures/oebb-trip.json')
-import {oebbTrip as expected} from './fixtures/oebb-trip.js'
+import {createClient} from '../index.js';
+import {profile as rawProfile} from '../p/oebb/index.js';
+const res = require('./fixtures/oebb-trip.json');
+import {oebbTrip as expected} from './fixtures/oebb-trip.js';
-const client = createClient(rawProfile, 'public-transport/hafas-client:test')
-const {profile} = client
+const client = createClient(rawProfile, 'public-transport/hafas-client:test');
+const {profile} = client;
const opt = {
stopovers: true,
@@ -20,13 +20,13 @@ const opt = {
entrances: true,
remarks: true,
when: '2020-06-11T15:25:00+02:00',
-}
+};
tap.test('parses a trip correctly (ÖBB)', (t) => {
- const common = profile.parseCommon({profile, opt, res})
- const ctx = {profile, opt, common, res}
- const trip = profile.parseTrip(ctx, res.journey)
+ const common = profile.parseCommon({profile, opt, res});
+ const ctx = {profile, opt, common, res};
+ const trip = profile.parseTrip(ctx, res.journey);
- t.same(trip, expected)
- t.end()
-})
+ t.same(trip, expected);
+ t.end();
+});
diff --git a/test/parse/date-time.js b/test/parse/date-time.js
index cf7e95c6..f94b34d3 100644
--- a/test/parse/date-time.js
+++ b/test/parse/date-time.js
@@ -1,53 +1,53 @@
-import tap from 'tap'
-import {parseDateTime as parse} from '../../parse/date-time.js'
+import tap from 'tap';
+import {parseDateTime as parse} from '../../parse/date-time.js';
const ctx = {
common: {},
opt: {},
profile: {
timezone: 'Europe/Berlin',
- locale: 'de-DE'
- }
-}
+ locale: 'de-DE',
+ },
+};
tap.test('date & time parsing returns a timestamp', (t) => {
- const iso = parse(ctx, '20190819', '203000', undefined, false)
- const ts = parse(ctx, '20190819', '203000', undefined, true)
- t.equal(ts, +new Date(iso))
- t.equal(ts, 1566239400 * 1000)
- t.end()
-})
+ const iso = parse(ctx, '20190819', '203000', undefined, false);
+ const ts = parse(ctx, '20190819', '203000', undefined, true);
+ t.equal(ts, Number(new Date(iso)));
+ t.equal(ts, 1566239400 * 1000);
+ t.end();
+});
tap.test('date & time parsing uses tzOffset', (t) => {
- const iso = parse(ctx, '20190819', '203000', -120, false)
- t.equal(iso, '2019-08-19T20:30:00-02:00')
- t.end()
-})
+ const iso = parse(ctx, '20190819', '203000', -120, false);
+ t.equal(iso, '2019-08-19T20:30:00-02:00');
+ t.end();
+});
tap.test('date & time parsing works with day "overflow"', (t) => {
- const iso = parse(ctx, '20190819', '02203000', undefined, false)
- t.equal(iso, '2019-08-21T20:30:00+02:00')
- t.end()
-})
+ const iso = parse(ctx, '20190819', '02203000', undefined, false);
+ t.equal(iso, '2019-08-21T20:30:00+02:00');
+ t.end();
+});
// #106
tap.test('date & time parsing works with day "overflow" & tzOffset', (t) => {
- const iso = parse(ctx, '20190819', '02203000', -120, false)
- t.equal(iso, '2019-08-21T20:30:00-02:00')
- t.end()
-})
+ const iso = parse(ctx, '20190819', '02203000', -120, false);
+ t.equal(iso, '2019-08-21T20:30:00-02:00');
+ t.end();
+});
tap.test('date & time parsing works with summer & winter time', (t) => {
- const iso = parse(ctx, '20190219', '203000', undefined, false)
- t.equal(iso, '2019-02-19T20:30:00+01:00')
- t.end()
-})
+ const iso = parse(ctx, '20190219', '203000', undefined, false);
+ t.equal(iso, '2019-02-19T20:30:00+01:00');
+ t.end();
+});
tap.test('date & time parsing uses profile.timezone', (t) => {
const iso = parse({
...ctx,
- profile: {...ctx.profile, timezone: 'Europe/Moscow'}
- }, '20190819', '203000', undefined, false)
- t.equal(iso, '2019-08-19T20:30:00+03:00')
- t.end()
-})
+ profile: {...ctx.profile, timezone: 'Europe/Moscow'},
+ }, '20190819', '203000', undefined, false);
+ t.equal(iso, '2019-08-19T20:30:00+03:00');
+ t.end();
+});
diff --git a/test/parse/hint.js b/test/parse/hint.js
index 9dbbac14..3cbce003 100644
--- a/test/parse/hint.js
+++ b/test/parse/hint.js
@@ -1,58 +1,58 @@
-import tap from 'tap'
-import {parseHint as parse} from '../../parse/hint.js'
+import tap from 'tap';
+import {parseHint as parse} from '../../parse/hint.js';
const ctx = {
data: {},
opt: {},
- profile: {}
-}
+ profile: {},
+};
tap.test('parses hints correctly', (t) => {
const input = {
type: 'A',
code: 'bf',
prio: 123,
- txtN: 'some text'
- }
+ txtN: 'some text',
+ };
const expected = {
type: 'hint',
code: 'bf',
- text: 'some text'
- }
+ text: 'some text',
+ };
- t.same(parse(ctx, input), expected)
+ t.same(parse(ctx, input), expected);
t.same(parse(ctx, {
- ...input, type: 'I'
- }), expected)
+ ...input, type: 'I',
+ }), expected);
// alternative trip
t.same(parse(ctx, {
- ...input, type: 'L', jid: 'trip id'
+ ...input, type: 'L', jid: 'trip id',
}), {
- ...expected, type: 'status', code: 'alternative-trip', tripId: 'trip id'
- })
+ ...expected, type: 'status', code: 'alternative-trip', tripId: 'trip id',
+ });
// type: M
t.same(parse(ctx, {
- ...input, type: 'M', txtS: 'some summary'
+ ...input, type: 'M', txtS: 'some summary',
}), {
- ...expected, type: 'status', summary: 'some summary'
- })
+ ...expected, type: 'status', summary: 'some summary',
+ });
// type: D
for (const type of ['D', 'U', 'R', 'N', 'Y']) {
t.same(parse(ctx, {...input, type}), {
- ...expected, type: 'status'
- })
+ ...expected, type: 'status',
+ });
}
// .code via .icon
t.same(parse(ctx, {
- ...input, code: null, icon: {type: 'cancel'}
- }), {...expected, code: 'cancelled'})
+ ...input, code: null, icon: {type: 'cancel'},
+ }), {...expected, code: 'cancelled'});
// invalid
- t.equal(parse(ctx, {...input, type: 'X'}), null)
+ t.equal(parse(ctx, {...input, type: 'X'}), null);
- t.end()
-})
+ t.end();
+});
diff --git a/test/parse/icon.js b/test/parse/icon.js
index 1d5ec6c2..0919a026 100644
--- a/test/parse/icon.js
+++ b/test/parse/icon.js
@@ -1,74 +1,74 @@
-import tap from 'tap'
-import {parseIcon as parse} from '../../parse/icon.js'
+import tap from 'tap';
+import {parseIcon as parse} from '../../parse/icon.js';
const ctx = {
data: {},
opt: {},
- profile: {}
-}
+ profile: {},
+};
tap.test('parses icons correctly', (t) => {
const text = {
- "res": "BVG",
- "text": "Berliner Verkehrsbetriebe"
- }
+ res: 'BVG',
+ text: 'Berliner Verkehrsbetriebe',
+ };
t.same(parse(ctx, text), {
type: 'BVG',
- title: 'Berliner Verkehrsbetriebe'
- })
+ title: 'Berliner Verkehrsbetriebe',
+ });
const txtS = {
- "res": "PROD_BUS",
- "txtS": "18"
- }
+ res: 'PROD_BUS',
+ txtS: '18',
+ };
t.same(parse(ctx, txtS), {
type: 'PROD_BUS',
- title: '18'
- })
+ title: '18',
+ });
const txt = {
- "res": "RBB",
- "txt": "Regionalbus Braunschweig GmbH"
- }
+ res: 'RBB',
+ txt: 'Regionalbus Braunschweig GmbH',
+ };
t.same(parse(ctx, txt), {
type: 'RBB',
- title: 'Regionalbus Braunschweig GmbH'
- })
+ title: 'Regionalbus Braunschweig GmbH',
+ });
const noText = {
- "res": "attr_bike_r"
- }
+ res: 'attr_bike_r',
+ };
t.same(parse(ctx, noText), {
type: 'attr_bike_r',
- title: null
- })
+ title: null,
+ });
const withColor = {
- "res": "prod_sub_t",
- "fg": {
- "r": 255,
- "g": 255,
- "b": 255,
- "a": 255
+ res: 'prod_sub_t',
+ fg: {
+ r: 255,
+ g: 255,
+ b: 255,
+ a: 255,
},
- "bg": {
- "r": 0,
- "g": 51,
- "b": 153,
- "a": 255
- }
- }
+ bg: {
+ r: 0,
+ g: 51,
+ b: 153,
+ a: 255,
+ },
+ };
t.same(parse(ctx, withColor), {
type: 'prod_sub_t',
title: null,
fgColor: {r: 255, g: 255, b: 255, a: 255},
- bgColor: {r: 0, g: 51, b: 153, a: 255}
- })
+ bgColor: {r: 0, g: 51, b: 153, a: 255},
+ });
const empty = {
- "res": "Empty"
- }
- t.equal(parse(ctx, empty), null)
+ res: 'Empty',
+ };
+ t.equal(parse(ctx, empty), null);
- t.end()
-})
+ t.end();
+});
diff --git a/test/parse/line.js b/test/parse/line.js
index fd30d279..518f9cb4 100644
--- a/test/parse/line.js
+++ b/test/parse/line.js
@@ -1,19 +1,19 @@
-import tap from 'tap'
-import omit from 'lodash/omit.js'
-import {parseLine as parse} from '../../parse/line.js'
+import tap from 'tap';
+import omit from 'lodash/omit.js';
+import {parseLine as parse} from '../../parse/line.js';
const profile = {
products: [
{id: 'train', bitmasks: [1]},
{id: 'ferry', bitmasks: [2]},
- {id: 'bus', bitmasks: [4, 8]}
- ]
-}
+ {id: 'bus', bitmasks: [4, 8]},
+ ],
+};
const ctx = {
data: {},
opt: {},
- profile
-}
+ profile,
+};
tap.test('parses lines correctly', (t) => {
const input = {
@@ -23,8 +23,8 @@ tap.test('parses lines correctly', (t) => {
num: 123,
// HAFAS endpoints commonly have these padded admin codes.
admin: 'foo---',
- }
- }
+ },
+ };
const expected = {
type: 'line',
id: 'foo',
@@ -32,32 +32,32 @@ tap.test('parses lines correctly', (t) => {
name: 'foo line',
public: true,
adminCode: 'foo---',
- }
+ };
- t.same(parse(ctx, input), expected)
+ t.same(parse(ctx, input), expected);
t.same(parse(ctx, {
- ...input, line: null, addName: input.line
- }), expected)
+ ...input, line: null, addName: input.line,
+ }), expected);
t.same(parse(ctx, {
- ...input, line: null, name: input.line
- }), expected)
+ ...input, line: null, name: input.line,
+ }), expected);
// no prodCtx.lineId
t.same(parse(ctx, {
- ...input, prodCtx: {...input.prodCtx, lineId: null}
+ ...input, prodCtx: {...input.prodCtx, lineId: null},
}), {
- ...expected, id: 'foo-line'
- })
+ ...expected, id: 'foo-line',
+ });
// no prodCtx
t.same(parse(ctx, {
- ...input, prodCtx: undefined
+ ...input, prodCtx: undefined,
}), {
...omit(expected, [
'adminCode',
]),
id: 'foo-line',
fahrtNr: null,
- })
- t.end()
-})
+ });
+ t.end();
+});
diff --git a/test/parse/location.js b/test/parse/location.js
index 0896a18a..3870bccf 100644
--- a/test/parse/location.js
+++ b/test/parse/location.js
@@ -1,12 +1,12 @@
-import tap from 'tap'
-import omit from 'lodash/omit.js'
-import {parseLocation as parse} from '../../parse/location.js'
+import tap from 'tap';
+import omit from 'lodash/omit.js';
+import {parseLocation as parse} from '../../parse/location.js';
const profile = {
parseLocation: parse,
parseStationName: (_, name) => name.toLowerCase(),
- parseProductsBitmask: (_, bitmask) => [bitmask]
-}
+ parseProductsBitmask: (_, bitmask) => [bitmask],
+};
const ctx = {
data: {},
@@ -15,66 +15,66 @@ const ctx = {
subStops: true,
entrances: true,
},
- profile
-}
+ profile,
+};
tap.test('parses an address correctly', (t) => {
const input = {
type: 'A',
name: 'Foo street 3',
lid: 'a=b@L=some%20id',
- crd: {x: 13418027, y: 52515503}
- }
+ crd: {x: 13418027, y: 52515503},
+ };
- const address = parse(ctx, input)
+ const address = parse(ctx, input);
t.same(address, {
type: 'location',
id: 'some id',
address: 'Foo street 3',
latitude: 52.515503,
- longitude: 13.418027
- })
+ longitude: 13.418027,
+ });
- t.end()
-})
+ t.end();
+});
tap.test('parses a POI correctly', (t) => {
const input = {
type: 'P',
name: 'some POI',
lid: 'a=b@L=some%20id',
- crd: {x: 13418027, y: 52515503}
- }
+ crd: {x: 13418027, y: 52515503},
+ };
- const poi = parse(ctx, input)
+ const poi = parse(ctx, input);
t.same(poi, {
type: 'location',
poi: true,
id: 'some id',
name: 'some POI',
latitude: 52.515503,
- longitude: 13.418027
- })
+ longitude: 13.418027,
+ });
- const withExtId = parse(ctx, {...input, extId: 'some ext id'})
- t.equal(withExtId.id, 'some ext id')
+ const withExtId = parse(ctx, {...input, extId: 'some ext id'});
+ t.equal(withExtId.id, 'some ext id');
- const withLeadingZero = parse(ctx, {...input, extId: '00some ext id'})
- t.equal(withLeadingZero.id, 'some ext id')
+ const withLeadingZero = parse(ctx, {...input, extId: '00some ext id'});
+ t.equal(withLeadingZero.id, 'some ext id');
- t.end()
-})
+ t.end();
+});
const fooBusStop = {
type: 'S',
name: 'Foo bus stop',
lid: 'a=b@L=foo%20stop',
crd: {x: 13418027, y: 52515503},
- pCls: 123
-}
+ pCls: 123,
+};
tap.test('parses a stop correctly', (t) => {
- const stop = parse(ctx, fooBusStop)
+ const stop = parse(ctx, fooBusStop);
t.same(stop, {
type: 'stop',
id: 'foo stop',
@@ -83,43 +83,43 @@ tap.test('parses a stop correctly', (t) => {
type: 'location',
id: 'foo stop',
latitude: 52.515503,
- longitude: 13.418027
+ longitude: 13.418027,
},
- products: [123]
- })
+ products: [123],
+ });
- const withoutLoc = parse(ctx, omit(fooBusStop, ['crd']))
- t.equal(withoutLoc.location, null)
+ const withoutLoc = parse(ctx, omit(fooBusStop, ['crd']));
+ t.equal(withoutLoc.location, null);
- const mainMast = parse(ctx, {...fooBusStop, isMainMast: true})
- t.equal(mainMast.type, 'station')
+ const mainMast = parse(ctx, {...fooBusStop, isMainMast: true});
+ t.equal(mainMast.type, 'station');
- const meta = parse(ctx, {...fooBusStop, meta: 1})
- t.equal(meta.isMeta, true)
+ const meta = parse(ctx, {...fooBusStop, meta: 1});
+ t.equal(meta.isMeta, true);
- const lineA = {id: 'a'}
+ const lineA = {id: 'a'};
const withLines = parse({
...ctx,
- opt: {...ctx.opt, linesOfStops: true}
+ opt: {...ctx.opt, linesOfStops: true},
}, {
- ...fooBusStop, lines: [lineA]
- })
- t.same(withLines.lines, [lineA])
+ ...fooBusStop, lines: [lineA],
+ });
+ t.same(withLines.lines, [lineA]);
- t.end()
-})
+ t.end();
+});
tap.test('falls back to coordinates from `lid`', (t) => {
const {location} = parse(ctx, {
type: 'S',
name: 'foo',
- lid: 'a=b@L=foo@X=12345678@Y=23456789'
- })
- t.ok(location)
- t.equal(location.latitude, 23.456789)
- t.equal(location.longitude, 12.345678)
- t.end()
-})
+ lid: 'a=b@L=foo@X=12345678@Y=23456789',
+ });
+ t.ok(location);
+ t.equal(location.latitude, 23.456789);
+ t.equal(location.longitude, 12.345678);
+ t.end();
+});
tap.test('handles recursive references properly', (t) => {
const southernInput = {
@@ -129,8 +129,8 @@ tap.test('handles recursive references properly', (t) => {
crd: {x: 22222222, y: 11111111},
// This doesn't make sense semantically, but we test if
// `parseLocation` falls into an endless recursive loop.
- stopLocL: [1]
- }
+ stopLocL: [1],
+ };
const northernInput = {
type: 'S',
name: 'Northern Platform',
@@ -138,10 +138,10 @@ tap.test('handles recursive references properly', (t) => {
crd: {x: 44444444, y: 33333333},
// This doesn't make sense semantically, but we test if
// `parseLocation` falls into an endless recursive loop.
- entryLocL: [0]
- }
- const common = {locL: [southernInput, northernInput]}
- const _ctx = {...ctx, res: {common}}
+ entryLocL: [0],
+ };
+ const common = {locL: [southernInput, northernInput]};
+ const _ctx = {...ctx, res: {common}};
const northernExpected = {
type: 'stop',
@@ -150,9 +150,9 @@ tap.test('handles recursive references properly', (t) => {
location: {
type: 'location',
id: 'northern-platform',
- latitude: 33.333333, longitude: 44.444444
- }
- }
+ latitude: 33.333333, longitude: 44.444444,
+ },
+ };
const southernExpected = {
type: 'station',
id: 'southern-platform',
@@ -160,23 +160,23 @@ tap.test('handles recursive references properly', (t) => {
location: {
type: 'location',
id: 'southern-platform',
- latitude: 11.111111, longitude: 22.222222
+ latitude: 11.111111, longitude: 22.222222,
},
- stops: [northernExpected]
- }
+ stops: [northernExpected],
+ };
const {entrances} = parse(_ctx, {
...fooBusStop,
- entryLocL: [0]
- })
- t.same(entrances, [southernExpected.location])
+ entryLocL: [0],
+ });
+ t.same(entrances, [southernExpected.location]);
const {type, stops} = parse(_ctx, {
...fooBusStop,
- stopLocL: [0]
- })
- t.equal(type, 'station')
- t.same(stops, [southernExpected])
+ stopLocL: [0],
+ });
+ t.equal(type, 'station');
+ t.same(stops, [southernExpected]);
- t.end()
-})
+ t.end();
+});
diff --git a/test/parse/operator.js b/test/parse/operator.js
index 4036099b..6b4a8273 100644
--- a/test/parse/operator.js
+++ b/test/parse/operator.js
@@ -1,22 +1,22 @@
-import tap from 'tap'
-import {parseOperator as parse} from '../../parse/operator.js'
+import tap from 'tap';
+import {parseOperator as parse} from '../../parse/operator.js';
const ctx = {
data: {},
opt: {},
- profile: {}
-}
+ profile: {},
+};
tap.test('parses an operator correctly', (t) => {
const op = {
- "name": "Berliner Verkehrsbetriebe",
- "icoX": 1,
- "id": "Berliner Verkehrsbetriebe"
- }
+ name: 'Berliner Verkehrsbetriebe',
+ icoX: 1,
+ id: 'Berliner Verkehrsbetriebe',
+ };
t.same(parse(ctx, op), {
type: 'operator',
id: 'berliner-verkehrsbetriebe',
- name: 'Berliner Verkehrsbetriebe'
- })
- t.end()
-})
+ name: 'Berliner Verkehrsbetriebe',
+ });
+ t.end();
+});
diff --git a/test/parse/warning.js b/test/parse/warning.js
index b1083db5..ecd374f5 100644
--- a/test/parse/warning.js
+++ b/test/parse/warning.js
@@ -1,16 +1,16 @@
-import tap from 'tap'
-import {parseWarning as parse} from '../../parse/warning.js'
-import merge from 'lodash/merge.js'
+import tap from 'tap';
+import {parseWarning as parse} from '../../parse/warning.js';
+import merge from 'lodash/merge.js';
const profile = {
parseProductsBitmask: (_, bitmask) => [bitmask],
- parseDateTime: (_, date, time) => date + ':' + time
-}
+ parseDateTime: (_, date, time) => date + ':' + time,
+};
const ctx = {
data: {},
opt: {},
- profile
-}
+ profile,
+};
tap.test('parses warnings correctly', (t) => {
const input = {
@@ -19,8 +19,8 @@ tap.test('parses warnings correctly', (t) => {
text: 'some long
text
body', // todo: null
icon: {type: 'HimWarn'}, // todo: null
prio: 123,
- cat: 1
- }
+ cat: 1,
+ };
const expected = {
id: 'some warning ID',
type: 'status',
@@ -28,26 +28,26 @@ tap.test('parses warnings correctly', (t) => {
text: 'some long\ntext\n\nbody',
icon: {type: 'HimWarn'},
priority: 123,
- category: 1
- }
+ category: 1,
+ };
- t.same(parse(ctx, input), expected)
+ t.same(parse(ctx, input), expected);
// without basic fields
- t.same(parse(ctx, {...input, hid: null}), {...expected, id: null})
- t.same(parse(ctx, {...input, head: null}), {...expected, summary: null})
- t.same(parse(ctx, {...input, text: null}), {...expected, text: null})
- t.same(parse(ctx, {...input, cat: null}), {...expected, category: null})
+ t.same(parse(ctx, {...input, hid: null}), {...expected, id: null});
+ t.same(parse(ctx, {...input, head: null}), {...expected, summary: null});
+ t.same(parse(ctx, {...input, text: null}), {...expected, text: null});
+ t.same(parse(ctx, {...input, cat: null}), {...expected, category: null});
// without icon
t.same(parse(ctx, {...input, icon: null}), {
- ...expected, type: 'warning', icon: null
- })
+ ...expected, type: 'warning', icon: null,
+ });
// with products
t.same(parse(ctx, {...input, prod: 123}), {
- ...expected, products: [123]
- })
+ ...expected, products: [123],
+ });
// validFrom, validUntil, modified
t.same(parse(ctx, {
@@ -59,8 +59,8 @@ tap.test('parses warnings correctly', (t) => {
...expected,
validFrom: '20190101:094020',
validUntil: '20190101:114020',
- modified: '20190101:084020'
- })
+ modified: '20190101:084020',
+ });
// events
const ctxWithHimMsgEventL = {
@@ -73,11 +73,11 @@ tap.test('parses warnings correctly', (t) => {
}],
},
},
- }
+ };
const inputWithEventRefL = {
...input,
eventRefL: [0],
- }
+ };
const expectedWithEvents = {
...expected,
events: [{
@@ -87,11 +87,11 @@ tap.test('parses warnings correctly', (t) => {
end: '20211221:012345',
sections: [],
}],
- }
+ };
t.same(parse(
ctxWithHimMsgEventL,
inputWithEventRefL,
- ), expectedWithEvents)
+ ), expectedWithEvents);
// without res.common.himMsgEventL[].{f,t}Time
t.same(parse(
merge(ctxWithHimMsgEventL, {
@@ -109,10 +109,10 @@ tap.test('parses warnings correctly', (t) => {
events: [{
start: '20211111:000000',
end: '20211221:000000',
- }]
- }))
+ }],
+ }));
// todo: .edges
- t.end()
-})
+ t.end();
+});
diff --git a/test/parse/when.js b/test/parse/when.js
index 982fca1b..7134724d 100644
--- a/test/parse/when.js
+++ b/test/parse/when.js
@@ -1,41 +1,43 @@
-import tap from 'tap'
-import {parseWhen as parse} from '../../parse/when.js'
+import tap from 'tap';
+import {parseWhen as parse} from '../../parse/when.js';
const profile = {
parseDateTime: ({profile}, date, time, tzOffset, timestamp = false) => {
- if (timestamp) return ((date + '' + time) - tzOffset * 60) * 1000
- return date + ':' + time
- }
-}
+ if (timestamp) {
+ return (String(date) + time - tzOffset * 60) * 1000;
+ }
+ return date + ':' + time;
+ },
+};
const ctx = {
data: {},
opt: {},
- profile
-}
+ profile,
+};
tap.test('parseWhen works correctly', (t) => {
- const date = '20190606'
- const timeS = '163000'
- const timeR = '163130'
- const tzOffset = 120
+ const date = '20190606';
+ const timeS = '163000';
+ const timeR = '163130';
+ const tzOffset = 120;
const expected = {
when: '20190606:163130',
plannedWhen: '20190606:163000',
- delay: 130 // seconds
- }
+ delay: 130, // seconds
+ };
- t.same(parse(ctx, date, timeS, timeR, tzOffset), expected)
+ t.same(parse(ctx, date, timeS, timeR, tzOffset), expected);
// no realtime data
t.same(parse(ctx, date, timeS, null, tzOffset), {
- ...expected, when: expected.plannedWhen, delay: null
- })
+ ...expected, when: expected.plannedWhen, delay: null,
+ });
// cancelled
t.same(parse(ctx, date, timeS, timeR, tzOffset, true), {
...expected,
when: null,
- prognosedWhen: expected.when
- })
- t.end()
-})
+ prognosedWhen: expected.when,
+ });
+ t.end();
+});
diff --git a/test/rejseplanen-trip.js b/test/rejseplanen-trip.js
index 00087ee8..8888f48f 100644
--- a/test/rejseplanen-trip.js
+++ b/test/rejseplanen-trip.js
@@ -1,17 +1,17 @@
// todo: use import assertions once they're supported by Node.js & ESLint
// https://github.com/tc39/proposal-import-assertions
-import {createRequire} from 'module'
-const require = createRequire(import.meta.url)
+import {createRequire} from 'module';
+const require = createRequire(import.meta.url);
-import tap from 'tap'
+import tap from 'tap';
-import {createClient} from '../index.js'
-import {profile as rawProfile} from '../p/rejseplanen/index.js'
-const res = require('./fixtures/rejseplanen-trip.json')
-import {rejseplanenTrip as expected} from './fixtures/rejseplanen-trip.js'
+import {createClient} from '../index.js';
+import {profile as rawProfile} from '../p/rejseplanen/index.js';
+const res = require('./fixtures/rejseplanen-trip.json');
+import {rejseplanenTrip as expected} from './fixtures/rejseplanen-trip.js';
-const client = createClient(rawProfile, 'public-transport/hafas-client:test')
-const {profile} = client
+const client = createClient(rawProfile, 'public-transport/hafas-client:test');
+const {profile} = client;
const opt = {
stopovers: true,
@@ -20,13 +20,13 @@ const opt = {
entrances: true,
remarks: true,
when: '2021-11-12T17:30:00+02:00',
-}
+};
tap.test('parses a trip correctly (Rejseplanen)', (t) => {
- const common = profile.parseCommon({profile, opt, res})
- const ctx = {profile, opt, common, res}
- const trip = profile.parseTrip(ctx, res.journey)
+ const common = profile.parseCommon({profile, opt, res});
+ const ctx = {profile, opt, common, res};
+ const trip = profile.parseTrip(ctx, res.journey);
- t.same(trip, expected)
- t.end()
-})
+ t.same(trip, expected);
+ t.end();
+});
diff --git a/test/retry.js b/test/retry.js
index 0ba287a1..d7eba7ce 100644
--- a/test/retry.js
+++ b/test/retry.js
@@ -1,59 +1,61 @@
-import tap from 'tap'
+import tap from 'tap';
-import {createClient} from '../index.js'
-import {withRetrying} from '../retry.js'
-import {profile as vbbProfile} from '../p/vbb/index.js'
+import {createClient} from '../index.js';
+import {withRetrying} from '../retry.js';
+import {profile as vbbProfile} from '../p/vbb/index.js';
-const userAgent = 'public-transport/hafas-client:test'
-const spichernstr = '900000042101'
+const userAgent = 'public-transport/hafas-client:test';
+const spichernstr = '900000042101';
tap.test('withRetrying works', (t) => {
// for the first 3 calls, return different kinds of errors
- let calls = 0
+ let calls = 0;
const failingRequest = async (ctx, userAgent, reqData) => {
- calls++
+ calls++;
if (calls === 1) {
- const err = new Error('HAFAS error')
- err.isHafasError = true
- return Promise.reject(err)
+ const err = new Error('HAFAS error');
+ err.isHafasError = true;
+ return Promise.reject(err);
}
if (calls === 2) {
- const err = new Error('fetch error')
- err.code = 'EFOO'
- return Promise.reject(err)
+ const err = new Error('fetch error');
+ err.code = 'EFOO';
+ return Promise.reject(err);
+ }
+ if (calls < 4) {
+ return Promise.reject(new Error('generic error'));
}
- if (calls < 4) return Promise.reject(new Error('generic error'))
return {
res: [],
- common: {}
- }
- }
+ common: {},
+ };
+ };
const profile = withRetrying({
...vbbProfile,
- request: failingRequest
+ request: failingRequest,
}, {
retries: 3,
minTimeout: 100,
factor: 2,
- randomize: false
- })
- const client = createClient(profile, userAgent)
+ randomize: false,
+ });
+ const client = createClient(profile, userAgent);
- t.plan(2 + 4)
+ t.plan(2 + 4);
client.departures(spichernstr, {duration: 1})
- .then((res) => {
- const {
- departures: deps,
- realtimeDataUpdatedAt,
- } = res
- t.same(deps, [], 'resolved with invalid value')
- t.equal(realtimeDataUpdatedAt, null, 'resolved with invalid value')
- })
- .catch(t.ifError)
+ .then((res) => {
+ const {
+ departures: deps,
+ realtimeDataUpdatedAt,
+ } = res;
+ t.same(deps, [], 'resolved with invalid value');
+ t.equal(realtimeDataUpdatedAt, null, 'resolved with invalid value');
+ })
+ .catch(t.ifError);
- setTimeout(() => t.equal(calls, 1), 50) // buffer
- setTimeout(() => t.equal(calls, 2), 200) // 100 + buffer
- setTimeout(() => t.equal(calls, 3), 450) // 100 + 200 + buffer
- setTimeout(() => t.equal(calls, 4), 900) // 100 + 200 + 400 + buffer
-})
+ setTimeout(() => t.equal(calls, 1), 50); // buffer
+ setTimeout(() => t.equal(calls, 2), 200); // 100 + buffer
+ setTimeout(() => t.equal(calls, 3), 450); // 100 + 200 + buffer
+ setTimeout(() => t.equal(calls, 4), 900); // 100 + 200 + 400 + buffer
+});
diff --git a/test/rsag-journey.js b/test/rsag-journey.js
index de9ebb47..c8173a65 100644
--- a/test/rsag-journey.js
+++ b/test/rsag-journey.js
@@ -1,17 +1,17 @@
// todo: use import assertions once they're supported by Node.js & ESLint
// https://github.com/tc39/proposal-import-assertions
-import {createRequire} from 'module'
-const require = createRequire(import.meta.url)
+import {createRequire} from 'module';
+const require = createRequire(import.meta.url);
-import tap from 'tap'
+import tap from 'tap';
-import {createClient} from '../index.js'
-import {profile as rawProfile} from '../p/rsag/index.js'
-const res = require('./fixtures/rsag-journey.json')
-import {rsagJourneys as expected} from './fixtures/rsag-journey.js'
+import {createClient} from '../index.js';
+import {profile as rawProfile} from '../p/rsag/index.js';
+const res = require('./fixtures/rsag-journey.json');
+import {rsagJourneys as expected} from './fixtures/rsag-journey.js';
-const client = createClient(rawProfile, 'public-transport/hafas-client:test')
-const {profile} = client
+const client = createClient(rawProfile, 'public-transport/hafas-client:test');
+const {profile} = client;
const opt = {
stopovers: false,
@@ -20,14 +20,14 @@ const opt = {
subStops: true,
entrances: true,
remarks: false,
- products: {}
-}
+ products: {},
+};
tap.test('parses a journey correctly (RSAG)', (t) => {
- const common = profile.parseCommon({profile, opt, res})
- const ctx = {profile, opt, common, res}
- const journey = profile.parseJourney(ctx, res.outConL[0])
+ const common = profile.parseCommon({profile, opt, res});
+ const ctx = {profile, opt, common, res};
+ const journey = profile.parseJourney(ctx, res.outConL[0]);
- t.same(journey, expected)
- t.end()
-})
+ t.same(journey, expected);
+ t.end();
+});
diff --git a/test/sncb-journey-with-chki.js b/test/sncb-journey-with-chki.js
index 54a1851b..8aee3c95 100644
--- a/test/sncb-journey-with-chki.js
+++ b/test/sncb-journey-with-chki.js
@@ -1,16 +1,16 @@
// todo: use import assertions once they're supported by Node.js & ESLint
// https://github.com/tc39/proposal-import-assertions
-import {createRequire} from 'module'
-const require = createRequire(import.meta.url)
+import {createRequire} from 'module';
+const require = createRequire(import.meta.url);
-import tap from 'tap'
+import tap from 'tap';
-import {createClient} from '../index.js'
-import {profile as rawProfile} from '../p/sncb/index.js'
-const resWithChkiLeg = require('./fixtures/sncb-journey-with-chki.json')
+import {createClient} from '../index.js';
+import {profile as rawProfile} from '../p/sncb/index.js';
+const resWithChkiLeg = require('./fixtures/sncb-journey-with-chki.json');
-const client = createClient(rawProfile, 'public-transport/hafas-client:test')
-const {profile} = client
+const client = createClient(rawProfile, 'public-transport/hafas-client:test');
+const {profile} = client;
const opt = {
stopovers: false,
@@ -19,14 +19,14 @@ const opt = {
subStops: false,
entrances: false,
remarks: true,
-}
+};
tap.test('parses a journey with a CHKI leg (#267)', (t) => {
- const common = profile.parseCommon({profile, opt, res: resWithChkiLeg})
- const ctx = {profile, opt, common, res: resWithChkiLeg}
- const journey = profile.parseJourney(ctx, resWithChkiLeg.outConL[0])
+ const common = profile.parseCommon({profile, opt, res: resWithChkiLeg});
+ const ctx = {profile, opt, common, res: resWithChkiLeg};
+ const journey = profile.parseJourney(ctx, resWithChkiLeg.outConL[0]);
- const checkinLeg = journey.legs[0]
- t.equal(checkinLeg.checkin, true, 'checkinLeg.checkin')
- t.end()
-})
+ const checkinLeg = journey.legs[0];
+ t.equal(checkinLeg.checkin, true, 'checkinLeg.checkin');
+ t.end();
+});
diff --git a/test/throttle.js b/test/throttle.js
index 706020a0..7438ff40 100644
--- a/test/throttle.js
+++ b/test/throttle.js
@@ -1,41 +1,41 @@
// todo: use import assertions once they're supported by Node.js & ESLint
// https://github.com/tc39/proposal-import-assertions
-import {createRequire} from 'module'
-const require = createRequire(import.meta.url)
+import {createRequire} from 'module';
+const require = createRequire(import.meta.url);
-import tap from 'tap'
+import tap from 'tap';
-import {createClient} from '../index.js'
-import {withThrottling} from '../throttle.js'
-import {profile as vbbProfile} from '../p/vbb/index.js'
-const depsRes = require('./fixtures/vbb-departures.json')
+import {createClient} from '../index.js';
+import {withThrottling} from '../throttle.js';
+import {profile as vbbProfile} from '../p/vbb/index.js';
+const depsRes = require('./fixtures/vbb-departures.json');
-const ua = 'public-transport/hafas-client:test'
-const spichernstr = '900000042101'
+const ua = 'public-transport/hafas-client:test';
+const spichernstr = '900000042101';
tap.test('withThrottling works', {timeout: 3000}, (t) => {
- let calls = 0
+ let calls = 0;
const mockedRequest = async (ctx, userAgent, reqData) => {
- calls++
+ calls++;
return {
res: depsRes,
- common: ctx.profile.parseCommon({...ctx, res: depsRes})
- }
- }
+ common: ctx.profile.parseCommon({...ctx, res: depsRes}),
+ };
+ };
const profile = withThrottling({
...vbbProfile,
- request: mockedRequest
- }, 2, 1000)
- const client = createClient(profile, ua)
+ request: mockedRequest,
+ }, 2, 1000);
+ const client = createClient(profile, ua);
- t.plan(3)
+ t.plan(3);
for (let i = 0; i < 10; i++) {
- const p = client.departures(spichernstr, {duration: 1})
- p.catch(() => {})
+ const p = client.departures(spichernstr, {duration: 1});
+ p.catch(() => {});
}
- setTimeout(() => t.equal(calls, 2), 500)
- setTimeout(() => t.equal(calls, 4), 1500)
- setTimeout(() => t.equal(calls, 6), 2500)
-})
+ setTimeout(() => t.equal(calls, 2), 500);
+ setTimeout(() => t.equal(calls, 4), 1500);
+ setTimeout(() => t.equal(calls, 6), 2500);
+});
diff --git a/test/vbb-departures.js b/test/vbb-departures.js
index 1d5f8072..08c58d22 100644
--- a/test/vbb-departures.js
+++ b/test/vbb-departures.js
@@ -1,17 +1,17 @@
// todo: use import assertions once they're supported by Node.js & ESLint
// https://github.com/tc39/proposal-import-assertions
-import {createRequire} from 'module'
-const require = createRequire(import.meta.url)
+import {createRequire} from 'module';
+const require = createRequire(import.meta.url);
-import tap from 'tap'
+import tap from 'tap';
-import {createClient} from '../index.js'
-import {profile as rawProfile} from '../p/vbb/index.js'
-const res = require('./fixtures/vbb-departures.json')
-import {vbbDepartures as expected} from './fixtures/vbb-departures.js'
+import {createClient} from '../index.js';
+import {profile as rawProfile} from '../p/vbb/index.js';
+const res = require('./fixtures/vbb-departures.json');
+import {vbbDepartures as expected} from './fixtures/vbb-departures.js';
-const client = createClient(rawProfile, 'public-transport/hafas-client:test')
-const {profile} = client
+const client = createClient(rawProfile, 'public-transport/hafas-client:test');
+const {profile} = client;
const opt = {
direction: null,
@@ -21,14 +21,14 @@ const opt = {
stopovers: true,
includeRelatedStations: true,
when: '2021-10-12T17:42:00+02:00',
- products: {}
-}
+ products: {},
+};
tap.test('parses a departure correctly (VBB)', (t) => {
- const common = profile.parseCommon({profile, opt, res})
- const ctx = {profile, opt, common, res}
- const departures = res.jnyL.map(d => profile.parseDeparture(ctx, d))
+ const common = profile.parseCommon({profile, opt, res});
+ const ctx = {profile, opt, common, res};
+ const departures = res.jnyL.map(d => profile.parseDeparture(ctx, d));
- t.same(departures, expected)
- t.end()
-})
+ t.same(departures, expected);
+ t.end();
+});
diff --git a/test/vbb-journeys.js b/test/vbb-journeys.js
index d2e02d52..82521dd7 100644
--- a/test/vbb-journeys.js
+++ b/test/vbb-journeys.js
@@ -1,17 +1,17 @@
// todo: use import assertions once they're supported by Node.js & ESLint
// https://github.com/tc39/proposal-import-assertions
-import {createRequire} from 'module'
-const require = createRequire(import.meta.url)
+import {createRequire} from 'module';
+const require = createRequire(import.meta.url);
-import tap from 'tap'
+import tap from 'tap';
-import {createClient} from '../index.js'
-import {profile as rawProfile} from '../p/vbb/index.js'
-const res = require('./fixtures/vbb-journeys.json')
-import {vbbJourneys as expected} from './fixtures/vbb-journeys.js'
+import {createClient} from '../index.js';
+import {profile as rawProfile} from '../p/vbb/index.js';
+const res = require('./fixtures/vbb-journeys.json');
+import {vbbJourneys as expected} from './fixtures/vbb-journeys.js';
-const client = createClient(rawProfile, 'public-transport/hafas-client:test')
-const {profile} = client
+const client = createClient(rawProfile, 'public-transport/hafas-client:test');
+const {profile} = client;
const opt = {
results: null,
@@ -31,13 +31,13 @@ const opt = {
scheduledDays: false,
departure: '2020-12-07T13:29+01:00',
products: {},
-}
+};
tap.test('parses a journeys() response correctly (VBB)', (t) => {
- const common = profile.parseCommon({profile, opt, res})
- const ctx = {profile, opt, common, res}
- const journeys = res.outConL.map(j => profile.parseJourney(ctx, j))
+ const common = profile.parseCommon({profile, opt, res});
+ const ctx = {profile, opt, common, res};
+ const journeys = res.outConL.map(j => profile.parseJourney(ctx, j));
- t.same(journeys, expected)
- t.end()
-})
+ t.same(journeys, expected);
+ t.end();
+});
diff --git a/test/vbb-on-demand-trip.js b/test/vbb-on-demand-trip.js
index e8734908..bcf9b683 100644
--- a/test/vbb-on-demand-trip.js
+++ b/test/vbb-on-demand-trip.js
@@ -1,17 +1,17 @@
// todo: use import assertions once they're supported by Node.js & ESLint
// https://github.com/tc39/proposal-import-assertions
-import {createRequire} from 'module'
-const require = createRequire(import.meta.url)
+import {createRequire} from 'module';
+const require = createRequire(import.meta.url);
-import tap from 'tap'
+import tap from 'tap';
-import {createClient} from '../index.js'
-import {profile as rawProfile} from '../p/vbb/index.js'
-const res = require('./fixtures/vbb-on-demand-trip.json')
-import {vbbOnDemandTrip as expected} from './fixtures/vbb-on-demand-trip.js'
+import {createClient} from '../index.js';
+import {profile as rawProfile} from '../p/vbb/index.js';
+const res = require('./fixtures/vbb-on-demand-trip.json');
+import {vbbOnDemandTrip as expected} from './fixtures/vbb-on-demand-trip.js';
-const client = createClient(rawProfile, 'public-transport/hafas-client:test')
-const {profile} = client
+const client = createClient(rawProfile, 'public-transport/hafas-client:test');
+const {profile} = client;
const opt = {
stopovers: true,
@@ -20,13 +20,13 @@ const opt = {
entrances: true,
remarks: true,
when: '2021-10-24T16:07:00+02:00',
-}
+};
tap.test('parses an on-demand trip correctly (VBB)', (t) => {
- const common = profile.parseCommon({profile, opt, res})
- const ctx = {profile, opt, common, res}
- const trip = profile.parseTrip(ctx, res.journey)
+ const common = profile.parseCommon({profile, opt, res});
+ const ctx = {profile, opt, common, res};
+ const trip = profile.parseTrip(ctx, res.journey);
- t.same(trip, expected)
- t.end()
-})
+ t.same(trip, expected);
+ t.end();
+});
diff --git a/test/vsn-departures.js b/test/vsn-departures.js
index bc2ca9cf..0b84b1a6 100644
--- a/test/vsn-departures.js
+++ b/test/vsn-departures.js
@@ -1,17 +1,17 @@
// todo: use import assertions once they're supported by Node.js & ESLint
// https://github.com/tc39/proposal-import-assertions
-import {createRequire} from 'module'
-const require = createRequire(import.meta.url)
+import {createRequire} from 'module';
+const require = createRequire(import.meta.url);
-import tap from 'tap'
+import tap from 'tap';
-import {createClient} from '../index.js'
-import {profile as rawProfile} from '../p/vsn/index.js'
-const res = require('./fixtures/vsn-departures.json')
-import {vsnDepartures as expected} from './fixtures/vsn-departures.js'
+import {createClient} from '../index.js';
+import {profile as rawProfile} from '../p/vsn/index.js';
+const res = require('./fixtures/vsn-departures.json');
+import {vsnDepartures as expected} from './fixtures/vsn-departures.js';
-const client = createClient(rawProfile, 'public-transport/hafas-client:test')
-const {profile} = client
+const client = createClient(rawProfile, 'public-transport/hafas-client:test');
+const {profile} = client;
const opt = {
// results: null,
@@ -29,13 +29,13 @@ const opt = {
// scheduledDays: false,
// departure: '2020-04-10T20:33+02:00',
// products: {}
-}
+};
tap.test('parses departures correctly (VSN)', (t) => {
- const common = profile.parseCommon({profile, opt, res})
- const ctx = {profile, opt, common, res}
+ const common = profile.parseCommon({profile, opt, res});
+ const ctx = {profile, opt, common, res};
- const dep = profile.parseDeparture(ctx, res.jnyL[0])
- t.same(dep, expected)
- t.end()
-})
+ const dep = profile.parseDeparture(ctx, res.jnyL[0]);
+ t.same(dep, expected);
+ t.end();
+});
diff --git a/test/vsn-remarks.js b/test/vsn-remarks.js
index fedcf519..5e76ec4e 100644
--- a/test/vsn-remarks.js
+++ b/test/vsn-remarks.js
@@ -1,30 +1,30 @@
// todo: use import assertions once they're supported by Node.js & ESLint
// https://github.com/tc39/proposal-import-assertions
-import {createRequire} from 'module'
-const require = createRequire(import.meta.url)
+import {createRequire} from 'module';
+const require = createRequire(import.meta.url);
-import tap from 'tap'
+import tap from 'tap';
-import {createClient} from '../index.js'
-import {profile as rawProfile} from '../p/vsn/index.js'
-const res = require('./fixtures/vsn-remarks.json')
-import {vsnRemarks as expected} from './fixtures/vsn-remarks.js'
+import {createClient} from '../index.js';
+import {profile as rawProfile} from '../p/vsn/index.js';
+const res = require('./fixtures/vsn-remarks.json');
+import {vsnRemarks as expected} from './fixtures/vsn-remarks.js';
-const client = createClient(rawProfile, 'public-transport/hafas-client:test')
-const {profile} = client
+const client = createClient(rawProfile, 'public-transport/hafas-client:test');
+const {profile} = client;
const opt = {
results: 100, // maximum number of remarks
// filter by time
from: Date.now(), to: null,
products: null, // filter by affected products
-}
+};
tap.test('parses a remarks() response correctly (VSN)', (t) => {
- const common = profile.parseCommon({profile, opt, res})
- const ctx = {profile, opt, common, res}
- const warnings = res.msgL.map(w => profile.parseWarning(ctx, w))
+ const common = profile.parseCommon({profile, opt, res});
+ const ctx = {profile, opt, common, res};
+ const warnings = res.msgL.map(w => profile.parseWarning(ctx, w));
- t.same(warnings, expected)
- t.end()
-})
+ t.same(warnings, expected);
+ t.end();
+});
diff --git a/throttle.js b/throttle.js
index 2d4c6dc9..320ee565 100644
--- a/throttle.js
+++ b/throttle.js
@@ -1,16 +1,16 @@
-import throttle from 'p-throttle'
-import {defaultProfile} from './lib/default-profile.js'
+import throttle from 'p-throttle';
+import {defaultProfile} from './lib/default-profile.js';
const withThrottling = (profile, limit = 5, interval = 1000) => {
// https://github.com/public-transport/hafas-client/issues/76#issuecomment-574408717
- const {request} = {...defaultProfile, ...profile}
+ const {request} = {...defaultProfile, ...profile};
return {
...profile,
- request: throttle({limit, interval})(request)
- }
-}
+ request: throttle({limit, interval})(request),
+ };
+};
export {
withThrottling,
-}
+};
diff --git a/tools/debug-cli/cli.js b/tools/debug-cli/cli.js
index b6ee4c69..e625858e 100755
--- a/tools/debug-cli/cli.js
+++ b/tools/debug-cli/cli.js
@@ -1,18 +1,20 @@
#!/usr/bin/env node
-import {parseArgs} from 'node:util'
-import {createClient} from '../../index.js'
+import {parseArgs} from 'node:util';
+import {createClient} from '../../index.js';
const showError = (err) => {
- console.error(err)
- process.exit(1)
-}
+ console.error(err);
+ process.exit(1);
+};
-const toString = val => val + ''
+const toString = val => String(val);
const parseJsObject = val => {
- const res = eval(`(${val})`)
- return res && 'object' === typeof res ? res : {}
-}
+ const res = eval(`(${val})`);
+ return res && 'object' === typeof res
+ ? res
+ : {};
+};
const methodsAndTheirArgs = [
['departures', 0, toString],
@@ -46,31 +48,33 @@ const methodsAndTheirArgs = [
['lines', 0, toString],
['lines', 1, parseJsObject],
['serverInfo', 0, parseJsObject],
-]
+];
const {
positionals: args,
} = parseArgs({
strict: true,
allowPositionals: true,
-})
+});
-const profileName = args[0]
-const fnName = args[1]
+const profileName = args[0];
+const fnName = args[1];
-const parsedArgs = args.slice(2).map((arg, i) => {
- const parser = methodsAndTheirArgs.find(([_fnName, _i]) => _fnName === fnName && _i === i)
- return parser ? parser[2](arg) : arg
-})
+const parsedArgs = args.slice(2)
+ .map((arg, i) => {
+ const parser = methodsAndTheirArgs.find(([_fnName, _i]) => _fnName === fnName && _i === i);
+ return parser
+ ? parser[2](arg)
+ : arg;
+ });
+(async () => {
+ const {profile} = await import(`../../p/${profileName}/index.js`);
-;(async () => {
- const {profile} = await import(`../../p/${profileName}/index.js`)
+ const client = createClient(profile, 'hafas-client debug CLI');
- const client = createClient(profile, 'hafas-client debug CLI')
+ const fn = client[fnName];
- const fn = client[fnName]
-
- const res = await fn(...parsedArgs)
- process.stdout.write(JSON.stringify(res) + '\n')
+ const res = await fn(...parsedArgs);
+ process.stdout.write(JSON.stringify(res) + '\n');
})()
-.catch(showError)
+ .catch(showError);
diff --git a/tools/endpoint-hci-version/cli.js b/tools/endpoint-hci-version/cli.js
index 665dac5f..4930376c 100755
--- a/tools/endpoint-hci-version/cli.js
+++ b/tools/endpoint-hci-version/cli.js
@@ -1,7 +1,7 @@
#!/usr/bin/env node
-import {parseArgs} from 'node:util'
-import {createClient} from '../../index.js'
+import {parseArgs} from 'node:util';
+import {createClient} from '../../index.js';
const {
values: flags,
@@ -19,7 +19,7 @@ const {
},
strict: true,
allowPositionals: true,
-})
+});
if (flags.help) {
process.stdout.write(`
@@ -30,30 +30,32 @@ Options:
represenation.
Examples:
endpoint-hci-version oebb
-\n`)
- process.exit(0)
+\n`);
+ process.exit(0);
}
-const profileName = args[0]
-const silent = flags.silent
-
-;(async () => {
- const {profile} = await import(`../../p/${profileName}/index.js`)
+const profileName = args[0];
+const silent = flags.silent;
+(async () => {
+ const {profile} = await import(`../../p/${profileName}/index.js`);
const client = createClient(
profile,
'hafas-client-endpoint-hci-version',
- )
+ );
- const {hciVersion: v} = await client.serverInfo()
+ const {hciVersion: v} = await client.serverInfo();
if ('string' !== typeof v || !v) {
- throw new Error('invalid/unexpected server response')
+ throw new Error('invalid/unexpected server response');
+ }
+ if (silent) {
+ console.log(v);
+ } else {
+ console.log(v + ' reported as the endpoint version ✔︎');
}
- if (silent) console.log(v)
- else console.log(v + ' reported as the endpoint version ✔︎')
})()
-.catch((err) => {
- console.error(err)
- process.exit(1)
-})
+ .catch((err) => {
+ console.error(err);
+ process.exit(1);
+ });