mirror of
https://github.com/public-transport/db-vendo-client.git
synced 2025-05-05 22:19:59 +03:00
tape + tap-spec -> tap
This commit is contained in:
parent
40ec157869
commit
f1a19450fe
69 changed files with 507 additions and 574 deletions
package.json
test
bvg-journey.jsbvg-radar.jsdb-arrivals.jsdb-journey-2.jsdb-journey-polyline.jsdb-journey.jsdb-netz-remarks.jsdb-stop.js
e2e
bvg.jscfl.jscmta.jscommon.jsdb-busradar-nrw.jsdb.jshvv.jsindex.jsinsa.jsinvg.js
lib
arrivals.jsdepartures.jsjourneys-station-to-address.jsjourneys-station-to-poi.jsreachable-from.jsrefresh-journey.jsutil.js
mobil-nrw.jsmobiliteit-lu.jsnahsh.jsnvv.jsoebb.jspkp.jsrejseplanen.jsrmv.jsrsag.jssaarfahrplan.jssbahn-muenchen.jssbb.jssncb.jssvv.jsvbb.jsvbn.jsvrn.jsvsn.jszvv.jsformat
index.jsinsa-stop.jsmobiliteit-lu-line.jsoebb-trip.jsparse
rejseplanen-trip.jsretry.jsrsag-journey.jssbb-journeys.jsthrottle.jsvbb-departures.jsvbb-journeys.jsvsn-departures.jsvsn-remarks.js
14
package.json
14
package.json
|
@ -67,17 +67,19 @@
|
|||
"is-coordinates": "^2.0.2",
|
||||
"is-roughly-equal": "^0.1.0",
|
||||
"replayer": "^2.2.3",
|
||||
"tap-spec": "^5.0.0",
|
||||
"tape": "^5.0.0",
|
||||
"tap": "^15.0.9",
|
||||
"validate-fptf": "^3.0.0"
|
||||
},
|
||||
"scripts": {
|
||||
"lint": "eslint .",
|
||||
"test-unit": "node test/index.js | tap-spec",
|
||||
"test-integration": "VCR_MODE=playback node test/e2e/index.js | tap-spec",
|
||||
"test-integration:record": "VCR_MODE=record node test/e2e/index.js | tap-spec",
|
||||
"test-e2e": "VCR_OFF=true node test/e2e/index.js | tap-spec",
|
||||
"test-unit": "tap test/*.js test/format/*.js test/parse/*.js",
|
||||
"test-integration": "VCR_MODE=playback tap test/e2e/*.js",
|
||||
"test-integration:record": "VCR_MODE=record tap test/e2e/*.js",
|
||||
"test-e2e": "VCR_OFF=true tap test/e2e/*.js",
|
||||
"test": "npm run test-unit && npm run test-integration",
|
||||
"prepublishOnly": "npm run lint && npm test"
|
||||
},
|
||||
"tap": {
|
||||
"coverage": false
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
'use strict'
|
||||
|
||||
const test = require('tape')
|
||||
const tap = require('tap')
|
||||
|
||||
const createClient = require('..')
|
||||
const rawProfile = require('../p/bvg')
|
||||
|
@ -28,11 +28,11 @@ const opt = {
|
|||
products: {}
|
||||
}
|
||||
|
||||
test('parses a journey correctly (BVG)', (t) => {
|
||||
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])
|
||||
|
||||
t.deepEqual(journey, expected)
|
||||
t.same(journey, expected)
|
||||
t.end()
|
||||
})
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
'use strict'
|
||||
|
||||
const test = require('tape')
|
||||
const tap = require('tap')
|
||||
|
||||
const createClient = require('..')
|
||||
const rawProfile = require('../p/bvg')
|
||||
|
@ -20,11 +20,11 @@ const opt = {
|
|||
products: {}
|
||||
}
|
||||
|
||||
test('parses a radar() response correctly (BVG)', (t) => {
|
||||
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))
|
||||
|
||||
t.deepEqual(movements, expected)
|
||||
t.same(movements, expected)
|
||||
t.end()
|
||||
})
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
'use strict'
|
||||
|
||||
const test = require('tape')
|
||||
const tap = require('tap')
|
||||
|
||||
const createClient = require('..')
|
||||
const rawProfile = require('../p/db')
|
||||
|
@ -21,11 +21,11 @@ const opt = {
|
|||
products: {}
|
||||
}
|
||||
|
||||
test('parses an arrival correctly (DB)', (t) => {
|
||||
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))
|
||||
|
||||
t.deepEqual(arrivals, expected)
|
||||
t.same(arrivals, expected)
|
||||
t.end()
|
||||
})
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
'use strict'
|
||||
|
||||
const test = require('tape')
|
||||
const tap = require('tap')
|
||||
|
||||
const createClient = require('..')
|
||||
const rawProfile = require('../p/db')
|
||||
|
@ -28,11 +28,11 @@ const opt = {
|
|||
products: {}
|
||||
}
|
||||
|
||||
test('parses a journey remarks without failing', (t) => {
|
||||
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])
|
||||
|
||||
t.deepEqual(journey, expected)
|
||||
t.same(journey, expected)
|
||||
t.end()
|
||||
})
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
'use strict'
|
||||
|
||||
const test = require('tape')
|
||||
const tap = require('tap')
|
||||
|
||||
const createClient = require('..')
|
||||
const rawProfile = require('../p/db')
|
||||
|
@ -28,11 +28,11 @@ const opt = {
|
|||
products: {},
|
||||
}
|
||||
|
||||
test('parses a journey with an embedded polyline correctly', (t) => {
|
||||
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])
|
||||
|
||||
t.deepEqual(journey, expected)
|
||||
t.same(journey, expected)
|
||||
t.end()
|
||||
})
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
'use strict'
|
||||
|
||||
const test = require('tape')
|
||||
const tap = require('tap')
|
||||
|
||||
const createClient = require('..')
|
||||
const rawProfile = require('../p/db')
|
||||
|
@ -28,11 +28,11 @@ const opt = {
|
|||
products: {}
|
||||
}
|
||||
|
||||
test('parses a journey with a DEVI leg correctly (DB)', (t) => {
|
||||
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])
|
||||
|
||||
t.deepEqual(journey, expected)
|
||||
t.same(journey, expected)
|
||||
t.end()
|
||||
})
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
'use strict'
|
||||
|
||||
const test = require('tape')
|
||||
const tap = require('tap')
|
||||
|
||||
const parseCommon = require('../parse/common')
|
||||
const defaultProfile = require('../lib/default-profile')
|
||||
|
@ -21,12 +21,12 @@ const opt = {
|
|||
remarks: true
|
||||
}
|
||||
|
||||
test('parseCommon parses a DB Netz response properly', (t) => {
|
||||
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')
|
||||
|
||||
t.deepEqual(warning, {
|
||||
t.same(warning, {
|
||||
id: 'HIM_FREETEXT_447862',
|
||||
type: 'warning',
|
||||
summary: 'Abweichung Fpl f Zmst BKRW - NEB nur nach Gl101',
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
'use strict'
|
||||
|
||||
const test = require('tape')
|
||||
const tap = require('tap')
|
||||
|
||||
const createClient = require('..')
|
||||
const rawProfile = require('../p/db')
|
||||
|
@ -17,11 +17,11 @@ const opt = {
|
|||
remarks: true,
|
||||
}
|
||||
|
||||
test('parses a stop() response correctly (DB)', (t) => {
|
||||
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])
|
||||
|
||||
t.deepEqual(stop, expected)
|
||||
t.same(stop, expected)
|
||||
t.end()
|
||||
})
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
'use strict'
|
||||
|
||||
// todo: DRY with vbb tests
|
||||
const tap = require('tap')
|
||||
|
||||
const isRoughlyEqual = require('is-roughly-equal')
|
||||
const {DateTime} = require('luxon')
|
||||
|
@ -18,7 +19,6 @@ const {
|
|||
validateDeparture,
|
||||
validateMovement
|
||||
} = require('./lib/vbb-bvg-validators')
|
||||
const {test} = require('./lib/util')
|
||||
const testJourneysStationToStation = require('./lib/journeys-station-to-station')
|
||||
const testJourneysStationToAddress = require('./lib/journeys-station-to-address')
|
||||
const testJourneysStationToPoi = require('./lib/journeys-station-to-poi')
|
||||
|
@ -56,7 +56,7 @@ const jannowitzbrücke = '900000100004'
|
|||
|
||||
const hour = 60 * 60 * 1000
|
||||
|
||||
test('journeys – Spichernstr. to Bismarckstr.', async (t) => {
|
||||
tap.test('journeys – Spichernstr. to Bismarckstr.', async (t) => {
|
||||
const res = await client.journeys(spichernstr, bismarckstr, {
|
||||
results: 4,
|
||||
departure: when,
|
||||
|
@ -75,7 +75,7 @@ test('journeys – Spichernstr. to Bismarckstr.', async (t) => {
|
|||
t.end()
|
||||
})
|
||||
|
||||
test('journeys – only subway', async (t) => {
|
||||
tap.test('journeys – only subway', async (t) => {
|
||||
const res = await client.journeys(spichernstr, bismarckstr, {
|
||||
results: 20,
|
||||
departure: when,
|
||||
|
@ -110,7 +110,7 @@ test('journeys – only subway', async (t) => {
|
|||
t.end()
|
||||
})
|
||||
|
||||
test('journeys – fails with no product', (t) => {
|
||||
tap.test('journeys – fails with no product', (t) => {
|
||||
journeysFailsWithNoProduct({
|
||||
test: t,
|
||||
fetchJourneys: client.journeys,
|
||||
|
@ -123,7 +123,7 @@ test('journeys – fails with no product', (t) => {
|
|||
})
|
||||
|
||||
// BerlKönig for public use is suspended during COVID-19.
|
||||
test.skip('journeys – BerlKönig', async (t) => {
|
||||
tap.skip('journeys – BerlKönig', async (t) => {
|
||||
const when = DateTime.fromMillis(Date.now(), {
|
||||
zone: 'Europe/Berlin',
|
||||
locale: 'de-De',
|
||||
|
@ -158,7 +158,7 @@ test.skip('journeys – BerlKönig', async (t) => {
|
|||
})
|
||||
|
||||
// todo: opt.walkingSpeed doesn't seem to work right now
|
||||
test.skip('journeys: walkingSpeed', async (t) => {
|
||||
tap.skip('journeys: walkingSpeed', async (t) => {
|
||||
const havelchaussee = {
|
||||
type: 'location',
|
||||
address: 'Havelchaussee',
|
||||
|
@ -178,7 +178,7 @@ test.skip('journeys: walkingSpeed', async (t) => {
|
|||
})
|
||||
})
|
||||
|
||||
test('earlier/later journeys', async (t) => {
|
||||
tap.test('earlier/later journeys', async (t) => {
|
||||
await testEarlierLaterJourneys({
|
||||
test: t,
|
||||
fetchJourneys: client.journeys,
|
||||
|
@ -191,7 +191,7 @@ test('earlier/later journeys', async (t) => {
|
|||
t.end()
|
||||
})
|
||||
|
||||
test.skip('journeys – leg cycle & alternatives', async (t) => {
|
||||
tap.skip('journeys – leg cycle & alternatives', async (t) => {
|
||||
await testLegCycleAlternatives({
|
||||
test: t,
|
||||
fetchJourneys: client.journeys,
|
||||
|
@ -200,7 +200,7 @@ test.skip('journeys – leg cycle & alternatives', async (t) => {
|
|||
})
|
||||
t.end()
|
||||
})
|
||||
test('refreshJourney', async (t) => {
|
||||
tap.test('refreshJourney', async (t) => {
|
||||
await testRefreshJourney({
|
||||
test: t,
|
||||
fetchJourneys: client.journeys,
|
||||
|
@ -213,7 +213,7 @@ test('refreshJourney', async (t) => {
|
|||
t.end()
|
||||
})
|
||||
|
||||
test('trip details', async (t) => {
|
||||
tap.test('trip details', async (t) => {
|
||||
const res = await client.journeys(spichernstr, amrumerStr, {
|
||||
results: 1, departure: when
|
||||
})
|
||||
|
@ -227,7 +227,7 @@ test('trip details', async (t) => {
|
|||
t.end()
|
||||
})
|
||||
|
||||
test('journeys – station to address', async (t) => {
|
||||
tap.test('journeys – station to address', async (t) => {
|
||||
const torfstr = {
|
||||
type: 'location',
|
||||
address: '13353 Berlin-Wedding, Torfstr. 17',
|
||||
|
@ -249,7 +249,7 @@ test('journeys – station to address', async (t) => {
|
|||
t.end()
|
||||
})
|
||||
|
||||
test('journeys – station to POI', async (t) => {
|
||||
tap.test('journeys – station to POI', async (t) => {
|
||||
const atze = {
|
||||
type: 'location',
|
||||
id: '900980720',
|
||||
|
@ -273,7 +273,7 @@ test('journeys – station to POI', async (t) => {
|
|||
t.end()
|
||||
})
|
||||
|
||||
test('journeys: via works – with detour', async (t) => {
|
||||
tap.test('journeys: via works – with detour', async (t) => {
|
||||
// Going from Westhafen to Wedding via Württembergalle without detour
|
||||
// is currently impossible. We check if the routing engine computes a detour.
|
||||
const res = await client.journeys(westhafen, wedding, {
|
||||
|
@ -294,7 +294,7 @@ test('journeys: via works – with detour', async (t) => {
|
|||
|
||||
// todo: without detour test
|
||||
|
||||
test('departures', async (t) => {
|
||||
tap.test('departures', async (t) => {
|
||||
const departures = await client.departures(spichernstr, {
|
||||
duration: 5, when
|
||||
})
|
||||
|
@ -308,7 +308,7 @@ test('departures', async (t) => {
|
|||
t.end()
|
||||
})
|
||||
|
||||
test('departures with station object', async (t) => {
|
||||
tap.test('departures with station object', async (t) => {
|
||||
const deps = await client.departures({
|
||||
type: 'station',
|
||||
id: spichernstr,
|
||||
|
@ -324,7 +324,7 @@ test('departures with station object', async (t) => {
|
|||
t.end()
|
||||
})
|
||||
|
||||
test('departures at Spichernstr. in direction of Westhafen', async (t) => {
|
||||
tap.test('departures at Spichernstr. in direction of Westhafen', async (t) => {
|
||||
await testDeparturesInDirection({
|
||||
test: t,
|
||||
fetchDepartures: client.departures,
|
||||
|
@ -337,14 +337,14 @@ test('departures at Spichernstr. in direction of Westhafen', async (t) => {
|
|||
t.end()
|
||||
})
|
||||
|
||||
test('departures at 7-digit station', async (t) => {
|
||||
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()
|
||||
})
|
||||
|
||||
test('arrivals', async (t) => {
|
||||
tap.test('arrivals', async (t) => {
|
||||
const arrivals = await client.arrivals(spichernstr, {
|
||||
duration: 5, when
|
||||
})
|
||||
|
@ -358,7 +358,7 @@ test('arrivals', async (t) => {
|
|||
t.end()
|
||||
})
|
||||
|
||||
test('nearby', async (t) => {
|
||||
tap.test('nearby', async (t) => {
|
||||
const berlinerStr = '900000044201'
|
||||
const landhausstr = '900000043252'
|
||||
|
||||
|
@ -384,7 +384,7 @@ test('nearby', async (t) => {
|
|||
t.end()
|
||||
})
|
||||
|
||||
test('locations', async (t) => {
|
||||
tap.test('locations', async (t) => {
|
||||
const locations = await client.locations('Alexanderplatz', {results: 20})
|
||||
|
||||
validate(t, locations, 'locations', 'locations')
|
||||
|
@ -397,7 +397,7 @@ test('locations', async (t) => {
|
|||
t.end()
|
||||
})
|
||||
|
||||
test('stop', async (t) => {
|
||||
tap.test('stop', async (t) => {
|
||||
const s = await client.stop(spichernstr)
|
||||
|
||||
validate(t, s, ['stop', 'station'], 'stop')
|
||||
|
@ -406,7 +406,7 @@ test('stop', async (t) => {
|
|||
t.end()
|
||||
})
|
||||
|
||||
test('radar', async (t) => {
|
||||
tap.test('radar', async (t) => {
|
||||
const vehicles = await client.radar({
|
||||
north: 52.52411,
|
||||
west: 13.41002,
|
||||
|
@ -420,7 +420,7 @@ test('radar', async (t) => {
|
|||
t.end()
|
||||
})
|
||||
|
||||
test('reachableFrom', async (t) => {
|
||||
tap.test('reachableFrom', async (t) => {
|
||||
const torfstr17 = {
|
||||
type: 'location',
|
||||
address: '13353 Berlin-Wedding, Torfstr. 17',
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
'use strict'
|
||||
|
||||
const tap = require('tap')
|
||||
const assert = require('assert')
|
||||
const isRoughlyEqual = require('is-roughly-equal')
|
||||
|
||||
|
@ -13,7 +14,6 @@ const {
|
|||
movement: _validateMovement
|
||||
} = require('./lib/validators')
|
||||
const createValidate = require('./lib/validate-fptf-with')
|
||||
const {test} = require('./lib/util')
|
||||
const testJourneysStationToStation = require('./lib/journeys-station-to-station')
|
||||
const testJourneysStationToAddress = require('./lib/journeys-station-to-address')
|
||||
const testJourneysStationToPoi = require('./lib/journeys-station-to-poi')
|
||||
|
@ -72,7 +72,7 @@ const ettelbruck = '9258199'
|
|||
const mersch = '9864348'
|
||||
const luxembourg = '9217081'
|
||||
|
||||
test('journeys – Ettelbruck to Luxembourg', async (t) => {
|
||||
tap.test('journeys – Ettelbruck to Luxembourg', async (t) => {
|
||||
const res = await client.journeys(ettelbruck, luxembourg, {
|
||||
results: 4,
|
||||
departure: when,
|
||||
|
@ -91,7 +91,7 @@ test('journeys – Ettelbruck to Luxembourg', async (t) => {
|
|||
|
||||
// todo: journeys, only one product
|
||||
|
||||
test('journeys – fails with no product', (t) => {
|
||||
tap.test('journeys – fails with no product', (t) => {
|
||||
journeysFailsWithNoProduct({
|
||||
test: t,
|
||||
fetchJourneys: client.journeys,
|
||||
|
@ -103,7 +103,7 @@ test('journeys – fails with no product', (t) => {
|
|||
t.end()
|
||||
})
|
||||
|
||||
test('Luxembourg to 9071 Ettelbruck, Rue des Romains 4', async (t) => {
|
||||
tap.test('Luxembourg to 9071 Ettelbruck, Rue des Romains 4', async (t) => {
|
||||
const rueDeRomain = {
|
||||
type: 'location',
|
||||
address: '9071 Ettelbruck, Rue des Romains 4',
|
||||
|
@ -126,7 +126,7 @@ test('Luxembourg to 9071 Ettelbruck, Rue des Romains 4', async (t) => {
|
|||
t.end()
|
||||
})
|
||||
|
||||
test('Luxembourg to Centre Hospitalier du Nord', async (t) => {
|
||||
tap.test('Luxembourg to Centre Hospitalier du Nord', async (t) => {
|
||||
const centreHospitalier = {
|
||||
type: 'location',
|
||||
id: '140701020',
|
||||
|
@ -153,7 +153,7 @@ test('Luxembourg to Centre Hospitalier du Nord', async (t) => {
|
|||
// todo: journeys: via works – with detour
|
||||
// todo: without detour
|
||||
|
||||
test('earlier/later journeys', async (t) => {
|
||||
tap.test('earlier/later journeys', async (t) => {
|
||||
await testEarlierLaterJourneys({
|
||||
test: t,
|
||||
fetchJourneys: client.journeys,
|
||||
|
@ -166,7 +166,7 @@ test('earlier/later journeys', async (t) => {
|
|||
t.end()
|
||||
})
|
||||
|
||||
test('trip', async (t) => {
|
||||
tap.test('trip', async (t) => {
|
||||
const { journeys } = await client.journeys(luxembourg, ettelbruck, {
|
||||
results: 1, departure: when
|
||||
})
|
||||
|
@ -180,7 +180,7 @@ test('trip', async (t) => {
|
|||
t.end()
|
||||
})
|
||||
|
||||
test('departures at Ettelbruck.', async (t) => {
|
||||
tap.test('departures at Ettelbruck.', async (t) => {
|
||||
const departures = await client.departures(ettelbruck, {
|
||||
duration: 20, when
|
||||
})
|
||||
|
@ -194,7 +194,7 @@ test('departures at Ettelbruck.', async (t) => {
|
|||
t.end()
|
||||
})
|
||||
|
||||
test('arrivals at Ettelbruck.', async (t) => {
|
||||
tap.test('arrivals at Ettelbruck.', async (t) => {
|
||||
const arrivals = await client.arrivals(ettelbruck, {
|
||||
duration: 20, when
|
||||
})
|
||||
|
@ -208,7 +208,7 @@ test('arrivals at Ettelbruck.', async (t) => {
|
|||
t.end()
|
||||
})
|
||||
|
||||
test('departures with station object', async (t) => {
|
||||
tap.test('departures with station object', async (t) => {
|
||||
const deps = await client.departures({
|
||||
type: 'station',
|
||||
id: ettelbruck,
|
||||
|
@ -226,7 +226,7 @@ test('departures with station object', async (t) => {
|
|||
|
||||
// todo: nearby
|
||||
|
||||
test('locations named Mersch', async (t) => {
|
||||
tap.test('locations named Mersch', async (t) => {
|
||||
const locations = await client.locations('Mersch', {
|
||||
results: 20
|
||||
})
|
||||
|
@ -244,7 +244,7 @@ test('locations named Mersch', async (t) => {
|
|||
t.end()
|
||||
})
|
||||
|
||||
test('stop Mersch', async (t) => {
|
||||
tap.test('stop Mersch', async (t) => {
|
||||
const s = await client.stop(mersch)
|
||||
|
||||
validate(t, s, ['stop', 'station'], 'stop')
|
||||
|
@ -253,7 +253,7 @@ test('stop Mersch', async (t) => {
|
|||
t.end()
|
||||
})
|
||||
|
||||
test('radar', async (t) => {
|
||||
tap.test('radar', async (t) => {
|
||||
const vehicles = await client.radar({
|
||||
north: 49.9,
|
||||
west: 6.05,
|
||||
|
|
|
@ -1,11 +1,12 @@
|
|||
'use strict'
|
||||
|
||||
const tap = require('tap')
|
||||
|
||||
const {createWhen} = require('./lib/util')
|
||||
const createClient = require('../..')
|
||||
const cmtaProfile = require('../../p/cmta')
|
||||
const products = require('../../p/cmta/products')
|
||||
const createValidate = require('./lib/validate-fptf-with')
|
||||
const {test} = require('./lib/util')
|
||||
const testJourneysStationToStation = require('./lib/journeys-station-to-station')
|
||||
const testJourneysStationToAddress = require('./lib/journeys-station-to-address')
|
||||
const testJourneysStationToPoi = require('./lib/journeys-station-to-poi')
|
||||
|
@ -37,7 +38,7 @@ const broadieOaks = '2370'
|
|||
const domain = '5919'
|
||||
const capitol591 = '591'
|
||||
|
||||
test('journeys – Broadie Oaks to Domain', async (t) => {
|
||||
tap.test('journeys – Broadie Oaks to Domain', async (t) => {
|
||||
const res = await client.journeys(broadieOaks, domain, {
|
||||
results: 4,
|
||||
departure: when,
|
||||
|
@ -56,7 +57,7 @@ test('journeys – Broadie Oaks to Domain', async (t) => {
|
|||
|
||||
// todo: journeys, only one product
|
||||
|
||||
test('journeys – fails with no product', (t) => {
|
||||
tap.test('journeys – fails with no product', (t) => {
|
||||
journeysFailsWithNoProduct({
|
||||
test: t,
|
||||
fetchJourneys: client.journeys,
|
||||
|
@ -68,7 +69,7 @@ test('journeys – fails with no product', (t) => {
|
|||
t.end()
|
||||
})
|
||||
|
||||
test('Domain to 1104 Elm Street, Austin, TX 78703', async (t) => {
|
||||
tap.test('Domain to 1104 Elm Street, Austin, TX 78703', async (t) => {
|
||||
const someAddress = {
|
||||
type: 'location',
|
||||
address: '1104 ELM ST, Austin, TX 78703',
|
||||
|
@ -91,7 +92,7 @@ test('Domain to 1104 Elm Street, Austin, TX 78703', async (t) => {
|
|||
t.end()
|
||||
})
|
||||
|
||||
test('Domain to Whole Foods Market - North Lamar Blvd', async (t) => {
|
||||
tap.test('Domain to Whole Foods Market - North Lamar Blvd', async (t) => {
|
||||
const wholeFoodsMarket = {
|
||||
type: 'location',
|
||||
id: '9830513', // or `9855231`
|
||||
|
@ -119,7 +120,7 @@ test('Domain to Whole Foods Market - North Lamar Blvd', async (t) => {
|
|||
// todo: via works – with detour
|
||||
// todo: without detour
|
||||
|
||||
test('earlier/later journeys', async (t) => {
|
||||
tap.test('earlier/later journeys', async (t) => {
|
||||
await testEarlierLaterJourneys({
|
||||
test: t,
|
||||
fetchJourneys: client.journeys,
|
||||
|
@ -132,7 +133,7 @@ test('earlier/later journeys', async (t) => {
|
|||
t.end()
|
||||
})
|
||||
|
||||
test('refreshJourney', async (t) => {
|
||||
tap.test('refreshJourney', async (t) => {
|
||||
await testRefreshJourney({
|
||||
test: t,
|
||||
fetchJourneys: client.journeys,
|
||||
|
@ -145,7 +146,7 @@ test('refreshJourney', async (t) => {
|
|||
t.end()
|
||||
})
|
||||
|
||||
test('trip details', async (t) => {
|
||||
tap.test('trip details', async (t) => {
|
||||
const res = await client.journeys(broadieOaks, domain, {
|
||||
results: 1, departure: when
|
||||
})
|
||||
|
@ -159,7 +160,7 @@ test('trip details', async (t) => {
|
|||
t.end()
|
||||
})
|
||||
|
||||
test('departures at Broadie Oaks', async (t) => {
|
||||
tap.test('departures at Broadie Oaks', async (t) => {
|
||||
const departures = await client.departures(broadieOaks, {
|
||||
duration: 10, when,
|
||||
})
|
||||
|
@ -173,7 +174,7 @@ test('departures at Broadie Oaks', async (t) => {
|
|||
t.end()
|
||||
})
|
||||
|
||||
test('departures with station object', async (t) => {
|
||||
tap.test('departures with station object', async (t) => {
|
||||
const deps = await client.departures({
|
||||
type: 'station',
|
||||
id: broadieOaks,
|
||||
|
@ -189,7 +190,7 @@ test('departures with station object', async (t) => {
|
|||
t.end()
|
||||
})
|
||||
|
||||
test('arrivals at Broadie Oaks', async (t) => {
|
||||
tap.test('arrivals at Broadie Oaks', async (t) => {
|
||||
const arrivals = await client.arrivals(broadieOaks, {
|
||||
duration: 10, when
|
||||
})
|
||||
|
@ -205,7 +206,7 @@ test('arrivals at Broadie Oaks', async (t) => {
|
|||
|
||||
// todo: nearby
|
||||
|
||||
test('locations named "Capitol"', async (t) => {
|
||||
tap.test('locations named "Capitol"', async (t) => {
|
||||
const locations = await client.locations('Capitol', {
|
||||
results: 10
|
||||
})
|
||||
|
@ -222,7 +223,7 @@ test('locations named "Capitol"', async (t) => {
|
|||
t.end()
|
||||
})
|
||||
|
||||
test('station Domain', async (t) => {
|
||||
tap.test('station Domain', async (t) => {
|
||||
const s = await client.stop(domain)
|
||||
|
||||
validate(t, s, ['stop', 'station'], 'station')
|
||||
|
@ -231,7 +232,7 @@ test('station Domain', async (t) => {
|
|||
t.end()
|
||||
})
|
||||
|
||||
test('radar', async (t) => {
|
||||
tap.test('radar', async (t) => {
|
||||
const vehicles = await client.radar({
|
||||
north: 30.240877,
|
||||
west: -97.804588,
|
||||
|
@ -245,7 +246,7 @@ test('radar', async (t) => {
|
|||
t.end()
|
||||
})
|
||||
|
||||
test('reachableFrom', async (t) => {
|
||||
tap.test('reachableFrom', async (t) => {
|
||||
await testReachableFrom({
|
||||
test: t,
|
||||
reachableFrom: client.reachableFrom,
|
||||
|
|
|
@ -1,13 +1,13 @@
|
|||
'use strict'
|
||||
|
||||
const test = require('tape')
|
||||
const tap = require('tap')
|
||||
|
||||
const createClient = require('../..')
|
||||
const vbbProfile = require('../../p/vbb')
|
||||
|
||||
const client = createClient(vbbProfile, 'public-transport/hafas-client:test')
|
||||
|
||||
test('exposes the profile', (t) => {
|
||||
tap.test('exposes the profile', (t) => {
|
||||
t.ok(client.profile)
|
||||
t.equal(client.profile.endpoint, vbbProfile.endpoint)
|
||||
t.end()
|
||||
|
|
|
@ -1,12 +1,12 @@
|
|||
'use strict'
|
||||
|
||||
const tap = require('tap')
|
||||
const isRoughlyEqual = require('is-roughly-equal')
|
||||
|
||||
const {createWhen} = require('./lib/util')
|
||||
const createClient = require('../..')
|
||||
const dbBusradarNrwProfile = require('../../p/db-busradar-nrw')
|
||||
const createValidate = require('./lib/validate-fptf-with')
|
||||
const {test} = require('./lib/util')
|
||||
const testDepartures = require('./lib/departures')
|
||||
const testArrivals = require('./lib/arrivals')
|
||||
|
||||
|
@ -32,7 +32,7 @@ const hagenBauhaus = '3307002'
|
|||
const bielefeldHbf = '8000036'
|
||||
const hagenVorhalle = '8000977'
|
||||
|
||||
test('departures at Hagen Bauhaus', async (t) => {
|
||||
tap.test('departures at Hagen Bauhaus', async (t) => {
|
||||
const departures = await client.departures(hagenBauhaus, {
|
||||
duration: 120, when,
|
||||
})
|
||||
|
@ -46,7 +46,7 @@ test('departures at Hagen Bauhaus', async (t) => {
|
|||
t.end()
|
||||
})
|
||||
|
||||
test('trip details', async (t) => {
|
||||
tap.test('trip details', async (t) => {
|
||||
const deps = await client.departures(hagenBauhaus, {
|
||||
results: 1, duration: 120, when
|
||||
})
|
||||
|
@ -60,7 +60,7 @@ test('trip details', async (t) => {
|
|||
t.end()
|
||||
})
|
||||
|
||||
test('departures with station object', async (t) => {
|
||||
tap.test('departures with station object', async (t) => {
|
||||
const deps = await client.departures({
|
||||
type: 'station',
|
||||
id: hagenBauhaus,
|
||||
|
@ -78,7 +78,7 @@ test('departures with station object', async (t) => {
|
|||
|
||||
// todo: departures at hagenBauhaus in direction of …
|
||||
|
||||
test('arrivals at Hagen Bauhaus', async (t) => {
|
||||
tap.test('arrivals at Hagen Bauhaus', async (t) => {
|
||||
const arrivals = await client.arrivals(hagenBauhaus, {
|
||||
duration: 120, when
|
||||
})
|
||||
|
@ -94,7 +94,7 @@ test('arrivals at Hagen Bauhaus', async (t) => {
|
|||
|
||||
// todo: nearby
|
||||
|
||||
test('locations named Vorhalle', async (t) => {
|
||||
tap.test('locations named Vorhalle', async (t) => {
|
||||
const locations = await client.locations('vorhalle', {
|
||||
results: 10
|
||||
})
|
||||
|
@ -111,7 +111,7 @@ test('locations named Vorhalle', async (t) => {
|
|||
t.end()
|
||||
})
|
||||
|
||||
test('station Hagen-Vorhalle', async (t) => {
|
||||
tap.test('station Hagen-Vorhalle', async (t) => {
|
||||
const s = await client.stop(hagenVorhalle)
|
||||
|
||||
validate(t, s, ['stop', 'station'], 'station')
|
||||
|
@ -120,7 +120,7 @@ test('station Hagen-Vorhalle', async (t) => {
|
|||
t.end()
|
||||
})
|
||||
|
||||
test('radar', async (t) => {
|
||||
tap.test('radar', async (t) => {
|
||||
const vehicles = await client.radar({
|
||||
north: 51.5,
|
||||
west: 7.2,
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
'use strict'
|
||||
|
||||
const tap = require('tap')
|
||||
const isRoughlyEqual = require('is-roughly-equal')
|
||||
|
||||
const {createWhen} = require('./lib/util')
|
||||
|
@ -11,7 +12,6 @@ const {
|
|||
trip: createValidateTrip
|
||||
} = require('./lib/validators')
|
||||
const createValidate = require('./lib/validate-fptf-with')
|
||||
const {test} = require('./lib/util')
|
||||
const testJourneysStationToStation = require('./lib/journeys-station-to-station')
|
||||
const testJourneysStationToAddress = require('./lib/journeys-station-to-address')
|
||||
const testJourneysStationToPoi = require('./lib/journeys-station-to-poi')
|
||||
|
@ -73,7 +73,7 @@ const blnTiergarten = '8089091'
|
|||
const blnJannowitzbrücke = '8089019'
|
||||
const potsdamHbf = '8012666'
|
||||
|
||||
test('journeys – Berlin Schwedter Str. to München Hbf', async (t) => {
|
||||
tap.test('journeys – Berlin Schwedter Str. to München Hbf', async (t) => {
|
||||
const res = await client.journeys(blnSchwedterStr, münchenHbf, {
|
||||
results: 4,
|
||||
departure: when,
|
||||
|
@ -97,7 +97,7 @@ test('journeys – Berlin Schwedter Str. to München Hbf', async (t) => {
|
|||
|
||||
// todo: journeys, only one product
|
||||
|
||||
test('journeys – fails with no product', (t) => {
|
||||
tap.test('journeys – fails with no product', (t) => {
|
||||
journeysFailsWithNoProduct({
|
||||
test: t,
|
||||
fetchJourneys: client.journeys,
|
||||
|
@ -109,7 +109,7 @@ test('journeys – fails with no product', (t) => {
|
|||
t.end()
|
||||
})
|
||||
|
||||
test('Berlin Schwedter Str. to Torfstraße 17', async (t) => {
|
||||
tap.test('Berlin Schwedter Str. to Torfstraße 17', async (t) => {
|
||||
const torfstr = {
|
||||
type: 'location',
|
||||
address: 'Torfstraße 17',
|
||||
|
@ -131,7 +131,7 @@ test('Berlin Schwedter Str. to Torfstraße 17', async (t) => {
|
|||
t.end()
|
||||
})
|
||||
|
||||
test('Berlin Schwedter Str. to ATZE Musiktheater', async (t) => {
|
||||
tap.test('Berlin Schwedter Str. to ATZE Musiktheater', async (t) => {
|
||||
const atze = {
|
||||
type: 'location',
|
||||
id: '991598902',
|
||||
|
@ -155,7 +155,7 @@ test('Berlin Schwedter Str. to ATZE Musiktheater', async (t) => {
|
|||
t.end()
|
||||
})
|
||||
|
||||
test('journeys: via works – with detour', async (t) => {
|
||||
tap.test('journeys: via works – with detour', async (t) => {
|
||||
// Going from Westhafen to Wedding via Württembergalle without detour
|
||||
// is currently impossible. We check if the routing engine computes a detour.
|
||||
const res = await client.journeys(westhafen, wedding, {
|
||||
|
@ -177,7 +177,7 @@ test('journeys: via works – with detour', async (t) => {
|
|||
// todo: walkingSpeed "Berlin - Charlottenburg, Hallerstraße" -> jungfernheide
|
||||
// todo: without detour
|
||||
|
||||
test('earlier/later journeys, Jungfernheide -> München Hbf', async (t) => {
|
||||
tap.test('earlier/later journeys, Jungfernheide -> München Hbf', async (t) => {
|
||||
await testEarlierLaterJourneys({
|
||||
test: t,
|
||||
fetchJourneys: client.journeys,
|
||||
|
@ -190,7 +190,7 @@ test('earlier/later journeys, Jungfernheide -> München Hbf', async (t) => {
|
|||
t.end()
|
||||
})
|
||||
|
||||
test.skip('journeys – leg cycle & alternatives', async (t) => {
|
||||
tap.skip('journeys – leg cycle & alternatives', async (t) => {
|
||||
await testLegCycleAlternatives({
|
||||
test: t,
|
||||
fetchJourneys: client.journeys,
|
||||
|
@ -200,7 +200,7 @@ test.skip('journeys – leg cycle & alternatives', async (t) => {
|
|||
t.end()
|
||||
})
|
||||
|
||||
test('refreshJourney', async (t) => {
|
||||
tap.test('refreshJourney', async (t) => {
|
||||
await testRefreshJourney({
|
||||
test: t,
|
||||
fetchJourneys: client.journeys,
|
||||
|
@ -213,7 +213,7 @@ test('refreshJourney', async (t) => {
|
|||
t.end()
|
||||
})
|
||||
|
||||
test('trip details', async (t) => {
|
||||
tap.test('trip details', async (t) => {
|
||||
const res = await client.journeys(berlinHbf, münchenHbf, {
|
||||
results: 1, departure: when
|
||||
})
|
||||
|
@ -236,7 +236,7 @@ test('trip details', async (t) => {
|
|||
t.end()
|
||||
})
|
||||
|
||||
test('departures at Berlin Schwedter Str.', async (t) => {
|
||||
tap.test('departures at Berlin Schwedter Str.', async (t) => {
|
||||
const departures = await client.departures(blnSchwedterStr, {
|
||||
duration: 5, when,
|
||||
})
|
||||
|
@ -250,7 +250,7 @@ test('departures at Berlin Schwedter Str.', async (t) => {
|
|||
t.end()
|
||||
})
|
||||
|
||||
test('departures with station object', async (t) => {
|
||||
tap.test('departures with station object', async (t) => {
|
||||
const deps = await client.departures({
|
||||
type: 'station',
|
||||
id: jungfernheide,
|
||||
|
@ -266,7 +266,7 @@ test('departures with station object', async (t) => {
|
|||
t.end()
|
||||
})
|
||||
|
||||
test('departures at Berlin Hbf in direction of Berlin Ostbahnhof', async (t) => {
|
||||
tap.test('departures at Berlin Hbf in direction of Berlin Ostbahnhof', async (t) => {
|
||||
await testDeparturesInDirection({
|
||||
test: t,
|
||||
fetchDepartures: client.departures,
|
||||
|
@ -279,7 +279,7 @@ test('departures at Berlin Hbf in direction of Berlin Ostbahnhof', async (t) =>
|
|||
t.end()
|
||||
})
|
||||
|
||||
test('arrivals at Berlin Schwedter Str.', async (t) => {
|
||||
tap.test('arrivals at Berlin Schwedter Str.', async (t) => {
|
||||
const arrivals = await client.arrivals(blnSchwedterStr, {
|
||||
duration: 5, when,
|
||||
})
|
||||
|
@ -293,7 +293,7 @@ test('arrivals at Berlin Schwedter Str.', async (t) => {
|
|||
t.end()
|
||||
})
|
||||
|
||||
test('nearby Berlin Jungfernheide', async (t) => {
|
||||
tap.test('nearby Berlin Jungfernheide', async (t) => {
|
||||
const nearby = await client.nearby({
|
||||
type: 'location',
|
||||
latitude: 52.530273,
|
||||
|
@ -317,7 +317,7 @@ test('nearby Berlin Jungfernheide', async (t) => {
|
|||
t.end()
|
||||
})
|
||||
|
||||
test('locations named Jungfernheide', async (t) => {
|
||||
tap.test('locations named Jungfernheide', async (t) => {
|
||||
const locations = await client.locations('Jungfernheide', {
|
||||
results: 10
|
||||
})
|
||||
|
@ -331,7 +331,7 @@ test('locations named Jungfernheide', async (t) => {
|
|||
t.end()
|
||||
})
|
||||
|
||||
test('stop', async (t) => {
|
||||
tap.test('stop', async (t) => {
|
||||
const s = await client.stop(regensburgHbf)
|
||||
|
||||
validate(t, s, ['stop', 'station'], 'stop')
|
||||
|
@ -340,7 +340,7 @@ test('stop', async (t) => {
|
|||
t.end()
|
||||
})
|
||||
|
||||
test('line with additionalName', async (t) => {
|
||||
tap.test('line with additionalName', async (t) => {
|
||||
const departures = await client.departures(potsdamHbf, {
|
||||
when,
|
||||
duration: 12 * 60, // 12 minutes
|
||||
|
@ -350,7 +350,7 @@ test('line with additionalName', async (t) => {
|
|||
t.end()
|
||||
})
|
||||
|
||||
test('radar', async (t) => {
|
||||
tap.test('radar', async (t) => {
|
||||
const vehicles = await client.radar({
|
||||
north: 52.52411,
|
||||
west: 13.41002,
|
||||
|
@ -364,7 +364,7 @@ test('radar', async (t) => {
|
|||
t.end()
|
||||
})
|
||||
|
||||
test('reachableFrom', async (t) => {
|
||||
tap.test('reachableFrom', async (t) => {
|
||||
const torfstr17 = {
|
||||
type: 'location',
|
||||
address: 'Torfstraße 17',
|
||||
|
@ -383,7 +383,7 @@ test('reachableFrom', async (t) => {
|
|||
t.end()
|
||||
})
|
||||
|
||||
test('serverInfo works', async (t) => {
|
||||
tap.test('serverInfo works', async (t) => {
|
||||
await testServerInfo({
|
||||
test: t,
|
||||
fetchServerInfo: client.serverInfo,
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
'use strict'
|
||||
|
||||
const tap = require('tap')
|
||||
const isRoughlyEqual = require('is-roughly-equal')
|
||||
|
||||
const {createWhen} = require('./lib/util')
|
||||
|
@ -7,7 +8,6 @@ const createClient = require('../..')
|
|||
const hvvProfile = require('../../p/hvv')
|
||||
const products = require('../../p/hvv/products')
|
||||
const createValidate = require('./lib/validate-fptf-with')
|
||||
const {test} = require('./lib/util')
|
||||
const testJourneysStationToStation = require('./lib/journeys-station-to-station')
|
||||
const journeysFailsWithNoProduct = require('./lib/journeys-fails-with-no-product')
|
||||
const testJourneysStationToAddress = require('./lib/journeys-station-to-address')
|
||||
|
@ -40,7 +40,7 @@ const altona = '20626'
|
|||
// const stendal = '8010334'
|
||||
// const dessau = '8010077'
|
||||
|
||||
test('journeys – Hamburg Tiefstack to Hamburg Barmbek', async (t) => {
|
||||
tap.test('journeys – Hamburg Tiefstack to Hamburg Barmbek', async (t) => {
|
||||
const res = await client.journeys(tiefstack, barmbek, {
|
||||
results: 4,
|
||||
departure: when,
|
||||
|
@ -59,7 +59,7 @@ test('journeys – Hamburg Tiefstack to Hamburg Barmbek', async (t) => {
|
|||
|
||||
// todo: journeys, only one product
|
||||
|
||||
test('journeys – fails with no product', (t) => {
|
||||
tap.test('journeys – fails with no product', (t) => {
|
||||
journeysFailsWithNoProduct({
|
||||
test: t,
|
||||
fetchJourneys: client.journeys,
|
||||
|
@ -71,7 +71,7 @@ test('journeys – fails with no product', (t) => {
|
|||
t.end()
|
||||
})
|
||||
|
||||
test('Hamburg Tiefstack to Gilbertstr. 30, Hamburg', async (t) => {
|
||||
tap.test('Hamburg Tiefstack to Gilbertstr. 30, Hamburg', async (t) => {
|
||||
const gilbertstr30 = {
|
||||
type: 'location',
|
||||
id: '970026640',
|
||||
|
@ -95,7 +95,7 @@ test('Hamburg Tiefstack to Gilbertstr. 30, Hamburg', async (t) => {
|
|||
t.end()
|
||||
})
|
||||
|
||||
test('Hamburg Tiefstack to Hamburger Meile', async (t) => {
|
||||
tap.test('Hamburg Tiefstack to Hamburger Meile', async (t) => {
|
||||
const meile = {
|
||||
type: 'location',
|
||||
id: '980001831',
|
||||
|
@ -122,7 +122,7 @@ test('Hamburg Tiefstack to Hamburger Meile', async (t) => {
|
|||
// todo: via works – with detour
|
||||
// todo: via works – without detour
|
||||
|
||||
test('earlier/later journeys', async (t) => {
|
||||
tap.test('earlier/later journeys', async (t) => {
|
||||
await testEarlierLaterJourneys({
|
||||
test: t,
|
||||
fetchJourneys: client.journeys,
|
||||
|
@ -135,7 +135,7 @@ test('earlier/later journeys', async (t) => {
|
|||
t.end()
|
||||
})
|
||||
|
||||
test('trip details', async (t) => {
|
||||
tap.test('trip details', async (t) => {
|
||||
const res = await client.journeys(tiefstack, barmbek, {
|
||||
results: 1, departure: when
|
||||
})
|
||||
|
@ -149,7 +149,7 @@ test('trip details', async (t) => {
|
|||
t.end()
|
||||
})
|
||||
|
||||
test('departures at Hamburg Barmbek', async (t) => {
|
||||
tap.test('departures at Hamburg Barmbek', async (t) => {
|
||||
const departures = await client.departures(barmbek, {
|
||||
duration: 5, when,
|
||||
})
|
||||
|
@ -163,7 +163,7 @@ test('departures at Hamburg Barmbek', async (t) => {
|
|||
t.end()
|
||||
})
|
||||
|
||||
test('departures with station object', async (t) => {
|
||||
tap.test('departures with station object', async (t) => {
|
||||
const deps = await client.departures({
|
||||
type: 'station',
|
||||
id: tiefstack,
|
||||
|
@ -179,7 +179,7 @@ test('departures with station object', async (t) => {
|
|||
t.end()
|
||||
})
|
||||
|
||||
test('departures at Barmbek in direction of Altona', async (t) => {
|
||||
tap.test('departures at Barmbek in direction of Altona', async (t) => {
|
||||
await testDeparturesInDirection({
|
||||
test: t,
|
||||
fetchDepartures: client.departures,
|
||||
|
@ -192,7 +192,7 @@ test('departures at Barmbek in direction of Altona', async (t) => {
|
|||
t.end()
|
||||
})
|
||||
|
||||
test('arrivals at Hamburg Barmbek', async (t) => {
|
||||
tap.test('arrivals at Hamburg Barmbek', async (t) => {
|
||||
const arrivals = await client.arrivals(barmbek, {
|
||||
duration: 5, when
|
||||
})
|
||||
|
@ -208,7 +208,7 @@ test('arrivals at Hamburg Barmbek', async (t) => {
|
|||
|
||||
// todo: nearby
|
||||
|
||||
test('locations named Elbphilharmonie', async (t) => {
|
||||
tap.test('locations named Elbphilharmonie', async (t) => {
|
||||
const elbphilharmonie = '6242'
|
||||
const locations = await client.locations('Elbphilharmonie', {
|
||||
results: 20
|
||||
|
@ -226,7 +226,7 @@ test('locations named Elbphilharmonie', async (t) => {
|
|||
t.end()
|
||||
})
|
||||
|
||||
test('station Hamburg Barmbek', async (t) => {
|
||||
tap.test('station Hamburg Barmbek', async (t) => {
|
||||
const s = await client.stop(barmbek)
|
||||
|
||||
validate(t, s, ['stop', 'station'], 'station')
|
||||
|
@ -235,7 +235,7 @@ test('station Hamburg Barmbek', async (t) => {
|
|||
t.end()
|
||||
})
|
||||
|
||||
test('radar', async (t) => {
|
||||
tap.test('radar', async (t) => {
|
||||
const vehicles = await client.radar({
|
||||
north: 53.569,
|
||||
west: 10.022,
|
||||
|
|
|
@ -1,32 +0,0 @@
|
|||
'use strict'
|
||||
|
||||
Error.stackTraceLimit = Infinity
|
||||
|
||||
require('./common')
|
||||
require('./db')
|
||||
require('./sbb')
|
||||
require('./vbb')
|
||||
require('./bvg')
|
||||
require('./oebb')
|
||||
require('./insa')
|
||||
require('./nahsh')
|
||||
require('./cmta')
|
||||
require('./nvv')
|
||||
require('./sbahn-muenchen')
|
||||
require('./saarfahrplan')
|
||||
require('./cfl')
|
||||
require('./mobiliteit-lu')
|
||||
require('./hvv')
|
||||
require('./vsn')
|
||||
require('./vbn')
|
||||
require('./vrn')
|
||||
require('./rmv')
|
||||
require('./rsag')
|
||||
require('./db-busradar-nrw')
|
||||
require('./mobil-nrw')
|
||||
require('./invg')
|
||||
require('./pkp')
|
||||
require('./sncb')
|
||||
require('./svv')
|
||||
require('./zvv')
|
||||
require('./rejseplanen')
|
|
@ -1,5 +1,6 @@
|
|||
'use strict'
|
||||
|
||||
const tap = require('tap')
|
||||
const isRoughlyEqual = require('is-roughly-equal')
|
||||
|
||||
const {createWhen} = require('./lib/util')
|
||||
|
@ -11,7 +12,6 @@ const {
|
|||
journeyLeg: createValidateJourneyLeg,
|
||||
} = require('./lib/validators')
|
||||
const createValidate = require('./lib/validate-fptf-with')
|
||||
const {test} = require('./lib/util')
|
||||
const testJourneysStationToStation = require('./lib/journeys-station-to-station')
|
||||
const testJourneysStationToAddress = require('./lib/journeys-station-to-address')
|
||||
const testJourneysStationToPoi = require('./lib/journeys-station-to-poi')
|
||||
|
@ -59,7 +59,7 @@ const stendal = '8010334'
|
|||
const dessau = '8010077'
|
||||
const universitaet = '19686'
|
||||
|
||||
test('journeys – Magdeburg Hbf to Magdeburg-Buckau', async (t) => {
|
||||
tap.test('journeys – Magdeburg Hbf to Magdeburg-Buckau', async (t) => {
|
||||
const res = await client.journeys(magdeburgHbf, magdeburgBuckau, {
|
||||
results: 4,
|
||||
departure: when,
|
||||
|
@ -78,7 +78,7 @@ test('journeys – Magdeburg Hbf to Magdeburg-Buckau', async (t) => {
|
|||
|
||||
// todo: journeys, only one product
|
||||
|
||||
test('journeys – fails with no product', (t) => {
|
||||
tap.test('journeys – fails with no product', (t) => {
|
||||
journeysFailsWithNoProduct({
|
||||
test: t,
|
||||
fetchJourneys: client.journeys,
|
||||
|
@ -90,7 +90,7 @@ test('journeys – fails with no product', (t) => {
|
|||
t.end()
|
||||
})
|
||||
|
||||
test('Magdeburg Hbf to 39104 Magdeburg, Sternstr. 10', async (t) => {
|
||||
tap.test('Magdeburg Hbf to 39104 Magdeburg, Sternstr. 10', async (t) => {
|
||||
const sternStr = {
|
||||
type: 'location',
|
||||
address: 'Magdeburg - Altenstadt, Sternstraße 10',
|
||||
|
@ -113,7 +113,7 @@ test('Magdeburg Hbf to 39104 Magdeburg, Sternstr. 10', async (t) => {
|
|||
t.end()
|
||||
})
|
||||
|
||||
test('Magdeburg Hbf to Kloster Unser Lieben Frauen', async (t) => {
|
||||
tap.test('Magdeburg Hbf to Kloster Unser Lieben Frauen', async (t) => {
|
||||
const kloster = {
|
||||
type: 'location',
|
||||
id: '970012223',
|
||||
|
@ -137,7 +137,7 @@ test('Magdeburg Hbf to Kloster Unser Lieben Frauen', async (t) => {
|
|||
t.end()
|
||||
})
|
||||
|
||||
test('journeys: via works – with detour', async (t) => {
|
||||
tap.test('journeys: via works – with detour', async (t) => {
|
||||
// Going from Magdeburg, Hasselbachplatz (Sternstr.) (Tram/Bus) to Stendal
|
||||
// via Dessau without detour is currently impossible. We check if the routing
|
||||
// engine computes a detour.
|
||||
|
@ -159,7 +159,7 @@ test('journeys: via works – with detour', async (t) => {
|
|||
|
||||
// todo: without detour
|
||||
|
||||
test('earlier/later journeys', async (t) => {
|
||||
tap.test('earlier/later journeys', async (t) => {
|
||||
await testEarlierLaterJourneys({
|
||||
test: t,
|
||||
fetchJourneys: client.journeys,
|
||||
|
@ -172,7 +172,7 @@ test('earlier/later journeys', async (t) => {
|
|||
t.end()
|
||||
})
|
||||
|
||||
test('trip details', async (t) => {
|
||||
tap.test('trip details', async (t) => {
|
||||
const res = await client.journeys(magdeburgHbf, magdeburgBuckau, {
|
||||
results: 1, departure: when
|
||||
})
|
||||
|
@ -186,7 +186,7 @@ test('trip details', async (t) => {
|
|||
t.end()
|
||||
})
|
||||
|
||||
test('departures at Magdeburg Leiterstr.', async (t) => {
|
||||
tap.test('departures at Magdeburg Leiterstr.', async (t) => {
|
||||
const departures = await client.departures(leiterstr, {
|
||||
duration: 5, when,
|
||||
})
|
||||
|
@ -200,7 +200,7 @@ test('departures at Magdeburg Leiterstr.', async (t) => {
|
|||
t.end()
|
||||
})
|
||||
|
||||
test('departures with station object', async (t) => {
|
||||
tap.test('departures with station object', async (t) => {
|
||||
const deps = await client.departures({
|
||||
type: 'station',
|
||||
id: magdeburgHbf,
|
||||
|
@ -216,7 +216,7 @@ test('departures with station object', async (t) => {
|
|||
t.end()
|
||||
})
|
||||
|
||||
test('departures at Leiterstr in direction of Universität', async (t) => {
|
||||
tap.test('departures at Leiterstr in direction of Universität', async (t) => {
|
||||
await testDeparturesInDirection({
|
||||
test: t,
|
||||
fetchDepartures: client.departures,
|
||||
|
@ -229,7 +229,7 @@ test('departures at Leiterstr in direction of Universität', async (t) => {
|
|||
t.end()
|
||||
})
|
||||
|
||||
test('arrivals at Magdeburg Leiterstr.', async (t) => {
|
||||
tap.test('arrivals at Magdeburg Leiterstr.', async (t) => {
|
||||
const arrivals = await client.arrivals(leiterstr, {
|
||||
duration: 5, when
|
||||
})
|
||||
|
@ -245,7 +245,7 @@ test('arrivals at Magdeburg Leiterstr.', async (t) => {
|
|||
|
||||
// todo: nearby
|
||||
|
||||
test('locations named Magdeburg', async (t) => {
|
||||
tap.test('locations named Magdeburg', async (t) => {
|
||||
const nordpark = '7480'
|
||||
const locations = await client.locations('nordpark', {
|
||||
results: 20
|
||||
|
@ -263,7 +263,7 @@ test('locations named Magdeburg', async (t) => {
|
|||
t.end()
|
||||
})
|
||||
|
||||
test('station Magdeburg-Buckau', async (t) => {
|
||||
tap.test('station Magdeburg-Buckau', async (t) => {
|
||||
const s = await client.stop(magdeburgBuckau)
|
||||
|
||||
validate(t, s, ['stop', 'station'], 'station')
|
||||
|
@ -272,7 +272,7 @@ test('station Magdeburg-Buckau', async (t) => {
|
|||
t.end()
|
||||
})
|
||||
|
||||
test('radar', async (t) => {
|
||||
tap.test('radar', async (t) => {
|
||||
const vehicles = await client.radar({
|
||||
north: 52.148364,
|
||||
west: 11.600826,
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
'use strict'
|
||||
|
||||
const tap = require('tap')
|
||||
const isRoughlyEqual = require('is-roughly-equal')
|
||||
|
||||
const {createWhen} = require('./lib/util')
|
||||
|
@ -11,7 +12,6 @@ const {
|
|||
movement: createValidateMovement
|
||||
} = require('./lib/validators')
|
||||
const createValidate = require('./lib/validate-fptf-with')
|
||||
const {test} = require('./lib/util')
|
||||
const testJourneysStationToStation = require('./lib/journeys-station-to-station')
|
||||
const testJourneysStationToAddress = require('./lib/journeys-station-to-address')
|
||||
const testJourneysStationToPoi = require('./lib/journeys-station-to-poi')
|
||||
|
@ -55,7 +55,7 @@ const uhlandstr1 = {
|
|||
longitude: 11.441138
|
||||
}
|
||||
|
||||
test('journeys – Ingolstadt Hbf to Audi Parkplatz', async (t) => {
|
||||
tap.test('journeys – Ingolstadt Hbf to Audi Parkplatz', async (t) => {
|
||||
const telemannstr = '71801'
|
||||
const res = await client.journeys(ingolstadtHbf, telemannstr, {
|
||||
results: 4,
|
||||
|
@ -75,7 +75,7 @@ test('journeys – Ingolstadt Hbf to Audi Parkplatz', async (t) => {
|
|||
|
||||
// todo: journeys, only one product
|
||||
|
||||
test('journeys – fails with no product', (t) => {
|
||||
tap.test('journeys – fails with no product', (t) => {
|
||||
journeysFailsWithNoProduct({
|
||||
test: t,
|
||||
fetchJourneys: client.journeys,
|
||||
|
@ -87,7 +87,7 @@ test('journeys – fails with no product', (t) => {
|
|||
t.end()
|
||||
})
|
||||
|
||||
test('Ingolstadt Hbf to Uhlandstr. 1', async (t) => {
|
||||
tap.test('Ingolstadt Hbf to Uhlandstr. 1', async (t) => {
|
||||
const res = await client.journeys(ingolstadtHbf, uhlandstr1, {
|
||||
results: 3,
|
||||
departure: when
|
||||
|
@ -103,7 +103,7 @@ test('Ingolstadt Hbf to Uhlandstr. 1', async (t) => {
|
|||
t.end()
|
||||
})
|
||||
|
||||
test('Ingolstadt Hbf to Städtisches Freibad', async (t) => {
|
||||
tap.test('Ingolstadt Hbf to Städtisches Freibad', async (t) => {
|
||||
const freibad = {
|
||||
type: 'location',
|
||||
id: '980000591',
|
||||
|
@ -130,7 +130,7 @@ test('Ingolstadt Hbf to Städtisches Freibad', async (t) => {
|
|||
// todo: via works – with detour
|
||||
// todo: without detour
|
||||
|
||||
test('earlier/later journeys', async (t) => {
|
||||
tap.test('earlier/later journeys', async (t) => {
|
||||
await testEarlierLaterJourneys({
|
||||
test: t,
|
||||
fetchJourneys: client.journeys,
|
||||
|
@ -143,7 +143,7 @@ test('earlier/later journeys', async (t) => {
|
|||
t.end()
|
||||
})
|
||||
|
||||
test('refreshJourney', async (t) => {
|
||||
tap.test('refreshJourney', async (t) => {
|
||||
await testRefreshJourney({
|
||||
test: t,
|
||||
fetchJourneys: client.journeys,
|
||||
|
@ -156,7 +156,7 @@ test('refreshJourney', async (t) => {
|
|||
t.end()
|
||||
})
|
||||
|
||||
test('trip details', async (t) => {
|
||||
tap.test('trip details', async (t) => {
|
||||
const {journeys} = await client.journeys(ingolstadtHbf, telemannstr, {
|
||||
results: 1, departure: when
|
||||
})
|
||||
|
@ -170,7 +170,7 @@ test('trip details', async (t) => {
|
|||
t.end()
|
||||
})
|
||||
|
||||
test('departures at Ingolstadt Hbf', async (t) => {
|
||||
tap.test('departures at Ingolstadt Hbf', async (t) => {
|
||||
const ids = [
|
||||
ingolstadtHbf, // station
|
||||
'80301', // stop "Ingolstadt, Hauptbahnhof Stadtauswärts"
|
||||
|
@ -184,7 +184,7 @@ test('departures at Ingolstadt Hbf', async (t) => {
|
|||
validate(t, deps, 'departures', 'departures')
|
||||
t.ok(deps.length > 0, 'must be >0 departures')
|
||||
// todo: move into deps validator
|
||||
t.deepEqual(deps, deps.sort((a, b) => t.when > b.when))
|
||||
t.same(deps, deps.sort((a, b) => t.when > b.when))
|
||||
|
||||
for (let i = 0; i < deps.length; i++) {
|
||||
const dep = deps[i]
|
||||
|
@ -194,7 +194,7 @@ test('departures at Ingolstadt Hbf', async (t) => {
|
|||
t.end()
|
||||
})
|
||||
|
||||
test('departures with station object', async (t) => {
|
||||
tap.test('departures with station object', async (t) => {
|
||||
const deps = await client.departures({
|
||||
type: 'station',
|
||||
id: ingolstadtHbf,
|
||||
|
@ -210,7 +210,7 @@ test('departures with station object', async (t) => {
|
|||
t.end()
|
||||
})
|
||||
|
||||
test('arrivals at Ingolstadt Hbf', async (t) => {
|
||||
tap.test('arrivals at Ingolstadt Hbf', async (t) => {
|
||||
const ids = [
|
||||
ingolstadtHbf, // station
|
||||
'80301', // stop "Ingolstadt, Hauptbahnhof Stadtauswärts"
|
||||
|
@ -224,7 +224,7 @@ test('arrivals at Ingolstadt Hbf', async (t) => {
|
|||
validate(t, arrs, 'arrivals', 'arrivals')
|
||||
t.ok(arrs.length > 0, 'must be >0 arrivals')
|
||||
// todo: move into arrs validator
|
||||
t.deepEqual(arrs, arrs.sort((a, b) => t.when > b.when))
|
||||
t.same(arrs, arrs.sort((a, b) => t.when > b.when))
|
||||
|
||||
for (let i = 0; i < arrs.length; i++) {
|
||||
const arr = arrs[i]
|
||||
|
@ -234,7 +234,7 @@ test('arrivals at Ingolstadt Hbf', async (t) => {
|
|||
t.end()
|
||||
})
|
||||
|
||||
test('nearby', async (t) => {
|
||||
tap.test('nearby', async (t) => {
|
||||
const nearby = await client.nearby({
|
||||
type: 'location',
|
||||
id: '990001921',
|
||||
|
@ -253,7 +253,7 @@ test('nearby', async (t) => {
|
|||
t.end()
|
||||
})
|
||||
|
||||
test('locations named "freibad"', async (t) => {
|
||||
tap.test('locations named "freibad"', async (t) => {
|
||||
const freibadIngolstadt = '980000591'
|
||||
const locations = await client.locations('freibad', {
|
||||
results: 5
|
||||
|
@ -271,7 +271,7 @@ test('locations named "freibad"', async (t) => {
|
|||
t.end()
|
||||
})
|
||||
|
||||
test('stop Ettinger Str.', async (t) => {
|
||||
tap.test('stop Ettinger Str.', async (t) => {
|
||||
const ettingerStr = '18304'
|
||||
const s = await client.stop(ettingerStr)
|
||||
|
||||
|
@ -281,7 +281,7 @@ test('stop Ettinger Str.', async (t) => {
|
|||
t.end()
|
||||
})
|
||||
|
||||
test('radar', async (t) => {
|
||||
tap.test('radar', async (t) => {
|
||||
const vehicles = await client.radar({
|
||||
north: 48.74453,
|
||||
west: 11.42733,
|
||||
|
|
|
@ -17,7 +17,7 @@ const testArrivals = async (cfg) => {
|
|||
}
|
||||
|
||||
// todo: move into arrivals validator
|
||||
t.deepEqual(arrs, arrs.sort((a, b) => t.when > b.when))
|
||||
t.same(arrs, arrs.sort((a, b) => t.when > b.when))
|
||||
}
|
||||
|
||||
module.exports = testArrivals
|
||||
|
|
|
@ -17,7 +17,7 @@ const testDepartures = async (cfg) => {
|
|||
}
|
||||
|
||||
// todo: move into deps validator
|
||||
t.deepEqual(deps, deps.sort((a, b) => t.when > b.when))
|
||||
t.same(deps, deps.sort((a, b) => t.when > b.when))
|
||||
}
|
||||
|
||||
module.exports = testDepartures
|
||||
|
|
|
@ -20,8 +20,8 @@ const testJourneysStationToAddress = async (cfg) => {
|
|||
const d = j.legs[j.legs.length - 1].destination
|
||||
const n = `res.journeys[0].legs[${i}].destination`
|
||||
|
||||
t.strictEqual(d.type, 'location', n + '.type is invalid')
|
||||
t.strictEqual(d.address, address, n + '.address is invalid')
|
||||
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')
|
||||
}
|
||||
|
|
|
@ -19,7 +19,7 @@ const testJourneysStationToPoi = async (cfg) => {
|
|||
o = o.station
|
||||
oN += '.station'
|
||||
}
|
||||
t.strictEqual(o.id, fromId)
|
||||
t.equal(o.id, fromId)
|
||||
|
||||
let d = j.legs[j.legs.length - 1].destination
|
||||
let dN = `res.journeys[${i}].legs[${j.legs.length - 1}].destination`
|
||||
|
@ -28,9 +28,9 @@ const testJourneysStationToPoi = async (cfg) => {
|
|||
dN += '.station'
|
||||
}
|
||||
|
||||
t.strictEqual(d.type, 'location', dN + '.type is invalid')
|
||||
t.strictEqual(d.id, id, dN + '.id is invalid')
|
||||
t.strictEqual(d.name, name, dN + '.name 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(.0001, d.latitude, latitude), dN + '.latitude is invalid')
|
||||
t.ok(isRoughlyEqual(.0001, d.longitude, longitude), dN + '.longitude is invalid')
|
||||
}
|
||||
|
|
|
@ -36,7 +36,7 @@ const testReachableFrom = async (cfg) => {
|
|||
}
|
||||
|
||||
const sorted = results.sort((a, b) => a.duration - b.duration)
|
||||
t.deepEqual(results, sorted, 'results must be sorted by res.duration')
|
||||
t.same(results, sorted, 'results must be sorted by res.duration')
|
||||
}
|
||||
|
||||
module.exports = testReachableFrom
|
||||
|
|
|
@ -34,7 +34,7 @@ const testRefreshJourney = async (cfg) => {
|
|||
const refreshed = await refreshJourney(model.refreshToken, {
|
||||
stopovers: false
|
||||
})
|
||||
t.deepEqual(simplify(refreshed), simplify(model))
|
||||
t.same(simplify(refreshed), simplify(model))
|
||||
}
|
||||
|
||||
module.exports = testRefreshJourney
|
||||
|
|
|
@ -5,7 +5,6 @@ const {AssertionError} = require('assert')
|
|||
const {DateTime} = require('luxon')
|
||||
const a = require('assert')
|
||||
const {join} = require('path')
|
||||
const tape = require('tape')
|
||||
|
||||
const hour = 60 * 60 * 1000
|
||||
const day = 24 * hour
|
||||
|
@ -51,9 +50,7 @@ if (process.env.VCR_MODE && !process.env.VCR_OFF) {
|
|||
})
|
||||
replayer.fixtureDir(join(__dirname, '..', 'fixtures'))
|
||||
}
|
||||
const test = tape
|
||||
|
||||
module.exports = {
|
||||
hour, createWhen, assertValidWhen,
|
||||
test,
|
||||
}
|
||||
|
|
|
@ -1,11 +1,12 @@
|
|||
'use strict'
|
||||
|
||||
const tap = require('tap')
|
||||
|
||||
const {createWhen} = require('./lib/util')
|
||||
const createClient = require('../..')
|
||||
const mobilNrwProfile = require('../../p/mobil-nrw')
|
||||
const products = require('../../p/mobil-nrw/products')
|
||||
const createValidate = require('./lib/validate-fptf-with')
|
||||
const {test} = require('./lib/util')
|
||||
const testJourneysStationToStation = require('./lib/journeys-station-to-station')
|
||||
const testJourneysStationToAddress = require('./lib/journeys-station-to-address')
|
||||
const testJourneysStationToPoi = require('./lib/journeys-station-to-poi')
|
||||
|
@ -36,7 +37,7 @@ const soest = '8000076'
|
|||
const aachenHbf = '8000001'
|
||||
const dortmundStadtgarten = '655672'
|
||||
|
||||
test('journeys – Soest to Aachen Hbf', async (t) => {
|
||||
tap.test('journeys – Soest to Aachen Hbf', async (t) => {
|
||||
const res = await client.journeys(soest, aachenHbf, {
|
||||
results: 4,
|
||||
departure: when,
|
||||
|
@ -55,7 +56,7 @@ test('journeys – Soest to Aachen Hbf', async (t) => {
|
|||
|
||||
// todo: journeys, only one product
|
||||
|
||||
test('Aachen Hbf to Schillingstr. 3, Dortmund', async (t) => {
|
||||
tap.test('Aachen Hbf to Schillingstr. 3, Dortmund', async (t) => {
|
||||
const schillingstr3 = {
|
||||
type: 'location',
|
||||
id: '980288407',
|
||||
|
@ -79,7 +80,7 @@ test('Aachen Hbf to Schillingstr. 3, Dortmund', async (t) => {
|
|||
t.end()
|
||||
})
|
||||
|
||||
test('Aachen Hbf to Sportanlage Schulzentrum, Dortmund', async (t) => {
|
||||
tap.test('Aachen Hbf to Sportanlage Schulzentrum, Dortmund', async (t) => {
|
||||
const sportanlage = {
|
||||
type: 'location',
|
||||
id: '991557725',
|
||||
|
@ -107,7 +108,7 @@ test('Aachen Hbf to Sportanlage Schulzentrum, Dortmund', async (t) => {
|
|||
// todo: via works – with detour
|
||||
// todo: without detour
|
||||
|
||||
test('earlier/later journeys', async (t) => {
|
||||
tap.test('earlier/later journeys', async (t) => {
|
||||
await testEarlierLaterJourneys({
|
||||
test: t,
|
||||
fetchJourneys: client.journeys,
|
||||
|
@ -120,7 +121,7 @@ test('earlier/later journeys', async (t) => {
|
|||
t.end()
|
||||
})
|
||||
|
||||
test('refreshJourney', async (t) => {
|
||||
tap.test('refreshJourney', async (t) => {
|
||||
await testRefreshJourney({
|
||||
test: t,
|
||||
fetchJourneys: client.journeys,
|
||||
|
@ -133,7 +134,7 @@ test('refreshJourney', async (t) => {
|
|||
t.end()
|
||||
})
|
||||
|
||||
test('trip details', async (t) => {
|
||||
tap.test('trip details', async (t) => {
|
||||
const res = await client.journeys(soest, aachenHbf, {
|
||||
results: 1, departure: when
|
||||
})
|
||||
|
@ -147,7 +148,7 @@ test('trip details', async (t) => {
|
|||
t.end()
|
||||
})
|
||||
|
||||
test('departures at Soest', async (t) => {
|
||||
tap.test('departures at Soest', async (t) => {
|
||||
const departures = await client.departures(soest, {
|
||||
duration: 10, when,
|
||||
})
|
||||
|
@ -161,7 +162,7 @@ test('departures at Soest', async (t) => {
|
|||
t.end()
|
||||
})
|
||||
|
||||
test('departures with station object', async (t) => {
|
||||
tap.test('departures with station object', async (t) => {
|
||||
const deps = await client.departures({
|
||||
type: 'station',
|
||||
id: soest,
|
||||
|
@ -177,7 +178,7 @@ test('departures with station object', async (t) => {
|
|||
t.end()
|
||||
})
|
||||
|
||||
test('arrivals at Soest', async (t) => {
|
||||
tap.test('arrivals at Soest', async (t) => {
|
||||
const arrivals = await client.arrivals(soest, {
|
||||
duration: 10, when,
|
||||
})
|
||||
|
@ -193,7 +194,7 @@ test('arrivals at Soest', async (t) => {
|
|||
|
||||
// todo: nearby
|
||||
|
||||
test('locations named "stadtgarten dortmund"', async (t) => {
|
||||
tap.test('locations named "stadtgarten dortmund"', async (t) => {
|
||||
const locations = await client.locations('stadtgarten dortmund', {
|
||||
results: 10,
|
||||
})
|
||||
|
@ -210,7 +211,7 @@ test('locations named "stadtgarten dortmund"', async (t) => {
|
|||
t.end()
|
||||
})
|
||||
|
||||
test('station Aachen Hbf', async (t) => {
|
||||
tap.test('station Aachen Hbf', async (t) => {
|
||||
const s = await client.stop(aachenHbf)
|
||||
|
||||
validate(t, s, ['stop', 'station'], 'station')
|
||||
|
@ -219,7 +220,7 @@ test('station Aachen Hbf', async (t) => {
|
|||
t.end()
|
||||
})
|
||||
|
||||
test('radar', async (t) => {
|
||||
tap.test('radar', async (t) => {
|
||||
const vehicles = await client.radar({
|
||||
north: 51.4358,
|
||||
west: 6.7625,
|
||||
|
@ -233,7 +234,7 @@ test('radar', async (t) => {
|
|||
t.end()
|
||||
})
|
||||
|
||||
test('reachableFrom', async (t) => {
|
||||
tap.test('reachableFrom', async (t) => {
|
||||
await testReachableFrom({
|
||||
test: t,
|
||||
reachableFrom: client.reachableFrom,
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
'use strict'
|
||||
|
||||
const tap = require('tap')
|
||||
const assert = require('assert')
|
||||
const isRoughlyEqual = require('is-roughly-equal')
|
||||
|
||||
|
@ -13,7 +14,6 @@ const {
|
|||
movement: _validateMovement
|
||||
} = require('./lib/validators')
|
||||
const createValidate = require('./lib/validate-fptf-with')
|
||||
const {test} = require('./lib/util')
|
||||
const testJourneysStationToStation = require('./lib/journeys-station-to-station')
|
||||
const testJourneysStationToAddress = require('./lib/journeys-station-to-address')
|
||||
const testJourneysStationToPoi = require('./lib/journeys-station-to-poi')
|
||||
|
@ -72,7 +72,7 @@ const ettelbruck = '140701016'
|
|||
const mersch = '160904011'
|
||||
const luxembourg = '200405060'
|
||||
|
||||
test('journeys – Ettelbruck to Luxembourg', async (t) => {
|
||||
tap.test('journeys – Ettelbruck to Luxembourg', async (t) => {
|
||||
const res = await client.journeys(ettelbruck, luxembourg, {
|
||||
results: 4,
|
||||
departure: when,
|
||||
|
@ -91,7 +91,7 @@ test('journeys – Ettelbruck to Luxembourg', async (t) => {
|
|||
|
||||
// todo: journeys, only one product
|
||||
|
||||
test('journeys – fails with no product', (t) => {
|
||||
tap.test('journeys – fails with no product', (t) => {
|
||||
journeysFailsWithNoProduct({
|
||||
test: t,
|
||||
fetchJourneys: client.journeys,
|
||||
|
@ -103,7 +103,7 @@ test('journeys – fails with no product', (t) => {
|
|||
t.end()
|
||||
})
|
||||
|
||||
test('Luxembourg to Ettelbruck, Rue des Romains 4', async (t) => {
|
||||
tap.test('Luxembourg to Ettelbruck, Rue des Romains 4', async (t) => {
|
||||
const rueDeRomain = {
|
||||
type: 'location',
|
||||
address: 'Ettelbruck, Rue des Romains 4',
|
||||
|
@ -126,7 +126,7 @@ test('Luxembourg to Ettelbruck, Rue des Romains 4', async (t) => {
|
|||
t.end()
|
||||
})
|
||||
|
||||
test('Luxembourg to Centre Hospitalier du Nord', async (t) => {
|
||||
tap.test('Luxembourg to Centre Hospitalier du Nord', async (t) => {
|
||||
const centreHospitalier = {
|
||||
type: 'location',
|
||||
id: '140701020',
|
||||
|
@ -153,7 +153,7 @@ test('Luxembourg to Centre Hospitalier du Nord', async (t) => {
|
|||
// todo: journeys: via works – with detour
|
||||
// todo: without detour
|
||||
|
||||
test('earlier/later journeys', async (t) => {
|
||||
tap.test('earlier/later journeys', async (t) => {
|
||||
await testEarlierLaterJourneys({
|
||||
test: t,
|
||||
fetchJourneys: client.journeys,
|
||||
|
@ -166,7 +166,7 @@ test('earlier/later journeys', async (t) => {
|
|||
t.end()
|
||||
})
|
||||
|
||||
test('trip', async (t) => {
|
||||
tap.test('trip', async (t) => {
|
||||
const { journeys } = await client.journeys(luxembourg, ettelbruck, {
|
||||
results: 1, departure: when
|
||||
})
|
||||
|
@ -180,7 +180,7 @@ test('trip', async (t) => {
|
|||
t.end()
|
||||
})
|
||||
|
||||
test('departures at Ettelbruck.', async (t) => {
|
||||
tap.test('departures at Ettelbruck.', async (t) => {
|
||||
const departures = await client.departures(ettelbruck, {
|
||||
duration: 20, when
|
||||
})
|
||||
|
@ -194,7 +194,7 @@ test('departures at Ettelbruck.', async (t) => {
|
|||
t.end()
|
||||
})
|
||||
|
||||
test('arrivals at Ettelbruck.', async (t) => {
|
||||
tap.test('arrivals at Ettelbruck.', async (t) => {
|
||||
const arrivals = await client.arrivals(ettelbruck, {
|
||||
duration: 20, when
|
||||
})
|
||||
|
@ -208,7 +208,7 @@ test('arrivals at Ettelbruck.', async (t) => {
|
|||
t.end()
|
||||
})
|
||||
|
||||
test('departures with station object', async (t) => {
|
||||
tap.test('departures with station object', async (t) => {
|
||||
const deps = await client.departures({
|
||||
type: 'station',
|
||||
id: ettelbruck,
|
||||
|
@ -226,7 +226,7 @@ test('departures with station object', async (t) => {
|
|||
|
||||
// todo: nearby
|
||||
|
||||
test('locations named Mersch', async (t) => {
|
||||
tap.test('locations named Mersch', async (t) => {
|
||||
const locations = await client.locations('Mersch', {
|
||||
results: 20
|
||||
})
|
||||
|
@ -243,7 +243,7 @@ test('locations named Mersch', async (t) => {
|
|||
t.end()
|
||||
})
|
||||
|
||||
test('stop Mersch', async (t) => {
|
||||
tap.test('stop Mersch', async (t) => {
|
||||
const s = await client.stop(mersch)
|
||||
|
||||
validate(t, s, ['stop', 'station'], 'stop')
|
||||
|
@ -252,7 +252,7 @@ test('stop Mersch', async (t) => {
|
|||
t.end()
|
||||
})
|
||||
|
||||
test('radar', async (t) => {
|
||||
tap.test('radar', async (t) => {
|
||||
const vehicles = await client.radar({
|
||||
north: 49.9,
|
||||
west: 6.05,
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
'use strict'
|
||||
|
||||
const tap = require('tap')
|
||||
const isRoughlyEqual = require('is-roughly-equal')
|
||||
|
||||
const {createWhen} = require('./lib/util')
|
||||
|
@ -11,7 +12,6 @@ const {
|
|||
station: createValidateStation
|
||||
} = require('./lib/validators')
|
||||
const createValidate = require('./lib/validate-fptf-with')
|
||||
const {test} = require('./lib/util')
|
||||
const testJourneysStationToStation = require('./lib/journeys-station-to-station')
|
||||
const testJourneysStationToAddress = require('./lib/journeys-station-to-address')
|
||||
const testJourneysStationToPoi = require('./lib/journeys-station-to-poi')
|
||||
|
@ -73,7 +73,7 @@ const ellerbekerMarkt = '9049027'
|
|||
const seefischmarkt = '9049245'
|
||||
const kielRaeucherei = '9049217'
|
||||
|
||||
test('journeys – Kiel Hbf to Flensburg', async (t) => {
|
||||
tap.test('journeys – Kiel Hbf to Flensburg', async (t) => {
|
||||
const res = await client.journeys(kielHbf, flensburg, {
|
||||
results: 4,
|
||||
departure: when,
|
||||
|
@ -100,7 +100,7 @@ test('journeys – Kiel Hbf to Flensburg', async (t) => {
|
|||
|
||||
// todo: journeys, only one product
|
||||
|
||||
test('journeys – fails with no product', (t) => {
|
||||
tap.test('journeys – fails with no product', (t) => {
|
||||
journeysFailsWithNoProduct({
|
||||
test: t,
|
||||
fetchJourneys: client.journeys,
|
||||
|
@ -112,7 +112,7 @@ test('journeys – fails with no product', (t) => {
|
|||
t.end()
|
||||
})
|
||||
|
||||
test('Kiel Hbf to Berliner Str. 80, Husum', async (t) => {
|
||||
tap.test('Kiel Hbf to Berliner Str. 80, Husum', async (t) => {
|
||||
const berlinerStr = {
|
||||
type: 'location',
|
||||
address: 'Husum, Berliner Straße 80',
|
||||
|
@ -134,7 +134,7 @@ test('Kiel Hbf to Berliner Str. 80, Husum', async (t) => {
|
|||
t.end()
|
||||
})
|
||||
|
||||
test('Kiel Hbf to Holstentor', async (t) => {
|
||||
tap.test('Kiel Hbf to Holstentor', async (t) => {
|
||||
const holstentor = {
|
||||
type: 'location',
|
||||
id: '970003168',
|
||||
|
@ -158,7 +158,7 @@ test('Kiel Hbf to Holstentor', async (t) => {
|
|||
t.end()
|
||||
})
|
||||
|
||||
test('Husum to Lübeck Hbf with stopover at Kiel Hbf', async (t) => {
|
||||
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,
|
||||
|
@ -179,7 +179,7 @@ test('Husum to Lübeck Hbf with stopover at Kiel Hbf', async (t) => {
|
|||
t.end()
|
||||
})
|
||||
|
||||
test('earlier/later journeys, Kiel Hbf -> Flensburg', async (t) => {
|
||||
tap.test('earlier/later journeys, Kiel Hbf -> Flensburg', async (t) => {
|
||||
await testEarlierLaterJourneys({
|
||||
test: t,
|
||||
fetchJourneys: client.journeys,
|
||||
|
@ -192,7 +192,7 @@ test('earlier/later journeys, Kiel Hbf -> Flensburg', async (t) => {
|
|||
t.end()
|
||||
})
|
||||
|
||||
test('refreshJourney', async (t) => {
|
||||
tap.test('refreshJourney', async (t) => {
|
||||
await testRefreshJourney({
|
||||
test: t,
|
||||
fetchJourneys: client.journeys,
|
||||
|
@ -208,7 +208,7 @@ test('refreshJourney', async (t) => {
|
|||
// todo: with detour test
|
||||
// todo: without detour test
|
||||
|
||||
test('trip details', async (t) => {
|
||||
tap.test('trip details', async (t) => {
|
||||
const res = await client.journeys(flensburg, husum, {
|
||||
results: 1, departure: when
|
||||
})
|
||||
|
@ -222,7 +222,7 @@ test('trip details', async (t) => {
|
|||
t.end()
|
||||
})
|
||||
|
||||
test('departures at Kiel Räucherei', async (t) => {
|
||||
tap.test('departures at Kiel Räucherei', async (t) => {
|
||||
const departures = await client.departures(kielRaeucherei, {
|
||||
duration: 30, when,
|
||||
})
|
||||
|
@ -236,7 +236,7 @@ test('departures at Kiel Räucherei', async (t) => {
|
|||
t.end()
|
||||
})
|
||||
|
||||
test('departures with station object', async (t) => {
|
||||
tap.test('departures with station object', async (t) => {
|
||||
const deps = await client.departures({
|
||||
type: 'station',
|
||||
id: kielHbf,
|
||||
|
@ -252,7 +252,7 @@ test('departures with station object', async (t) => {
|
|||
t.end()
|
||||
})
|
||||
|
||||
test('departures at Berlin Hbf in direction of Berlin Ostbahnhof', async (t) => {
|
||||
tap.test('departures at Berlin Hbf in direction of Berlin Ostbahnhof', async (t) => {
|
||||
await testDeparturesInDirection({
|
||||
test: t,
|
||||
fetchDepartures: client.departures,
|
||||
|
@ -265,7 +265,7 @@ test('departures at Berlin Hbf in direction of Berlin Ostbahnhof', async (t) =>
|
|||
t.end()
|
||||
})
|
||||
|
||||
test('arrivals at Kiel Räucherei', async (t) => {
|
||||
tap.test('arrivals at Kiel Räucherei', async (t) => {
|
||||
const arrivals = await client.arrivals(kielRaeucherei, {
|
||||
duration: 30, when
|
||||
})
|
||||
|
@ -279,7 +279,7 @@ test('arrivals at Kiel Räucherei', async (t) => {
|
|||
t.end()
|
||||
})
|
||||
|
||||
test('nearby Kiel Hbf', async (t) => {
|
||||
tap.test('nearby Kiel Hbf', async (t) => {
|
||||
const kielHbfPosition = {
|
||||
type: 'location',
|
||||
latitude: 54.314982,
|
||||
|
@ -302,7 +302,7 @@ test('nearby Kiel Hbf', async (t) => {
|
|||
t.end()
|
||||
})
|
||||
|
||||
test('locations named "Kiel Rathaus"', async (t) => {
|
||||
tap.test('locations named "Kiel Rathaus"', async (t) => {
|
||||
const kielRathaus = '9049200'
|
||||
const locations = await client.locations('Kiel Rathaus', {
|
||||
results: 15
|
||||
|
@ -318,7 +318,7 @@ test('locations named "Kiel Rathaus"', async (t) => {
|
|||
t.end()
|
||||
})
|
||||
|
||||
test('stop', async (t) => {
|
||||
tap.test('stop', async (t) => {
|
||||
const s = await client.stop(kielHbf)
|
||||
|
||||
validate(t, s, ['stop', 'station'], 'stop')
|
||||
|
@ -327,7 +327,7 @@ test('stop', async (t) => {
|
|||
t.end()
|
||||
})
|
||||
|
||||
test('radar', async (t) => {
|
||||
tap.test('radar', async (t) => {
|
||||
const vehicles = await client.radar({
|
||||
north: 54.4,
|
||||
west: 10.0,
|
||||
|
@ -354,7 +354,7 @@ test('radar', async (t) => {
|
|||
t.end()
|
||||
})
|
||||
|
||||
test('reachableFrom', async (t) => {
|
||||
tap.test('reachableFrom', async (t) => {
|
||||
const berlinerStr = {
|
||||
type: 'location',
|
||||
address: 'Husum, Berliner Straße 80',
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
'use strict'
|
||||
|
||||
const tap = require('tap')
|
||||
const isRoughlyEqual = require('is-roughly-equal')
|
||||
|
||||
const {createWhen} = require('./lib/util')
|
||||
|
@ -7,7 +8,6 @@ const createClient = require('../..')
|
|||
const nvvProfile = require('../../p/nvv')
|
||||
const products = require('../../p/nvv/products')
|
||||
const createValidate = require('./lib/validate-fptf-with')
|
||||
const {test} = require('./lib/util')
|
||||
const testJourneysStationToStation = require('./lib/journeys-station-to-station')
|
||||
const journeysFailsWithNoProduct = require('./lib/journeys-fails-with-no-product')
|
||||
const testJourneysStationToAddress = require('./lib/journeys-station-to-address')
|
||||
|
@ -39,7 +39,7 @@ const auestadion = '2200042'
|
|||
const weigelstr = '2200056'
|
||||
const friedrichsplatz = '2200006'
|
||||
|
||||
test('journeys – Kassel Scheidemannplatz to Kassel Auestadion', async (t) => {
|
||||
tap.test('journeys – Kassel Scheidemannplatz to Kassel Auestadion', async (t) => {
|
||||
const res = await client.journeys(scheidemannplatz, auestadion, {
|
||||
results: 4,
|
||||
departure: when,
|
||||
|
@ -58,7 +58,7 @@ test('journeys – Kassel Scheidemannplatz to Kassel Auestadion', async (t) =>
|
|||
|
||||
// todo: journeys, only one product
|
||||
|
||||
test('journeys – fails with no product', (t) => {
|
||||
tap.test('journeys – fails with no product', (t) => {
|
||||
journeysFailsWithNoProduct({
|
||||
test: t,
|
||||
fetchJourneys: client.journeys,
|
||||
|
@ -70,7 +70,7 @@ test('journeys – fails with no product', (t) => {
|
|||
t.end()
|
||||
})
|
||||
|
||||
test('Kassel Scheidemannplatz to Heckerstraße 2', async (t) => {
|
||||
tap.test('Kassel Scheidemannplatz to Heckerstraße 2', async (t) => {
|
||||
const heckerstr2 = {
|
||||
type: 'location',
|
||||
id: '990100251',
|
||||
|
@ -94,7 +94,7 @@ test('Kassel Scheidemannplatz to Heckerstraße 2', async (t) => {
|
|||
t.end()
|
||||
})
|
||||
|
||||
test('Kassel Scheidemannplatz to Grimmwelt', async (t) => {
|
||||
tap.test('Kassel Scheidemannplatz to Grimmwelt', async (t) => {
|
||||
const grimmwelt = {
|
||||
type: 'location',
|
||||
id: '1500490',
|
||||
|
@ -118,7 +118,7 @@ test('Kassel Scheidemannplatz to Grimmwelt', async (t) => {
|
|||
t.end()
|
||||
})
|
||||
|
||||
test('journeys: via works – with detour', async (t) => {
|
||||
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'
|
||||
|
@ -141,7 +141,7 @@ test('journeys: via works – with detour', async (t) => {
|
|||
|
||||
// todo: without detour
|
||||
|
||||
test('earlier/later journeys', async (t) => {
|
||||
tap.test('earlier/later journeys', async (t) => {
|
||||
await testEarlierLaterJourneys({
|
||||
test: t,
|
||||
fetchJourneys: client.journeys,
|
||||
|
@ -154,7 +154,7 @@ test('earlier/later journeys', async (t) => {
|
|||
t.end()
|
||||
})
|
||||
|
||||
test('trip details', async (t) => {
|
||||
tap.test('trip details', async (t) => {
|
||||
const res = await client.journeys(scheidemannplatz, auestadion, {
|
||||
results: 1, departure: when
|
||||
})
|
||||
|
@ -168,7 +168,7 @@ test('trip details', async (t) => {
|
|||
t.end()
|
||||
})
|
||||
|
||||
test('departures at Kassel Auestadion.', async (t) => {
|
||||
tap.test('departures at Kassel Auestadion.', async (t) => {
|
||||
const departures = await client.departures(auestadion, {
|
||||
duration: 11, when,
|
||||
})
|
||||
|
@ -182,7 +182,7 @@ test('departures at Kassel Auestadion.', async (t) => {
|
|||
t.end()
|
||||
})
|
||||
|
||||
test('departures with station object', async (t) => {
|
||||
tap.test('departures with station object', async (t) => {
|
||||
const deps = await client.departures({
|
||||
type: 'station',
|
||||
id: auestadion,
|
||||
|
@ -198,7 +198,7 @@ test('departures with station object', async (t) => {
|
|||
t.end()
|
||||
})
|
||||
|
||||
test('departures at Auestadion in direction of Friedrichsplatz', async (t) => {
|
||||
tap.test('departures at Auestadion in direction of Friedrichsplatz', async (t) => {
|
||||
await testDeparturesInDirection({
|
||||
test: t,
|
||||
fetchDepartures: client.departures,
|
||||
|
@ -211,7 +211,7 @@ test('departures at Auestadion in direction of Friedrichsplatz', async (t) => {
|
|||
t.end()
|
||||
})
|
||||
|
||||
test('arrivals at Kassel Weigelstr.', async (t) => {
|
||||
tap.test('arrivals at Kassel Weigelstr.', async (t) => {
|
||||
const arrivals = await client.arrivals(weigelstr, {
|
||||
duration: 5, when
|
||||
})
|
||||
|
@ -227,7 +227,7 @@ test('arrivals at Kassel Weigelstr.', async (t) => {
|
|||
|
||||
// todo: nearby
|
||||
|
||||
test('locations named Auestadion', async (t) => {
|
||||
tap.test('locations named Auestadion', async (t) => {
|
||||
const locations = await client.locations('auestadion', {results: 10})
|
||||
|
||||
validate(t, locations, 'locations', 'locations')
|
||||
|
@ -240,7 +240,7 @@ test('locations named Auestadion', async (t) => {
|
|||
t.end()
|
||||
})
|
||||
|
||||
test('station Auestadion', async (t) => {
|
||||
tap.test('station Auestadion', async (t) => {
|
||||
const s = await client.stop(auestadion)
|
||||
|
||||
validate(t, s, ['stop', 'station'], 'station')
|
||||
|
@ -249,7 +249,7 @@ test('station Auestadion', async (t) => {
|
|||
t.end()
|
||||
})
|
||||
|
||||
test('radar', async (t) => {
|
||||
tap.test('radar', async (t) => {
|
||||
const vehicles = await client.radar({
|
||||
north: 51.320153,
|
||||
west: 9.458359,
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
'use strict'
|
||||
|
||||
const tap = require('tap')
|
||||
const isRoughlyEqual = require('is-roughly-equal')
|
||||
const validateLine = require('validate-fptf/line')
|
||||
|
||||
|
@ -12,7 +13,6 @@ const {
|
|||
stop: validateStop
|
||||
} = require('./lib/validators')
|
||||
const createValidate = require('./lib/validate-fptf-with')
|
||||
const {test} = require('./lib/util')
|
||||
const testJourneysStationToStation = require('./lib/journeys-station-to-station')
|
||||
const testJourneysStationToAddress = require('./lib/journeys-station-to-address')
|
||||
const testJourneysStationToPoi = require('./lib/journeys-station-to-poi')
|
||||
|
@ -62,7 +62,7 @@ const wienRenngasse = '1390186'
|
|||
const wienKarlsplatz = '1390461'
|
||||
const wienPilgramgasse = '1390562'
|
||||
|
||||
test('journeys – Salzburg Hbf to Wien Westbahnhof', async (t) => {
|
||||
tap.test('journeys – Salzburg Hbf to Wien Westbahnhof', async (t) => {
|
||||
const res = await client.journeys(salzburgHbf, wienFickeystr, {
|
||||
results: 4,
|
||||
departure: when,
|
||||
|
@ -87,7 +87,7 @@ test('journeys – Salzburg Hbf to Wien Westbahnhof', async (t) => {
|
|||
|
||||
// todo: journeys, only one product
|
||||
|
||||
test('journeys – fails with no product', (t) => {
|
||||
tap.test('journeys – fails with no product', (t) => {
|
||||
journeysFailsWithNoProduct({
|
||||
test: t,
|
||||
fetchJourneys: client.journeys,
|
||||
|
@ -99,7 +99,7 @@ test('journeys – fails with no product', (t) => {
|
|||
t.end()
|
||||
})
|
||||
|
||||
test('Salzburg Hbf to 1220 Wien, Fischerstrand 7', async (t) => {
|
||||
tap.test('Salzburg Hbf to 1220 Wien, Fischerstrand 7', async (t) => {
|
||||
const wagramerStr = {
|
||||
type: 'location',
|
||||
address: '1220 Wien, Fischerstrand 7',
|
||||
|
@ -121,7 +121,7 @@ test('Salzburg Hbf to 1220 Wien, Fischerstrand 7', async (t) => {
|
|||
t.end()
|
||||
})
|
||||
|
||||
test('Salzburg Hbf to Uni Wien', async (t) => {
|
||||
tap.test('Salzburg Hbf to Uni Wien', async (t) => {
|
||||
const uniWien = {
|
||||
type: 'location',
|
||||
id: '970076515',
|
||||
|
@ -144,7 +144,7 @@ test('Salzburg Hbf to Uni Wien', async (t) => {
|
|||
t.end()
|
||||
})
|
||||
|
||||
test('journeys: via works – with detour', async (t) => {
|
||||
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'
|
||||
|
@ -167,7 +167,7 @@ test('journeys: via works – with detour', async (t) => {
|
|||
t.end()
|
||||
})
|
||||
|
||||
test('journeys: via works – without detour', async (t) => {
|
||||
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'
|
||||
|
@ -202,7 +202,7 @@ test('journeys: via works – without detour', async (t) => {
|
|||
t.end()
|
||||
})
|
||||
|
||||
test('earlier/later journeys, Salzburg Hbf -> Wien Westbahnhof', async (t) => {
|
||||
tap.test('earlier/later journeys, Salzburg Hbf -> Wien Westbahnhof', async (t) => {
|
||||
await testEarlierLaterJourneys({
|
||||
test: t,
|
||||
fetchJourneys: client.journeys,
|
||||
|
@ -215,7 +215,7 @@ test('earlier/later journeys, Salzburg Hbf -> Wien Westbahnhof', async (t) => {
|
|||
t.end()
|
||||
})
|
||||
|
||||
test('refreshJourney', async (t) => {
|
||||
tap.test('refreshJourney', async (t) => {
|
||||
await testRefreshJourney({
|
||||
test: t,
|
||||
fetchJourneys: client.journeys,
|
||||
|
@ -228,7 +228,7 @@ test('refreshJourney', async (t) => {
|
|||
t.end()
|
||||
})
|
||||
|
||||
test('trip details', async (t) => {
|
||||
tap.test('trip details', async (t) => {
|
||||
const res = await client.journeys(wienWestbahnhof, muenchenHbf, {
|
||||
results: 1, departure: when
|
||||
})
|
||||
|
@ -242,7 +242,7 @@ test('trip details', async (t) => {
|
|||
t.end()
|
||||
})
|
||||
|
||||
test('departures at Wien Leibenfrostgasse', async (t) => {
|
||||
tap.test('departures at Wien Leibenfrostgasse', async (t) => {
|
||||
const wienLeibenfrostgasse = '1390469'
|
||||
const ids = [
|
||||
wienLeibenfrostgasse, // station
|
||||
|
@ -257,7 +257,7 @@ test('departures at Wien Leibenfrostgasse', async (t) => {
|
|||
validate(t, deps, 'departures', 'departures')
|
||||
t.ok(deps.length > 0, 'must be >0 departures')
|
||||
// todo: move into deps validator
|
||||
t.deepEqual(deps, deps.sort((a, b) => t.when > b.when))
|
||||
t.same(deps, deps.sort((a, b) => t.when > b.when))
|
||||
|
||||
for (let i = 0; i < deps.length; i++) {
|
||||
const dep = deps[i]
|
||||
|
@ -267,7 +267,7 @@ test('departures at Wien Leibenfrostgasse', async (t) => {
|
|||
t.end()
|
||||
})
|
||||
|
||||
test('departures with station object', async (t) => {
|
||||
tap.test('departures with station object', async (t) => {
|
||||
const deps = await client.departures({
|
||||
type: 'station',
|
||||
id: salzburgHbf,
|
||||
|
@ -283,7 +283,7 @@ test('departures with station object', async (t) => {
|
|||
t.end()
|
||||
})
|
||||
|
||||
test('departures at Karlsplatz in direction of Pilgramgasse', async (t) => {
|
||||
tap.test('departures at Karlsplatz in direction of Pilgramgasse', async (t) => {
|
||||
const subStops = (await client.stop(wienPilgramgasse, {
|
||||
subStops: true, entrances: false,
|
||||
})).stops || []
|
||||
|
@ -302,7 +302,7 @@ test('departures at Karlsplatz in direction of Pilgramgasse', async (t) => {
|
|||
|
||||
// todo: arrivals
|
||||
|
||||
test('nearby Salzburg Hbf', async (t) => {
|
||||
tap.test('nearby Salzburg Hbf', async (t) => {
|
||||
const nearby = await client.nearby({
|
||||
type: 'location',
|
||||
longitude: 13.045604,
|
||||
|
@ -325,7 +325,7 @@ test('nearby Salzburg Hbf', async (t) => {
|
|||
t.end()
|
||||
})
|
||||
|
||||
test('locations named Salzburg', async (t) => {
|
||||
tap.test('locations named Salzburg', async (t) => {
|
||||
const salzburgVolksgarten = '591161'
|
||||
const locations = await client.locations('Salzburg volksgarten', {
|
||||
results: 20
|
||||
|
@ -343,7 +343,7 @@ test('locations named Salzburg', async (t) => {
|
|||
t.end()
|
||||
})
|
||||
|
||||
test('stop', async (t) => {
|
||||
tap.test('stop', async (t) => {
|
||||
const loc = await client.stop(wienRenngasse)
|
||||
|
||||
// todo: find a way to always get products from the API
|
||||
|
@ -367,7 +367,7 @@ test('stop', async (t) => {
|
|||
t.end()
|
||||
})
|
||||
|
||||
test('radar Salzburg', async (t) => {
|
||||
tap.test('radar Salzburg', async (t) => {
|
||||
let vehicles = await client.radar({
|
||||
north: 47.827203,
|
||||
west: 13.001261,
|
||||
|
|
|
@ -1,5 +1,7 @@
|
|||
'use strict'
|
||||
|
||||
const tap = require('tap')
|
||||
|
||||
const { createWhen } = require('./lib/util')
|
||||
const createClient = require('../..')
|
||||
const pkpProfile = require('../../p/pkp')
|
||||
|
@ -10,7 +12,6 @@ const {
|
|||
movement: _validateMovement
|
||||
} = require('./lib/validators')
|
||||
const createValidate = require('./lib/validate-fptf-with')
|
||||
const {test} = require('./lib/util')
|
||||
const testJourneysStationToStation = require('./lib/journeys-station-to-station')
|
||||
const testArrivals = require('./lib/arrivals')
|
||||
const testReachableFrom = require('./lib/reachable-from')
|
||||
|
@ -69,7 +70,7 @@ const filharmonia = {
|
|||
poi: true
|
||||
}
|
||||
|
||||
test.skip('journeys – Wrocław Główny to Kraków Główny', async (t) => {
|
||||
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,
|
||||
|
@ -89,7 +90,7 @@ test.skip('journeys – Wrocław Główny to Kraków Główny', async (t) => {
|
|||
// todo: via works – with detour
|
||||
// todo: without detour
|
||||
|
||||
test.skip('trip details', async (t) => {
|
||||
tap.skip('trip details', async (t) => {
|
||||
const res = await client.journeys(wrocławGł, krakówGł, {
|
||||
results: 1, departure: when
|
||||
})
|
||||
|
@ -103,7 +104,7 @@ test.skip('trip details', async (t) => {
|
|||
t.end()
|
||||
})
|
||||
|
||||
test.skip('arrivals at Kraków Główny', async (t) => {
|
||||
tap.skip('arrivals at Kraków Główny', async (t) => {
|
||||
const arrivals = await client.arrivals(krakówGł, {
|
||||
duration: 10, when
|
||||
})
|
||||
|
@ -116,7 +117,7 @@ test.skip('arrivals at Kraków Główny', async (t) => {
|
|||
t.end()
|
||||
})
|
||||
|
||||
test.skip('nearby', async (t) => {
|
||||
tap.skip('nearby', async (t) => {
|
||||
const nearby = await client.nearby(dworcowa100, { distance: 500 })
|
||||
|
||||
validate(t, nearby, 'locations', 'nearby')
|
||||
|
@ -127,7 +128,7 @@ test.skip('nearby', async (t) => {
|
|||
t.end()
|
||||
})
|
||||
|
||||
test.skip('radar', async (t) => {
|
||||
tap.skip('radar', async (t) => {
|
||||
const vehicles = await client.radar({
|
||||
north: 48.74453,
|
||||
west: 11.42733,
|
||||
|
@ -141,7 +142,7 @@ test.skip('radar', async (t) => {
|
|||
t.end()
|
||||
})
|
||||
|
||||
test.skip('reachableFrom', async (t) => {
|
||||
tap.skip('reachableFrom', async (t) => {
|
||||
await testReachableFrom({
|
||||
test: t,
|
||||
reachableFrom: client.reachableFrom,
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
'use strict'
|
||||
|
||||
const tap = require('tap')
|
||||
const assert = require('assert')
|
||||
|
||||
const {createWhen} = require('./lib/util')
|
||||
|
@ -7,7 +8,6 @@ const createClient = require('../..')
|
|||
const rejseplanenProfile = require('../../p/rejseplanen')
|
||||
const products = require('../../p/rejseplanen/products')
|
||||
const createValidate = require('./lib/validate-fptf-with')
|
||||
const {test} = require('./lib/util')
|
||||
const testJourneysStationToStation = require('./lib/journeys-station-to-station')
|
||||
const journeysFailsWithNoProduct = require('./lib/journeys-fails-with-no-product')
|
||||
const testJourneysStationToAddress = require('./lib/journeys-station-to-address')
|
||||
|
@ -32,7 +32,7 @@ const næstved = '8600810'
|
|||
const randers = '8600040'
|
||||
const aalborg = '8600020'
|
||||
|
||||
test('journeys – Næstved to Aalborg', async (t) => {
|
||||
tap.test('journeys – Næstved to Aalborg', async (t) => {
|
||||
const res = await client.journeys(næstved, aalborg, {
|
||||
results: 4,
|
||||
departure: when,
|
||||
|
@ -51,7 +51,7 @@ test('journeys – Næstved to Aalborg', async (t) => {
|
|||
|
||||
// todo: journeys, only one product
|
||||
|
||||
test('journeys – fails with no product', (t) => {
|
||||
tap.test('journeys – fails with no product', (t) => {
|
||||
journeysFailsWithNoProduct({
|
||||
test: t,
|
||||
fetchJourneys: client.journeys,
|
||||
|
@ -63,7 +63,7 @@ test('journeys – fails with no product', (t) => {
|
|||
t.end()
|
||||
})
|
||||
|
||||
test('Randers to Møllegade 3, København', async (t) => {
|
||||
tap.test('Randers to Møllegade 3, København', async (t) => {
|
||||
const møllegade3 = {
|
||||
type: 'location',
|
||||
id: '901011579',
|
||||
|
@ -89,7 +89,7 @@ test('Randers to Møllegade 3, København', async (t) => {
|
|||
// todo: journeys: via works – with detour
|
||||
// todo: without detour
|
||||
|
||||
test('earlier/later journeys', async (t) => {
|
||||
tap.test('earlier/later journeys', async (t) => {
|
||||
await testEarlierLaterJourneys({
|
||||
test: t,
|
||||
fetchJourneys: client.journeys,
|
||||
|
@ -102,7 +102,7 @@ test('earlier/later journeys', async (t) => {
|
|||
t.end()
|
||||
})
|
||||
|
||||
test('trip', async (t) => {
|
||||
tap.test('trip', async (t) => {
|
||||
const { journeys } = await client.journeys(aalborg, næstved, {
|
||||
results: 1, departure: when,
|
||||
})
|
||||
|
@ -116,7 +116,7 @@ test('trip', async (t) => {
|
|||
t.end()
|
||||
})
|
||||
|
||||
test('departures at Næstved.', async (t) => {
|
||||
tap.test('departures at Næstved.', async (t) => {
|
||||
const departures = await client.departures(næstved, {
|
||||
duration: 20, when,
|
||||
})
|
||||
|
@ -130,7 +130,7 @@ test('departures at Næstved.', async (t) => {
|
|||
t.end()
|
||||
})
|
||||
|
||||
test('arrivals at Næstved.', async (t) => {
|
||||
tap.test('arrivals at Næstved.', async (t) => {
|
||||
const arrivals = await client.arrivals(næstved, {
|
||||
duration: 20, when
|
||||
})
|
||||
|
@ -146,7 +146,7 @@ test('arrivals at Næstved.', async (t) => {
|
|||
|
||||
// todo: nearby
|
||||
|
||||
test('locations named "næstved"', async (t) => {
|
||||
tap.test('locations named "næstved"', async (t) => {
|
||||
const locations = await client.locations('næstved', {
|
||||
results: 20,
|
||||
})
|
||||
|
@ -164,7 +164,7 @@ test('locations named "næstved"', async (t) => {
|
|||
t.end()
|
||||
})
|
||||
|
||||
test('stop Næstved', async (t) => {
|
||||
tap.test('stop Næstved', async (t) => {
|
||||
const s = await client.stop(næstved)
|
||||
|
||||
validate(t, s, ['stop', 'station'], 'stop')
|
||||
|
@ -173,7 +173,7 @@ test('stop Næstved', async (t) => {
|
|||
t.end()
|
||||
})
|
||||
|
||||
test('radar', async (t) => {
|
||||
tap.test('radar', async (t) => {
|
||||
const vehicles = await client.radar({
|
||||
north: 55.695,
|
||||
west: 12.498,
|
||||
|
|
|
@ -1,11 +1,12 @@
|
|||
'use strict'
|
||||
|
||||
const tap = require('tap')
|
||||
|
||||
const {createWhen} = require('./lib/util')
|
||||
const createClient = require('../..')
|
||||
const rmvProfile = require('../../p/rmv')
|
||||
const products = require('../../p/rmv/products')
|
||||
const createValidate = require('./lib/validate-fptf-with')
|
||||
const {test} = require('./lib/util')
|
||||
const testJourneysStationToStation = require('./lib/journeys-station-to-station')
|
||||
const testRefreshJourney = require('./lib/refresh-journey')
|
||||
const testArrivals = require('./lib/arrivals')
|
||||
|
@ -30,7 +31,7 @@ const client = createClient(rmvProfile, 'public-transport/hafas-client:test')
|
|||
const frankfurtOstendstr = '3000525'
|
||||
const wiesbadenHbf = '3006907'
|
||||
|
||||
test('journeys – Frankfurt Ostendstr. to Wiesbaden Hbf', async (t) => {
|
||||
tap.test('journeys – Frankfurt Ostendstr. to Wiesbaden Hbf', async (t) => {
|
||||
const res = await client.journeys(frankfurtOstendstr, wiesbadenHbf, {
|
||||
results: 4,
|
||||
departure: when,
|
||||
|
@ -50,7 +51,7 @@ test('journeys – Frankfurt Ostendstr. to Wiesbaden Hbf', async (t) => {
|
|||
// todo: via works – with detour
|
||||
// todo: without detour
|
||||
|
||||
test('trip details', async (t) => {
|
||||
tap.test('trip details', async (t) => {
|
||||
const res = await client.journeys(frankfurtOstendstr, wiesbadenHbf, {
|
||||
results: 1, departure: when
|
||||
})
|
||||
|
@ -64,20 +65,20 @@ test('trip details', async (t) => {
|
|||
t.end()
|
||||
})
|
||||
|
||||
test('arrivals at Wiesbaden Hbf', async (t) => {
|
||||
tap.test('arrivals at Wiesbaden Hbf', async (t) => {
|
||||
const arrivals = await client.arrivals(wiesbadenHbf, {
|
||||
duration: 10, when
|
||||
})
|
||||
|
||||
validate(t, arrivals, 'arrivals', 'arrivals')
|
||||
t.ok(arrivals.length > 0, 'must be >0 arrivals')
|
||||
t.deepEqual(arrivals, arrivals.sort((a, b) => t.when > b.when))
|
||||
t.same(arrivals, arrivals.sort((a, b) => t.when > b.when))
|
||||
t.end()
|
||||
})
|
||||
|
||||
// todo: nearby
|
||||
|
||||
test.skip('radar', async (t) => {
|
||||
tap.skip('radar', async (t) => {
|
||||
const vehicles = await client.radar({
|
||||
north: 53.090516,
|
||||
west: 8.750106,
|
||||
|
@ -91,7 +92,7 @@ test.skip('radar', async (t) => {
|
|||
t.end()
|
||||
})
|
||||
|
||||
test('reachableFrom', async (t) => {
|
||||
tap.test('reachableFrom', async (t) => {
|
||||
await testReachableFrom({
|
||||
test: t,
|
||||
reachableFrom: client.reachableFrom,
|
||||
|
|
|
@ -1,11 +1,12 @@
|
|||
'use strict'
|
||||
|
||||
const tap = require('tap')
|
||||
|
||||
const {createWhen} = require('./lib/util')
|
||||
const createClient = require('../..')
|
||||
const rsagProfile = require('../../p/rsag')
|
||||
const products = require('../../p/rsag/products')
|
||||
const createValidate = require('./lib/validate-fptf-with')
|
||||
const {test} = require('./lib/util')
|
||||
const testJourneysStationToStation = require('./lib/journeys-station-to-station')
|
||||
const testEarlierLaterJourneys = require('./lib/earlier-later-journeys')
|
||||
const testRefreshJourney = require('./lib/refresh-journey')
|
||||
|
@ -32,7 +33,7 @@ const sternwarte = '704956'
|
|||
const sternwarte2 = '708539'
|
||||
const weißesKreuz = '708573'
|
||||
|
||||
test('journeys – Platz der Jugend to Weißes Kreuz', async (t) => {
|
||||
tap.test('journeys – Platz der Jugend to Weißes Kreuz', async (t) => {
|
||||
const res = await client.journeys(sternwarte, weißesKreuz, {
|
||||
results: 4,
|
||||
departure: when,
|
||||
|
@ -52,7 +53,7 @@ test('journeys – Platz der Jugend to Weißes Kreuz', async (t) => {
|
|||
// todo: journeys, walkingSpeed
|
||||
// todo: via works – with detour
|
||||
|
||||
test('earlier/later journeys', async (t) => {
|
||||
tap.test('earlier/later journeys', async (t) => {
|
||||
await testEarlierLaterJourneys({
|
||||
test: t,
|
||||
fetchJourneys: client.journeys,
|
||||
|
@ -65,7 +66,7 @@ test('earlier/later journeys', async (t) => {
|
|||
t.end()
|
||||
})
|
||||
|
||||
test('refreshJourney', async (t) => {
|
||||
tap.test('refreshJourney', async (t) => {
|
||||
await testRefreshJourney({
|
||||
test: t,
|
||||
fetchJourneys: client.journeys,
|
||||
|
@ -78,20 +79,20 @@ test('refreshJourney', async (t) => {
|
|||
t.end()
|
||||
})
|
||||
|
||||
test('arrivals at Platz der Jugend', async (t) => {
|
||||
tap.test('arrivals at Platz der Jugend', async (t) => {
|
||||
const arrivals = await client.arrivals(sternwarte, {
|
||||
duration: 30, when
|
||||
})
|
||||
|
||||
validate(t, arrivals, 'arrivals', 'arrivals')
|
||||
t.ok(arrivals.length > 0, 'must be >0 arrivals')
|
||||
t.deepEqual(arrivals, arrivals.sort((a, b) => t.when > b.when))
|
||||
t.same(arrivals, arrivals.sort((a, b) => t.when > b.when))
|
||||
t.end()
|
||||
})
|
||||
|
||||
// todo: nearby
|
||||
|
||||
test('radar', async (t) => {
|
||||
tap.test('radar', async (t) => {
|
||||
const vehicles = await client.radar({
|
||||
north: 54.116968,
|
||||
west: 12.029738,
|
||||
|
@ -105,7 +106,7 @@ test('radar', async (t) => {
|
|||
t.end()
|
||||
})
|
||||
|
||||
test('reachableFrom', async (t) => {
|
||||
tap.test('reachableFrom', async (t) => {
|
||||
await testReachableFrom({
|
||||
test: t,
|
||||
reachableFrom: client.reachableFrom,
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
'use strict'
|
||||
|
||||
const tap = require('tap')
|
||||
const isRoughlyEqual = require('is-roughly-equal')
|
||||
|
||||
const { createWhen } = require('./lib/util')
|
||||
|
@ -11,7 +12,6 @@ const {
|
|||
stop: validateStop
|
||||
} = require('./lib/validators')
|
||||
const createValidate = require('./lib/validate-fptf-with')
|
||||
const {test} = require('./lib/util')
|
||||
const testJourneysStationToStation = require('./lib/journeys-station-to-station')
|
||||
const testJourneysStationToAddress = require('./lib/journeys-station-to-address')
|
||||
const testJourneysStationToPoi = require('./lib/journeys-station-to-poi')
|
||||
|
@ -69,7 +69,7 @@ const thomasMannStr = {
|
|||
// @todo prices/tickets
|
||||
// @todo journeys, only one product
|
||||
|
||||
test('journeys – fails with no product', (t) => {
|
||||
tap.test('journeys – fails with no product', (t) => {
|
||||
journeysFailsWithNoProduct({
|
||||
test: t,
|
||||
fetchJourneys: client.journeys,
|
||||
|
@ -81,7 +81,7 @@ test('journeys – fails with no product', (t) => {
|
|||
t.end()
|
||||
})
|
||||
|
||||
test('Saarbrücken Hbf to Neunkirchen, Thomas-Mann-Straße 1', async (t) => {
|
||||
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
|
||||
|
@ -97,7 +97,7 @@ test('Saarbrücken Hbf to Neunkirchen, Thomas-Mann-Straße 1', async (t) => {
|
|||
t.end()
|
||||
})
|
||||
|
||||
test('Saarbrücken Hbf to Schlossberghöhlen', async (t) => {
|
||||
tap.test('Saarbrücken Hbf to Schlossberghöhlen', async (t) => {
|
||||
const schlossberghoehlen = {
|
||||
type: 'location',
|
||||
id: '9000185',
|
||||
|
@ -120,7 +120,7 @@ test('Saarbrücken Hbf to Schlossberghöhlen', async (t) => {
|
|||
t.end()
|
||||
})
|
||||
|
||||
test.skip('journeys: via works – with detour', async (t) => {
|
||||
tap.skip('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'
|
||||
|
@ -145,7 +145,7 @@ test.skip('journeys: via works – with detour', async (t) => {
|
|||
|
||||
// todo: journeys: via works – without detour
|
||||
|
||||
test('earlier/later journeys, Saarbrücken Hbf -> Saarlouis Hbf', async (t) => {
|
||||
tap.test('earlier/later journeys, Saarbrücken Hbf -> Saarlouis Hbf', async (t) => {
|
||||
await testEarlierLaterJourneys({
|
||||
test: t,
|
||||
fetchJourneys: client.journeys,
|
||||
|
@ -158,7 +158,7 @@ test('earlier/later journeys, Saarbrücken Hbf -> Saarlouis Hbf', async (t) => {
|
|||
t.end()
|
||||
})
|
||||
|
||||
test('trip details', async (t) => {
|
||||
tap.test('trip details', async (t) => {
|
||||
const res = await client.journeys(saarlouisHbf, metzVille, {
|
||||
results: 1, departure: when
|
||||
})
|
||||
|
@ -172,7 +172,7 @@ test('trip details', async (t) => {
|
|||
t.end()
|
||||
})
|
||||
|
||||
test('departures', async (t) => {
|
||||
tap.test('departures', async (t) => {
|
||||
const departures = await client.departures(saarbrueckenUhlandstr, {
|
||||
duration: 5, when
|
||||
})
|
||||
|
@ -191,11 +191,11 @@ test('departures', async (t) => {
|
|||
}
|
||||
|
||||
// todo: move into deps validator
|
||||
t.deepEqual(departures, departures.sort((a, b) => t.when > b.when))
|
||||
t.same(departures, departures.sort((a, b) => t.when > b.when))
|
||||
t.end()
|
||||
})
|
||||
|
||||
test('departures with stop object', async (t) => {
|
||||
tap.test('departures with stop object', async (t) => {
|
||||
const deps = await client.departures({
|
||||
type: 'stop',
|
||||
id: '8000323',
|
||||
|
@ -211,7 +211,7 @@ test('departures with stop object', async (t) => {
|
|||
t.end()
|
||||
})
|
||||
|
||||
test('departures at Uhlandstr., Saarbrücken in direction of Landwehrplatz', async (t) => {
|
||||
tap.test('departures at Uhlandstr., Saarbrücken in direction of Landwehrplatz', async (t) => {
|
||||
const saarbrueckenLandwehrplatz = '10606'
|
||||
await testDeparturesInDirection({
|
||||
test: t,
|
||||
|
@ -227,7 +227,7 @@ test('departures at Uhlandstr., Saarbrücken in direction of Landwehrplatz', asy
|
|||
|
||||
// todo: arrivals
|
||||
|
||||
test('nearby Saarbrücken Hbf', async (t) => {
|
||||
tap.test('nearby Saarbrücken Hbf', async (t) => {
|
||||
const nearby = await client.nearby({
|
||||
type: 'location',
|
||||
latitude: 49.241066,
|
||||
|
@ -250,7 +250,7 @@ test('nearby Saarbrücken Hbf', async (t) => {
|
|||
t.end()
|
||||
})
|
||||
|
||||
test('locations named Saarbrücken', async (t) => {
|
||||
tap.test('locations named Saarbrücken', async (t) => {
|
||||
const aufDerWerthBürgerpark = '10204'
|
||||
const locations = await client.locations('bürgerpark', {
|
||||
results: 20
|
||||
|
@ -268,7 +268,7 @@ test('locations named Saarbrücken', async (t) => {
|
|||
t.end()
|
||||
})
|
||||
|
||||
test('stop', async (t) => {
|
||||
tap.test('stop', async (t) => {
|
||||
const s = await client.stop(saarbrueckenUhlandstr)
|
||||
|
||||
validate(t, s, ['stop', 'station'], 'stop')
|
||||
|
@ -277,7 +277,7 @@ test('stop', async (t) => {
|
|||
t.end()
|
||||
})
|
||||
|
||||
test('radar', async (t) => {
|
||||
tap.test('radar', async (t) => {
|
||||
const vehicles = await client.radar({
|
||||
north: 49.27,
|
||||
west: 6.97,
|
||||
|
|
|
@ -1,12 +1,13 @@
|
|||
'use strict'
|
||||
|
||||
const tap = require('tap')
|
||||
|
||||
const {createWhen} = require('./lib/util')
|
||||
const createClient = require('../..')
|
||||
const sMunichProfile = require('../../p/sbahn-muenchen')
|
||||
const products = require('../../p/sbahn-muenchen/products')
|
||||
const {movement: _validateMovement} = require('./lib/validators')
|
||||
const createValidate = require('./lib/validate-fptf-with')
|
||||
const {test} = require('./lib/util')
|
||||
const testJourneysStationToStation = require('./lib/journeys-station-to-station')
|
||||
const testJourneysStationToAddress = require('./lib/journeys-station-to-address')
|
||||
const testJourneysStationToPoi = require('./lib/journeys-station-to-poi')
|
||||
|
@ -59,7 +60,7 @@ const poetschnerstr = {
|
|||
longitude: 11.531695
|
||||
}
|
||||
|
||||
test('journeys – Mittersendling to Karl-Theodor-Straße', async (t) => {
|
||||
tap.test('journeys – Mittersendling to Karl-Theodor-Straße', async (t) => {
|
||||
const res = await client.journeys(mittersendling, karlTheodorStr, {
|
||||
results: 4,
|
||||
departure: when,
|
||||
|
@ -78,7 +79,7 @@ test('journeys – Mittersendling to Karl-Theodor-Straße', async (t) => {
|
|||
|
||||
// todo: journeys, only one product
|
||||
|
||||
test('journeys – fails with no product', (t) => {
|
||||
tap.test('journeys – fails with no product', (t) => {
|
||||
journeysFailsWithNoProduct({
|
||||
test: t,
|
||||
fetchJourneys: client.journeys,
|
||||
|
@ -90,7 +91,7 @@ test('journeys – fails with no product', (t) => {
|
|||
t.end()
|
||||
})
|
||||
|
||||
test('Karl-Theodor-Straße to Pötschnerstraße 3, Neuhausen', async (t) => {
|
||||
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
|
||||
|
@ -106,7 +107,7 @@ test('Karl-Theodor-Straße to Pötschnerstraße 3, Neuhausen', async (t) => {
|
|||
t.end()
|
||||
})
|
||||
|
||||
test('Karl-Theodor-Straße to Hofbräuhaus', async (t) => {
|
||||
tap.test('Karl-Theodor-Straße to Hofbräuhaus', async (t) => {
|
||||
const hofbraeuhaus = {
|
||||
type: 'location',
|
||||
id: '970006201',
|
||||
|
@ -134,7 +135,7 @@ test('Karl-Theodor-Straße to Hofbräuhaus', async (t) => {
|
|||
// todo: via works – with detour
|
||||
// todo: without detour
|
||||
|
||||
test('earlier/later journeys', async (t) => {
|
||||
tap.test('earlier/later journeys', async (t) => {
|
||||
await testEarlierLaterJourneys({
|
||||
test: t,
|
||||
fetchJourneys: client.journeys,
|
||||
|
@ -147,7 +148,7 @@ test('earlier/later journeys', async (t) => {
|
|||
t.end()
|
||||
})
|
||||
|
||||
test('refreshJourney', async (t) => {
|
||||
tap.test('refreshJourney', async (t) => {
|
||||
await testRefreshJourney({
|
||||
test: t,
|
||||
fetchJourneys: client.journeys,
|
||||
|
@ -160,7 +161,7 @@ test('refreshJourney', async (t) => {
|
|||
t.end()
|
||||
})
|
||||
|
||||
test('trip details', async (t) => {
|
||||
tap.test('trip details', async (t) => {
|
||||
const res = await client.journeys(mittersendling, karlTheodorStr, {
|
||||
results: 1, departure: when
|
||||
})
|
||||
|
@ -174,7 +175,7 @@ test('trip details', async (t) => {
|
|||
t.end()
|
||||
})
|
||||
|
||||
test('departures at Dietlindenstraße', async (t) => {
|
||||
tap.test('departures at Dietlindenstraße', async (t) => {
|
||||
const dietlindenstr = '624391'
|
||||
const departures = await client.departures(dietlindenstr, {
|
||||
duration: 10, when,
|
||||
|
@ -189,7 +190,7 @@ test('departures at Dietlindenstraße', async (t) => {
|
|||
t.end()
|
||||
})
|
||||
|
||||
test('departures with station object', async (t) => {
|
||||
tap.test('departures with station object', async (t) => {
|
||||
const deps = await client.departures({
|
||||
type: 'station',
|
||||
id: mittersendling,
|
||||
|
@ -205,7 +206,7 @@ test('departures with station object', async (t) => {
|
|||
t.end()
|
||||
})
|
||||
|
||||
test('arrivals at Karl-Theodor-Straße', async (t) => {
|
||||
tap.test('arrivals at Karl-Theodor-Straße', async (t) => {
|
||||
const arrivals = await client.arrivals(karlTheodorStr, {
|
||||
duration: 10, when,
|
||||
})
|
||||
|
@ -221,7 +222,7 @@ test('arrivals at Karl-Theodor-Straße', async (t) => {
|
|||
|
||||
// todo: nearby
|
||||
|
||||
test('locations named "Nationaltheater"', async (t) => {
|
||||
tap.test('locations named "Nationaltheater"', async (t) => {
|
||||
const nationaltheater = '624639'
|
||||
const locations = await client.locations('Nationaltheater', {
|
||||
results: 10
|
||||
|
@ -239,7 +240,7 @@ test('locations named "Nationaltheater"', async (t) => {
|
|||
t.end()
|
||||
})
|
||||
|
||||
test('station Karl-Theodor-Straße', async (t) => {
|
||||
tap.test('station Karl-Theodor-Straße', async (t) => {
|
||||
const s = await client.stop(karlTheodorStr)
|
||||
|
||||
validate(t, s, ['stop', 'station'], 'station')
|
||||
|
@ -248,7 +249,7 @@ test('station Karl-Theodor-Straße', async (t) => {
|
|||
t.end()
|
||||
})
|
||||
|
||||
test('radar', async (t) => {
|
||||
tap.test('radar', async (t) => {
|
||||
const vehicles = await client.radar({
|
||||
north: 48.145121,
|
||||
west: 11.543736,
|
||||
|
@ -262,7 +263,7 @@ test('radar', async (t) => {
|
|||
t.end()
|
||||
})
|
||||
|
||||
test('reachableFrom', async (t) => {
|
||||
tap.test('reachableFrom', async (t) => {
|
||||
await testReachableFrom({
|
||||
test: t,
|
||||
reachableFrom: client.reachableFrom,
|
||||
|
|
|
@ -1,11 +1,12 @@
|
|||
'use strict'
|
||||
|
||||
const tap = require('tap')
|
||||
|
||||
const {createWhen} = require('./lib/util')
|
||||
const createClient = require('../..')
|
||||
const sbbProfile = require('../../p/sbb')
|
||||
const products = require('../../p/sbb/products')
|
||||
const createValidate = require('./lib/validate-fptf-with')
|
||||
const {test} = require('./lib/util')
|
||||
const testJourneysStationToStation = require('./lib/journeys-station-to-station')
|
||||
const testJourneysStationToAddress = require('./lib/journeys-station-to-address')
|
||||
const testJourneysStationToPoi = require('./lib/journeys-station-to-poi')
|
||||
|
@ -41,7 +42,7 @@ const oetwilAmSee = {
|
|||
latitude: 47.278873, longitude: 8.726485,
|
||||
}
|
||||
|
||||
test('journeys – Basel to Lausanne', async (t) => {
|
||||
tap.test('journeys – Basel to Lausanne', async (t) => {
|
||||
const res = await client.journeys(basel, lausanne, {
|
||||
results: 4,
|
||||
departure: when,
|
||||
|
@ -58,7 +59,7 @@ test('journeys – Basel to Lausanne', async (t) => {
|
|||
t.end()
|
||||
})
|
||||
|
||||
test('Lausanne to 8618 Oetwil am See, Morgental', async (t) => {
|
||||
tap.test('Lausanne to 8618 Oetwil am See, Morgental', async (t) => {
|
||||
const res = await client.journeys(lausanne, oetwilAmSee, {
|
||||
results: 3,
|
||||
departure: when,
|
||||
|
@ -74,7 +75,7 @@ test('Lausanne to 8618 Oetwil am See, Morgental', async (t) => {
|
|||
t.end()
|
||||
})
|
||||
|
||||
test('Lausanne to ETH Institut für Pflanzenwissenschaften', async (t) => {
|
||||
tap.test('Lausanne to ETH Institut für Pflanzenwissenschaften', async (t) => {
|
||||
const ethPflanzenwissenschaften = {
|
||||
type: 'location',
|
||||
id: '980008611',
|
||||
|
@ -99,7 +100,7 @@ test('Lausanne to ETH Institut für Pflanzenwissenschaften', async (t) => {
|
|||
|
||||
// todo: via works – with detour
|
||||
|
||||
test('earlier/later journeys', async (t) => {
|
||||
tap.test('earlier/later journeys', async (t) => {
|
||||
await testEarlierLaterJourneys({
|
||||
test: t,
|
||||
fetchJourneys: client.journeys,
|
||||
|
@ -112,7 +113,7 @@ test('earlier/later journeys', async (t) => {
|
|||
t.end()
|
||||
})
|
||||
|
||||
test('refreshJourney', async (t) => {
|
||||
tap.test('refreshJourney', async (t) => {
|
||||
await testRefreshJourney({
|
||||
test: t,
|
||||
fetchJourneys: client.journeys,
|
||||
|
@ -125,7 +126,7 @@ test('refreshJourney', async (t) => {
|
|||
t.end()
|
||||
})
|
||||
|
||||
test('trip details', async (t) => {
|
||||
tap.test('trip details', async (t) => {
|
||||
const res = await client.journeys(baselSBB, lausanne, {
|
||||
results: 1, departure: when
|
||||
})
|
||||
|
@ -140,7 +141,7 @@ test('trip details', async (t) => {
|
|||
})
|
||||
|
||||
// todo: fails with `CGI_READ_FAILED`
|
||||
test.skip('departures at Lausanne', async (t) => {
|
||||
tap.skip('departures at Lausanne', async (t) => {
|
||||
const departures = await client.departures(lausanne, {
|
||||
duration: 10, when,
|
||||
})
|
||||
|
@ -155,7 +156,7 @@ test.skip('departures at Lausanne', async (t) => {
|
|||
})
|
||||
|
||||
// todo: fails with `CGI_READ_FAILED`
|
||||
test.skip('departures with station object', async (t) => {
|
||||
tap.skip('departures with station object', async (t) => {
|
||||
const deps = await client.departures({
|
||||
type: 'station',
|
||||
id: '8501120',
|
||||
|
@ -172,7 +173,7 @@ test.skip('departures with station object', async (t) => {
|
|||
})
|
||||
|
||||
// todo: fails with `CGI_READ_FAILED`
|
||||
test.skip('arrivals at Lausanne', async (t) => {
|
||||
tap.skip('arrivals at Lausanne', async (t) => {
|
||||
const arrivals = await client.arrivals(lausanne, {
|
||||
duration: 10, when
|
||||
})
|
||||
|
@ -188,7 +189,7 @@ test.skip('arrivals at Lausanne', async (t) => {
|
|||
|
||||
// todo: nearby
|
||||
|
||||
test('locations named "ETH Hönggerberg"', async (t) => {
|
||||
tap.test('locations named "ETH Hönggerberg"', async (t) => {
|
||||
const locations = await client.locations('ETH Hönggerberg', {
|
||||
results: 10,
|
||||
})
|
||||
|
@ -206,7 +207,7 @@ test('locations named "ETH Hönggerberg"', async (t) => {
|
|||
t.end()
|
||||
})
|
||||
|
||||
test('stop Lausanne', async (t) => {
|
||||
tap.test('stop Lausanne', async (t) => {
|
||||
const s = await client.stop(lausanne)
|
||||
|
||||
validate(t, s, ['stop', 'station'], 'station')
|
||||
|
@ -215,7 +216,7 @@ test('stop Lausanne', async (t) => {
|
|||
t.end()
|
||||
})
|
||||
|
||||
test('radar', async (t) => {
|
||||
tap.test('radar', async (t) => {
|
||||
const vehicles = await client.radar({
|
||||
north: 46.9984,
|
||||
west: 7.3495,
|
||||
|
@ -229,7 +230,7 @@ test('radar', async (t) => {
|
|||
t.end()
|
||||
})
|
||||
|
||||
test('reachableFrom', async (t) => {
|
||||
tap.test('reachableFrom', async (t) => {
|
||||
await testReachableFrom({
|
||||
test: t,
|
||||
reachableFrom: client.reachableFrom,
|
||||
|
|
|
@ -1,11 +1,12 @@
|
|||
'use strict'
|
||||
|
||||
const tap = require('tap')
|
||||
|
||||
const {createWhen} = require('./lib/util')
|
||||
const createClient = require('../..')
|
||||
const sncbProfile = require('../../p/sncb')
|
||||
const products = require('../../p/sncb/products')
|
||||
const createValidate = require('./lib/validate-fptf-with')
|
||||
const {test} = require('./lib/util')
|
||||
const testJourneysStationToStation = require('./lib/journeys-station-to-station')
|
||||
const testRefreshJourney = require('./lib/refresh-journey')
|
||||
const testArrivals = require('./lib/arrivals')
|
||||
|
@ -35,7 +36,7 @@ const gentPaddenhoek = {
|
|||
latitude: 51.0517, longitude: 3.724878,
|
||||
}
|
||||
|
||||
test('journeys – Gent Sant Pieters to Bruxelles Midi', async (t) => {
|
||||
tap.test('journeys – Gent Sant Pieters to Bruxelles Midi', async (t) => {
|
||||
const res = await client.journeys(gentStPieters, bruxellesMidi, {
|
||||
results: 4,
|
||||
departure: when,
|
||||
|
@ -55,7 +56,7 @@ test('journeys – Gent Sant Pieters to Bruxelles Midi', async (t) => {
|
|||
// todo: via works – with detour
|
||||
// todo: without detour
|
||||
|
||||
test('trip details', async (t) => {
|
||||
tap.test('trip details', async (t) => {
|
||||
const res = await client.journeys(gentStPieters, bruxellesMidi, {
|
||||
results: 1, departure: when
|
||||
})
|
||||
|
@ -69,20 +70,20 @@ test('trip details', async (t) => {
|
|||
t.end()
|
||||
})
|
||||
|
||||
test('arrivals at Bruxelles Midi', async (t) => {
|
||||
tap.test('arrivals at Bruxelles Midi', async (t) => {
|
||||
const arrivals = await client.arrivals(bruxellesMidi, {
|
||||
duration: 10, when
|
||||
})
|
||||
|
||||
validate(t, arrivals, 'arrivals', 'arrivals')
|
||||
t.ok(arrivals.length > 0, 'must be >0 arrivals')
|
||||
t.deepEqual(arrivals, arrivals.sort((a, b) => t.when > b.when))
|
||||
t.same(arrivals, arrivals.sort((a, b) => t.when > b.when))
|
||||
t.end()
|
||||
})
|
||||
|
||||
// todo: nearby
|
||||
|
||||
test('radar', async (t) => {
|
||||
tap.test('radar', async (t) => {
|
||||
const vehicles = await client.radar({
|
||||
north: 51.065,
|
||||
west: 3.688,
|
||||
|
@ -96,7 +97,7 @@ test('radar', async (t) => {
|
|||
t.end()
|
||||
})
|
||||
|
||||
test.skip('reachableFrom', async (t) => {
|
||||
tap.skip('reachableFrom', async (t) => {
|
||||
await testReachableFrom({
|
||||
test: t,
|
||||
reachableFrom: client.reachableFrom,
|
||||
|
|
|
@ -1,11 +1,12 @@
|
|||
'use strict'
|
||||
|
||||
const tap = require('tap')
|
||||
|
||||
const {createWhen} = require('./lib/util')
|
||||
const createClient = require('../..')
|
||||
const svvProfile = require('../../p/svv')
|
||||
const products = require('../../p/svv/products')
|
||||
const createValidate = require('./lib/validate-fptf-with')
|
||||
const {test} = require('./lib/util')
|
||||
const testJourneysStationToStation = require('./lib/journeys-station-to-station')
|
||||
const testRefreshJourney = require('./lib/refresh-journey')
|
||||
const testArrivals = require('./lib/arrivals')
|
||||
|
@ -37,7 +38,7 @@ const zillnerstr2 = {
|
|||
latitude: 47.801434, longitude: 13.031006,
|
||||
}
|
||||
|
||||
test('journeys – Sam to Volksgarten', async (t) => {
|
||||
tap.test('journeys – Sam to Volksgarten', async (t) => {
|
||||
const res = await client.journeys(sam, volksgarten, {
|
||||
results: 4,
|
||||
departure: when,
|
||||
|
@ -57,7 +58,7 @@ test('journeys – Sam to Volksgarten', async (t) => {
|
|||
// todo: via works – with detour
|
||||
// todo: without detour
|
||||
|
||||
test('trip details', async (t) => {
|
||||
tap.test('trip details', async (t) => {
|
||||
const res = await client.journeys(sam, volksgarten, {
|
||||
results: 1, departure: when
|
||||
})
|
||||
|
@ -71,20 +72,20 @@ test('trip details', async (t) => {
|
|||
t.end()
|
||||
})
|
||||
|
||||
test('arrivals at Volksgarten', async (t) => {
|
||||
tap.test('arrivals at Volksgarten', async (t) => {
|
||||
const arrivals = await client.arrivals(volksgarten, {
|
||||
duration: 10, when
|
||||
})
|
||||
|
||||
validate(t, arrivals, 'arrivals', 'arrivals')
|
||||
t.ok(arrivals.length > 0, 'must be >0 arrivals')
|
||||
t.deepEqual(arrivals, arrivals.sort((a, b) => t.when > b.when))
|
||||
t.same(arrivals, arrivals.sort((a, b) => t.when > b.when))
|
||||
t.end()
|
||||
})
|
||||
|
||||
// todo: nearby
|
||||
|
||||
test('reachableFrom', async (t) => {
|
||||
tap.test('reachableFrom', async (t) => {
|
||||
await testReachableFrom({
|
||||
test: t,
|
||||
reachableFrom: client.reachableFrom,
|
||||
|
@ -96,7 +97,7 @@ test('reachableFrom', async (t) => {
|
|||
t.end()
|
||||
})
|
||||
|
||||
test('serverInfo works', async (t) => {
|
||||
tap.test('serverInfo works', async (t) => {
|
||||
await testServerInfo({
|
||||
test: t,
|
||||
fetchServerInfo: client.serverInfo,
|
||||
|
|
|
@ -1,5 +1,7 @@
|
|||
'use strict'
|
||||
|
||||
const tap = require('tap')
|
||||
|
||||
const createClient = require('../..')
|
||||
const vbbProfile = require('../../p/vbb')
|
||||
const products = require('../../p/vbb/products')
|
||||
|
@ -12,7 +14,6 @@ const {
|
|||
validateMovement
|
||||
} = require('./lib/vbb-bvg-validators')
|
||||
const createValidate = require('./lib/validate-fptf-with')
|
||||
const {test} = require('./lib/util')
|
||||
const testJourneysStationToStation = require('./lib/journeys-station-to-station')
|
||||
const testJourneysStationToAddress = require('./lib/journeys-station-to-address')
|
||||
const testJourneysStationToPoi = require('./lib/journeys-station-to-poi')
|
||||
|
@ -45,7 +46,7 @@ const westhafen = '900000001201'
|
|||
const wedding = '900000009104'
|
||||
const württembergallee = '900000026153'
|
||||
|
||||
test('journeys – Spichernstr. to Bismarckstr.', async (t) => {
|
||||
tap.test('journeys – Spichernstr. to Bismarckstr.', async (t) => {
|
||||
const res = await client.journeys({
|
||||
type: 'stop',
|
||||
id: spichernstr,
|
||||
|
@ -68,7 +69,7 @@ test('journeys – Spichernstr. to Bismarckstr.', async (t) => {
|
|||
t.end()
|
||||
})
|
||||
|
||||
test('journeys – only subway', async (t) => {
|
||||
tap.test('journeys – only subway', async (t) => {
|
||||
const res = await client.journeys(spichernstr, bismarckstr, {
|
||||
results: 20,
|
||||
departure: when,
|
||||
|
@ -105,7 +106,7 @@ test('journeys – only subway', async (t) => {
|
|||
|
||||
// todo: journeys – with arrival time
|
||||
|
||||
test('journeys – fails with no product', (t) => {
|
||||
tap.test('journeys – fails with no product', (t) => {
|
||||
journeysFailsWithNoProduct({
|
||||
test: t,
|
||||
fetchJourneys: client.journeys,
|
||||
|
@ -117,7 +118,7 @@ test('journeys – fails with no product', (t) => {
|
|||
t.end()
|
||||
})
|
||||
|
||||
test('journeys: walkingSpeed', async (t) => {
|
||||
tap.test('journeys: walkingSpeed', async (t) => {
|
||||
const havelchaussee = {
|
||||
type: 'location',
|
||||
address: 'Havelchaussee',
|
||||
|
@ -138,7 +139,7 @@ test('journeys: walkingSpeed', async (t) => {
|
|||
})
|
||||
})
|
||||
|
||||
test('earlier/later journeys', async (t) => {
|
||||
tap.test('earlier/later journeys', async (t) => {
|
||||
await testEarlierLaterJourneys({
|
||||
test: t,
|
||||
fetchJourneys: client.journeys,
|
||||
|
@ -151,7 +152,7 @@ test('earlier/later journeys', async (t) => {
|
|||
t.end()
|
||||
})
|
||||
|
||||
test('refreshJourney', async (t) => {
|
||||
tap.test('refreshJourney', async (t) => {
|
||||
await testRefreshJourney({
|
||||
test: t,
|
||||
fetchJourneys: client.journeys,
|
||||
|
@ -164,7 +165,7 @@ test('refreshJourney', async (t) => {
|
|||
t.end()
|
||||
})
|
||||
|
||||
test('trip details', async (t) => {
|
||||
tap.test('trip details', async (t) => {
|
||||
const res = await client.journeys(spichernstr, amrumerStr, {
|
||||
results: 1, departure: when
|
||||
})
|
||||
|
@ -178,7 +179,7 @@ test('trip details', async (t) => {
|
|||
t.end()
|
||||
})
|
||||
|
||||
test('journeys – station to address', async (t) => {
|
||||
tap.test('journeys – station to address', async (t) => {
|
||||
const torfstr = {
|
||||
type: 'location',
|
||||
address: '13353 Berlin-Wedding, Torfstr. 17',
|
||||
|
@ -200,7 +201,7 @@ test('journeys – station to address', async (t) => {
|
|||
t.end()
|
||||
})
|
||||
|
||||
test('journeys – station to POI', async (t) => {
|
||||
tap.test('journeys – station to POI', async (t) => {
|
||||
const atze = {
|
||||
type: 'location',
|
||||
id: '900980720',
|
||||
|
@ -224,7 +225,7 @@ test('journeys – station to POI', async (t) => {
|
|||
t.end()
|
||||
})
|
||||
|
||||
test('journeys: via works – with detour', async (t) => {
|
||||
tap.test('journeys: via works – with detour', async (t) => {
|
||||
// Going from Westhafen to Wedding via Württembergalle without detour
|
||||
// is currently impossible. We check if the routing engine computes a detour.
|
||||
const res = await client.journeys(westhafen, wedding, {
|
||||
|
@ -245,7 +246,7 @@ test('journeys: via works – with detour', async (t) => {
|
|||
|
||||
// todo: without detour test
|
||||
|
||||
test('departures', async (t) => {
|
||||
tap.test('departures', async (t) => {
|
||||
const departures = await client.departures(spichernstr, {
|
||||
duration: 5, when,
|
||||
})
|
||||
|
@ -259,7 +260,7 @@ test('departures', async (t) => {
|
|||
t.end()
|
||||
})
|
||||
|
||||
test('departures with station object', async (t) => {
|
||||
tap.test('departures with station object', async (t) => {
|
||||
const deps = await client.departures({
|
||||
type: 'station',
|
||||
id: spichernstr,
|
||||
|
@ -275,7 +276,7 @@ test('departures with station object', async (t) => {
|
|||
t.end()
|
||||
})
|
||||
|
||||
test('departures at Spichernstr. in direction of Westhafen', async (t) => {
|
||||
tap.test('departures at Spichernstr. in direction of Westhafen', async (t) => {
|
||||
await testDeparturesInDirection({
|
||||
test: t,
|
||||
fetchDepartures: client.departures,
|
||||
|
@ -288,14 +289,14 @@ test('departures at Spichernstr. in direction of Westhafen', async (t) => {
|
|||
t.end()
|
||||
})
|
||||
|
||||
test('departures at 7-digit station', async (t) => {
|
||||
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()
|
||||
})
|
||||
|
||||
test('arrivals', async (t) => {
|
||||
tap.test('arrivals', async (t) => {
|
||||
const arrivals = await client.arrivals(spichernstr, {
|
||||
duration: 5, when,
|
||||
})
|
||||
|
@ -309,7 +310,7 @@ test('arrivals', async (t) => {
|
|||
t.end()
|
||||
})
|
||||
|
||||
test('nearby', async (t) => {
|
||||
tap.test('nearby', async (t) => {
|
||||
const berlinerStr = '900000044201'
|
||||
const landhausstr = '900000043252'
|
||||
|
||||
|
@ -335,7 +336,7 @@ test('nearby', async (t) => {
|
|||
t.end()
|
||||
})
|
||||
|
||||
test('locations', async (t) => {
|
||||
tap.test('locations', async (t) => {
|
||||
const locations = await client.locations('Alexanderplatz', {results: 20})
|
||||
|
||||
validate(t, locations, 'locations', 'locations')
|
||||
|
@ -348,7 +349,7 @@ test('locations', async (t) => {
|
|||
t.end()
|
||||
})
|
||||
|
||||
test('stop', async (t) => {
|
||||
tap.test('stop', async (t) => {
|
||||
const s = await client.stop(spichernstr)
|
||||
|
||||
validate(t, s, ['stop', 'station'], 'stop')
|
||||
|
@ -357,7 +358,7 @@ test('stop', async (t) => {
|
|||
t.end()
|
||||
})
|
||||
|
||||
test('radar', async (t) => {
|
||||
tap.test('radar', async (t) => {
|
||||
const vehicles = await client.radar({
|
||||
north: 52.52411,
|
||||
west: 13.41002,
|
||||
|
@ -371,7 +372,7 @@ test('radar', async (t) => {
|
|||
t.end()
|
||||
})
|
||||
|
||||
test('reachableFrom', async (t) => {
|
||||
tap.test('reachableFrom', async (t) => {
|
||||
const torfstr17 = {
|
||||
type: 'location',
|
||||
address: '13353 Berlin-Wedding, Torfstr. 17',
|
||||
|
|
|
@ -1,11 +1,12 @@
|
|||
'use strict'
|
||||
|
||||
const tap = require('tap')
|
||||
|
||||
const {createWhen} = require('./lib/util')
|
||||
const createClient = require('../..')
|
||||
const vbnProfile = require('../../p/vbn')
|
||||
const products = require('../../p/vbn/products')
|
||||
const createValidate = require('./lib/validate-fptf-with')
|
||||
const {test} = require('./lib/util')
|
||||
const testJourneysStationToStation = require('./lib/journeys-station-to-station')
|
||||
const testArrivals = require('./lib/arrivals')
|
||||
const testReachableFrom = require('./lib/reachable-from')
|
||||
|
@ -29,7 +30,7 @@ const client = createClient(vbnProfile, 'public-transport/hafas-client:test')
|
|||
const oldenburg = '8000291'
|
||||
const bremenHumboldtstr = '9013973'
|
||||
|
||||
test('journeys – Oldenburg to Bremen Humboldtstr.', async (t) => {
|
||||
tap.test('journeys – Oldenburg to Bremen Humboldtstr.', async (t) => {
|
||||
const res = await client.journeys(oldenburg, bremenHumboldtstr, {
|
||||
results: 4,
|
||||
departure: when,
|
||||
|
@ -49,7 +50,7 @@ test('journeys – Oldenburg to Bremen Humboldtstr.', async (t) => {
|
|||
// todo: via works – with detour
|
||||
// todo: without detour
|
||||
|
||||
test('trip details', async (t) => {
|
||||
tap.test('trip details', async (t) => {
|
||||
const res = await client.journeys(oldenburg, bremenHumboldtstr, {
|
||||
results: 1, departure: when
|
||||
})
|
||||
|
@ -63,20 +64,20 @@ test('trip details', async (t) => {
|
|||
t.end()
|
||||
})
|
||||
|
||||
test('arrivals at Bremen Humboldtstr.', async (t) => {
|
||||
tap.test('arrivals at Bremen Humboldtstr.', async (t) => {
|
||||
const arrivals = await client.arrivals(bremenHumboldtstr, {
|
||||
duration: 10, when
|
||||
})
|
||||
|
||||
validate(t, arrivals, 'arrivals', 'arrivals')
|
||||
t.ok(arrivals.length > 0, 'must be >0 arrivals')
|
||||
t.deepEqual(arrivals, arrivals.sort((a, b) => t.when > b.when))
|
||||
t.same(arrivals, arrivals.sort((a, b) => t.when > b.when))
|
||||
t.end()
|
||||
})
|
||||
|
||||
// todo: nearby
|
||||
|
||||
test('radar', async (t) => {
|
||||
tap.test('radar', async (t) => {
|
||||
const vehicles = await client.radar({
|
||||
north: 53.090516,
|
||||
west: 8.750106,
|
||||
|
@ -91,7 +92,7 @@ test('radar', async (t) => {
|
|||
})
|
||||
|
||||
// todo: fails with "HCI Service: location missing or invalid"
|
||||
test('reachableFrom', async (t) => {
|
||||
tap.test('reachableFrom', async (t) => {
|
||||
await testReachableFrom({
|
||||
test: t,
|
||||
reachableFrom: client.reachableFrom,
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
'use strict'
|
||||
|
||||
const tap = require('tap')
|
||||
const isRoughlyEqual = require('is-roughly-equal')
|
||||
|
||||
const {createWhen} = require('./lib/util')
|
||||
|
@ -7,7 +8,6 @@ const createClient = require('../..')
|
|||
const vrnProfile = require('../../p/vrn')
|
||||
const products = require('../../p/vrn/products')
|
||||
const createValidate = require('./lib/validate-fptf-with')
|
||||
const {test} = require('./lib/util')
|
||||
const testJourneysStationToStation = require('./lib/journeys-station-to-station')
|
||||
const journeysFailsWithNoProduct = require('./lib/journeys-fails-with-no-product')
|
||||
const testJourneysStationToAddress = require('./lib/journeys-station-to-address')
|
||||
|
@ -36,7 +36,7 @@ const client = createClient(vrnProfile, 'public-transport/hafas-client:test')
|
|||
const ludwigshafen = '8000236'
|
||||
const meckesheim = '8003932'
|
||||
|
||||
test('journeys – Ludwigshafen to Meckesheim', async (t) => {
|
||||
tap.test('journeys – Ludwigshafen to Meckesheim', async (t) => {
|
||||
const res = await client.journeys(ludwigshafen, meckesheim, {
|
||||
results: 4,
|
||||
departure: when,
|
||||
|
@ -55,7 +55,7 @@ test('journeys – Ludwigshafen to Meckesheim', async (t) => {
|
|||
|
||||
// todo: journeys, only one product
|
||||
|
||||
test('journeys – fails with no product', (t) => {
|
||||
tap.test('journeys – fails with no product', (t) => {
|
||||
journeysFailsWithNoProduct({
|
||||
test: t,
|
||||
fetchJourneys: client.journeys,
|
||||
|
@ -67,7 +67,7 @@ test('journeys – fails with no product', (t) => {
|
|||
t.end()
|
||||
})
|
||||
|
||||
test('Ludwigshafen to Pestalozzistr. 2, Ludwigshafen', async (t) => {
|
||||
tap.test('Ludwigshafen to Pestalozzistr. 2, Ludwigshafen', async (t) => {
|
||||
const pestalozzistr2 = {
|
||||
type: 'location',
|
||||
id: '980787337',
|
||||
|
@ -90,7 +90,7 @@ test('Ludwigshafen to Pestalozzistr. 2, Ludwigshafen', async (t) => {
|
|||
t.end()
|
||||
})
|
||||
|
||||
test('Ludwigshafen to Südwest-Stadion', async (t) => {
|
||||
tap.test('Ludwigshafen to Südwest-Stadion', async (t) => {
|
||||
const südweststadion = {
|
||||
type: 'location',
|
||||
id: '991664983',
|
||||
|
@ -116,7 +116,7 @@ test('Ludwigshafen to Südwest-Stadion', async (t) => {
|
|||
// todo: via works – with detour
|
||||
// todo: via works – without detour
|
||||
|
||||
test('earlier/later journeys', async (t) => {
|
||||
tap.test('earlier/later journeys', async (t) => {
|
||||
await testEarlierLaterJourneys({
|
||||
test: t,
|
||||
fetchJourneys: client.journeys,
|
||||
|
@ -129,7 +129,7 @@ test('earlier/later journeys', async (t) => {
|
|||
t.end()
|
||||
})
|
||||
|
||||
test('trip details', async (t) => {
|
||||
tap.test('trip details', async (t) => {
|
||||
const res = await client.journeys(ludwigshafen, meckesheim, {
|
||||
results: 1, departure: when
|
||||
})
|
||||
|
@ -143,7 +143,7 @@ test('trip details', async (t) => {
|
|||
t.end()
|
||||
})
|
||||
|
||||
test('departures at Meckesheim', async (t) => {
|
||||
tap.test('departures at Meckesheim', async (t) => {
|
||||
const departures = await client.departures(meckesheim, {
|
||||
duration: 3 * 60, when,
|
||||
})
|
||||
|
@ -157,7 +157,7 @@ test('departures at Meckesheim', async (t) => {
|
|||
t.end()
|
||||
})
|
||||
|
||||
test('departures at Meckesheim in direction of Reilsheim', async (t) => {
|
||||
tap.test('departures at Meckesheim in direction of Reilsheim', async (t) => {
|
||||
const reilsheim = '8005015'
|
||||
await testDeparturesInDirection({
|
||||
test: t,
|
||||
|
@ -171,7 +171,7 @@ test('departures at Meckesheim in direction of Reilsheim', async (t) => {
|
|||
t.end()
|
||||
})
|
||||
|
||||
test('arrivals at Meckesheim', async (t) => {
|
||||
tap.test('arrivals at Meckesheim', async (t) => {
|
||||
const arrivals = await client.arrivals(meckesheim, {
|
||||
duration: 3 * 60, when
|
||||
})
|
||||
|
@ -187,7 +187,7 @@ test('arrivals at Meckesheim', async (t) => {
|
|||
|
||||
// todo: nearby
|
||||
|
||||
test('locations named Ebertpark', async (t) => {
|
||||
tap.test('locations named Ebertpark', async (t) => {
|
||||
const ebertpark = '506453'
|
||||
const locations = await client.locations('Ebertpark', {
|
||||
results: 20
|
||||
|
@ -205,7 +205,7 @@ test('locations named Ebertpark', async (t) => {
|
|||
t.end()
|
||||
})
|
||||
|
||||
test('station Meckesheim', async (t) => {
|
||||
tap.test('station Meckesheim', async (t) => {
|
||||
const s = await client.stop(meckesheim)
|
||||
|
||||
validate(t, s, ['stop', 'station'], 'station')
|
||||
|
@ -214,7 +214,7 @@ test('station Meckesheim', async (t) => {
|
|||
t.end()
|
||||
})
|
||||
|
||||
test('radar', async (t) => {
|
||||
tap.test('radar', async (t) => {
|
||||
const vehicles = await client.radar({
|
||||
north: 49.4940,
|
||||
west: 8.4560,
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
'use strict'
|
||||
|
||||
const tap = require('tap')
|
||||
const isRoughlyEqual = require('is-roughly-equal')
|
||||
|
||||
const {createWhen} = require('./lib/util')
|
||||
|
@ -7,7 +8,6 @@ const createClient = require('../..')
|
|||
const vsnProfile = require('../../p/vsn')
|
||||
const products = require('../../p/vsn/products')
|
||||
const createValidate = require('./lib/validate-fptf-with')
|
||||
const {test} = require('./lib/util')
|
||||
const testJourneysStationToStation = require('./lib/journeys-station-to-station')
|
||||
const testJourneysStationToAddress = require('./lib/journeys-station-to-address')
|
||||
const testJourneysStationToPoi = require('./lib/journeys-station-to-poi')
|
||||
|
@ -34,7 +34,7 @@ const kornmarkt = '9033977'
|
|||
const jugendherberge = '9033961'
|
||||
const ewaldstrasse = '9033896'
|
||||
|
||||
test('journeys – Kornmarkt to Ewaldstraße', async (t) => {
|
||||
tap.test('journeys – Kornmarkt to Ewaldstraße', async (t) => {
|
||||
const res = await client.journeys(kornmarkt, ewaldstrasse, {
|
||||
results: 4,
|
||||
departure: when,
|
||||
|
@ -51,7 +51,7 @@ test('journeys – Kornmarkt to Ewaldstraße', async (t) => {
|
|||
t.end()
|
||||
})
|
||||
|
||||
test('Ewaldstraße to 37083 Göttingen, Schulweg 22', async (t) => {
|
||||
tap.test('Ewaldstraße to 37083 Göttingen, Schulweg 22', async (t) => {
|
||||
const schulweg = {
|
||||
type: 'location',
|
||||
address: '37083 Göttingen, Schulweg 22',
|
||||
|
@ -72,7 +72,7 @@ test('Ewaldstraße to 37083 Göttingen, Schulweg 22', async (t) => {
|
|||
t.end()
|
||||
})
|
||||
|
||||
test('earlier/later journeys', async (t) => {
|
||||
tap.test('earlier/later journeys', async (t) => {
|
||||
await testEarlierLaterJourneys({
|
||||
test: t,
|
||||
fetchJourneys: client.journeys,
|
||||
|
@ -85,7 +85,7 @@ test('earlier/later journeys', async (t) => {
|
|||
t.end()
|
||||
})
|
||||
|
||||
test('trip', async (t) => {
|
||||
tap.test('trip', async (t) => {
|
||||
const { journeys } = await client.journeys(jugendherberge, kornmarkt, {
|
||||
results: 1, departure: when
|
||||
})
|
||||
|
@ -99,7 +99,7 @@ test('trip', async (t) => {
|
|||
t.end()
|
||||
})
|
||||
|
||||
test('departures at Kornmarkt.', async (t) => {
|
||||
tap.test('departures at Kornmarkt.', async (t) => {
|
||||
const departures = await client.departures(kornmarkt, {
|
||||
duration: 20, when
|
||||
})
|
||||
|
@ -113,7 +113,7 @@ test('departures at Kornmarkt.', async (t) => {
|
|||
t.end()
|
||||
})
|
||||
|
||||
test('arrivals at Kornmarkt.', async (t) => {
|
||||
tap.test('arrivals at Kornmarkt.', async (t) => {
|
||||
const arrivals = await client.arrivals(kornmarkt, {
|
||||
duration: 20, when
|
||||
})
|
||||
|
@ -127,7 +127,7 @@ test('arrivals at Kornmarkt.', async (t) => {
|
|||
t.end()
|
||||
})
|
||||
|
||||
test('departures with station object', async (t) => {
|
||||
tap.test('departures with station object', async (t) => {
|
||||
const deps = await client.departures({
|
||||
type: 'station',
|
||||
id: kornmarkt,
|
||||
|
@ -143,7 +143,7 @@ test('departures with station object', async (t) => {
|
|||
t.end()
|
||||
})
|
||||
|
||||
test('locations named Botanischer Garten', async (t) => {
|
||||
tap.test('locations named Botanischer Garten', async (t) => {
|
||||
const locations = await client.locations('Botanischer Garten', {
|
||||
results: 20
|
||||
})
|
||||
|
@ -157,7 +157,7 @@ test('locations named Botanischer Garten', async (t) => {
|
|||
t.end()
|
||||
})
|
||||
|
||||
test('stop Jugendherberge', async (t) => {
|
||||
tap.test('stop Jugendherberge', async (t) => {
|
||||
const s = await client.stop(jugendherberge)
|
||||
|
||||
validate(t, s, ['stop', 'station'], 'stop')
|
||||
|
@ -166,7 +166,7 @@ test('stop Jugendherberge', async (t) => {
|
|||
t.end()
|
||||
})
|
||||
|
||||
test('radar', async (t) => {
|
||||
tap.test('radar', async (t) => {
|
||||
const vehicles = await client.radar({
|
||||
north: 52,
|
||||
west: 9.8,
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
'use strict'
|
||||
|
||||
const tap = require('tap')
|
||||
const isRoughlyEqual = require('is-roughly-equal')
|
||||
|
||||
const {createWhen} = require('./lib/util')
|
||||
|
@ -7,7 +8,6 @@ const createClient = require('../..')
|
|||
const zvvProfile = require('../../p/zvv')
|
||||
const products = require('../../p/zvv/products')
|
||||
const createValidate = require('./lib/validate-fptf-with')
|
||||
const {test} = require('./lib/util')
|
||||
const testJourneysStationToStation = require('./lib/journeys-station-to-station')
|
||||
const journeysFailsWithNoProduct = require('./lib/journeys-fails-with-no-product')
|
||||
const testJourneysStationToAddress = require('./lib/journeys-station-to-address')
|
||||
|
@ -33,7 +33,7 @@ const client = createClient(zvvProfile, 'public-transport/hafas-client:test')
|
|||
const bürkliplatz = '8591105'
|
||||
const ethUniversitätsspital = '8591123'
|
||||
|
||||
test('journeys – Bürkliplatz to ETH/Universitätsspital', async (t) => {
|
||||
tap.test('journeys – Bürkliplatz to ETH/Universitätsspital', async (t) => {
|
||||
const res = await client.journeys(bürkliplatz, ethUniversitätsspital, {
|
||||
results: 4,
|
||||
departure: when,
|
||||
|
@ -50,7 +50,7 @@ test('journeys – Bürkliplatz to ETH/Universitätsspital', async (t) => {
|
|||
t.end()
|
||||
})
|
||||
|
||||
test('earlier/later journeys', async (t) => {
|
||||
tap.test('earlier/later journeys', async (t) => {
|
||||
await testEarlierLaterJourneys({
|
||||
test: t,
|
||||
fetchJourneys: client.journeys,
|
||||
|
@ -63,7 +63,7 @@ test('earlier/later journeys', async (t) => {
|
|||
t.end()
|
||||
})
|
||||
|
||||
test('trip details', async (t) => {
|
||||
tap.test('trip details', async (t) => {
|
||||
const res = await client.journeys(bürkliplatz, ethUniversitätsspital, {
|
||||
results: 1, departure: when
|
||||
})
|
||||
|
@ -77,7 +77,7 @@ test('trip details', async (t) => {
|
|||
t.end()
|
||||
})
|
||||
|
||||
test.skip('departures at ETH/Universitätsspital', async (t) => { // todo
|
||||
tap.skip('departures at ETH/Universitätsspital', async (t) => { // todo
|
||||
const departures = await client.departures(ethUniversitätsspital, {
|
||||
duration: 5, when,
|
||||
})
|
||||
|
@ -94,7 +94,7 @@ test.skip('departures at ETH/Universitätsspital', async (t) => { // todo
|
|||
// todo: departures in direction
|
||||
// todo: nearby
|
||||
|
||||
test('locations named Rennweg', async (t) => {
|
||||
tap.test('locations named Rennweg', async (t) => {
|
||||
const rennweg = '8591316'
|
||||
const locations = await client.locations('Rennweg', {
|
||||
results: 20,
|
||||
|
@ -111,7 +111,7 @@ test('locations named Rennweg', async (t) => {
|
|||
t.end()
|
||||
})
|
||||
|
||||
test('radar', async (t) => {
|
||||
tap.test('radar', async (t) => {
|
||||
const vehicles = await client.radar({
|
||||
north: 47.387,
|
||||
west: 8.514,
|
||||
|
|
|
@ -1,5 +0,0 @@
|
|||
'use strict'
|
||||
|
||||
Error.stackTraceLimit = Infinity
|
||||
|
||||
require('./products-filter')
|
|
@ -1,6 +1,6 @@
|
|||
'use strict'
|
||||
|
||||
const test = require('tape')
|
||||
const tap = require('tap')
|
||||
const format = require('../../format/products-filter')
|
||||
|
||||
const products = [
|
||||
|
@ -27,10 +27,10 @@ const ctx = {
|
|||
profile: {products}
|
||||
}
|
||||
|
||||
test('formatProductsFilter works without customisations', (t) => {
|
||||
tap.test('formatProductsFilter works without customisations', (t) => {
|
||||
const expected = 1 | 2 | 4
|
||||
const filter = {}
|
||||
t.deepEqual(format(ctx, filter), {
|
||||
t.same(format(ctx, filter), {
|
||||
type: 'PROD',
|
||||
mode: 'INC',
|
||||
value: expected + ''
|
||||
|
@ -38,7 +38,7 @@ test('formatProductsFilter works without customisations', (t) => {
|
|||
t.end()
|
||||
})
|
||||
|
||||
test('formatProductsFilter works with customisations', (t) => {
|
||||
tap.test('formatProductsFilter works with customisations', (t) => {
|
||||
t.equal(+format(ctx, {
|
||||
bus: true
|
||||
}).value, 1 | 2 | 4)
|
||||
|
|
|
@ -1,28 +0,0 @@
|
|||
'use strict'
|
||||
|
||||
Error.stackTraceLimit = Infinity
|
||||
|
||||
require('./parse')
|
||||
require('./format')
|
||||
|
||||
require('./db-stop')
|
||||
require('./sbb-journeys')
|
||||
require('./insa-stop')
|
||||
require('./bvg-journey')
|
||||
require('./db-journey')
|
||||
require('./db-journey-2')
|
||||
require('./db-journey-polyline')
|
||||
require('./db-arrivals')
|
||||
require('./vbb-departures')
|
||||
require('./vbb-journeys')
|
||||
require('./bvg-radar')
|
||||
require('./oebb-trip')
|
||||
require('./rejseplanen-trip')
|
||||
require('./vsn-remarks')
|
||||
require('./db-netz-remarks')
|
||||
require('./vsn-departures')
|
||||
require('./mobiliteit-lu-line')
|
||||
require('./rsag-journey')
|
||||
|
||||
require('./throttle')
|
||||
require('./retry')
|
|
@ -1,6 +1,6 @@
|
|||
'use strict'
|
||||
|
||||
const test = require('tape')
|
||||
const tap = require('tap')
|
||||
|
||||
const createClient = require('..')
|
||||
const rawProfile = require('../p/insa')
|
||||
|
@ -15,11 +15,11 @@ const opt = {
|
|||
remarks: true,
|
||||
}
|
||||
|
||||
test('parses a stop() response correctly (INSA)', (t) => {
|
||||
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])
|
||||
|
||||
t.deepEqual(stop, expected)
|
||||
t.same(stop, expected)
|
||||
t.end()
|
||||
})
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
'use strict'
|
||||
|
||||
const test = require('tape')
|
||||
const tap = require('tap')
|
||||
|
||||
const createClient = require('..')
|
||||
const rawProfile = require('../p/mobiliteit-lu')
|
||||
|
@ -13,7 +13,7 @@ const opt = {
|
|||
remarks: true,
|
||||
}
|
||||
|
||||
test('parses a line correctly (mobiliteit.lu)', (t) => {
|
||||
tap.test('parses a line correctly (mobiliteit.lu)', (t) => {
|
||||
const rawLine = {
|
||||
pid: 'L::1::IC::B1303038328::IC_1303038328::*',
|
||||
name: 'IC 108',
|
||||
|
@ -37,7 +37,7 @@ test('parses a line correctly (mobiliteit.lu)', (t) => {
|
|||
const ctx = {profile, opt}
|
||||
const stop = profile.parseLine(ctx, rawLine)
|
||||
|
||||
t.deepEqual(stop, {
|
||||
t.same(stop, {
|
||||
type: 'line',
|
||||
id: 'ic-108',
|
||||
fahrtNr: '108',
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
'use strict'
|
||||
|
||||
const test = require('tape')
|
||||
const tap = require('tap')
|
||||
|
||||
const createClient = require('..')
|
||||
const rawProfile = require('../p/oebb')
|
||||
|
@ -19,11 +19,11 @@ const opt = {
|
|||
when: '2020-06-11T15:25:00+02:00',
|
||||
}
|
||||
|
||||
test('parses a trip correctly (ÖBB)', (t) => {
|
||||
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)
|
||||
|
||||
t.deepEqual(trip, expected)
|
||||
t.same(trip, expected)
|
||||
t.end()
|
||||
})
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
'use strict'
|
||||
|
||||
const test = require('tape')
|
||||
const tap = require('tap')
|
||||
const parse = require('../../parse/date-time')
|
||||
|
||||
const ctx = {
|
||||
|
@ -12,7 +12,7 @@ const ctx = {
|
|||
}
|
||||
}
|
||||
|
||||
test('date & time parsing returns a timestamp', (t) => {
|
||||
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))
|
||||
|
@ -20,32 +20,32 @@ test('date & time parsing returns a timestamp', (t) => {
|
|||
t.end()
|
||||
})
|
||||
|
||||
test('date & time parsing uses tzOffset', (t) => {
|
||||
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()
|
||||
})
|
||||
|
||||
test('date & time parsing works with day "overflow"', (t) => {
|
||||
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()
|
||||
})
|
||||
|
||||
// #106
|
||||
test('date & time parsing works with day "overflow" & tzOffset', (t) => {
|
||||
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()
|
||||
})
|
||||
|
||||
test('date & time parsing works with summer & winter time', (t) => {
|
||||
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()
|
||||
})
|
||||
|
||||
test('date & time parsing uses profile.timezone', (t) => {
|
||||
tap.test('date & time parsing uses profile.timezone', (t) => {
|
||||
const iso = parse({
|
||||
...ctx,
|
||||
profile: {...ctx.profile, timezone: 'Europe/Moscow'}
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
'use strict'
|
||||
|
||||
const test = require('tape')
|
||||
const tap = require('tap')
|
||||
const parse = require('../../parse/hint')
|
||||
|
||||
const ctx = {
|
||||
|
@ -9,7 +9,7 @@ const ctx = {
|
|||
profile: {}
|
||||
}
|
||||
|
||||
test('parses hints correctly', (t) => {
|
||||
tap.test('parses hints correctly', (t) => {
|
||||
const input = {
|
||||
type: 'A',
|
||||
code: 'bf',
|
||||
|
@ -22,20 +22,20 @@ test('parses hints correctly', (t) => {
|
|||
text: 'some text'
|
||||
}
|
||||
|
||||
t.deepEqual(parse(ctx, input), expected)
|
||||
t.deepEqual(parse(ctx, {
|
||||
t.same(parse(ctx, input), expected)
|
||||
t.same(parse(ctx, {
|
||||
...input, type: 'I'
|
||||
}), expected)
|
||||
|
||||
// alternative trip
|
||||
t.deepEqual(parse(ctx, {
|
||||
t.same(parse(ctx, {
|
||||
...input, type: 'L', jid: 'trip id'
|
||||
}), {
|
||||
...expected, type: 'status', code: 'alternative-trip', tripId: 'trip id'
|
||||
})
|
||||
|
||||
// type: M
|
||||
t.deepEqual(parse(ctx, {
|
||||
t.same(parse(ctx, {
|
||||
...input, type: 'M', txtS: 'some summary'
|
||||
}), {
|
||||
...expected, type: 'status', summary: 'some summary'
|
||||
|
@ -43,13 +43,13 @@ test('parses hints correctly', (t) => {
|
|||
|
||||
// type: D
|
||||
for (const type of ['D', 'U', 'R', 'N', 'Y']) {
|
||||
t.deepEqual(parse(ctx, {...input, type}), {
|
||||
t.same(parse(ctx, {...input, type}), {
|
||||
...expected, type: 'status'
|
||||
})
|
||||
}
|
||||
|
||||
// .code via .icon
|
||||
t.deepEqual(parse(ctx, {
|
||||
t.same(parse(ctx, {
|
||||
...input, code: null, icon: {type: 'cancel'}
|
||||
}), {...expected, code: 'cancelled'})
|
||||
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
'use strict'
|
||||
|
||||
const test = require('tape')
|
||||
const tap = require('tap')
|
||||
const parse = require('../../parse/icon')
|
||||
|
||||
const ctx = {
|
||||
|
@ -9,12 +9,12 @@ const ctx = {
|
|||
profile: {}
|
||||
}
|
||||
|
||||
test('parses icons correctly', (t) => {
|
||||
tap.test('parses icons correctly', (t) => {
|
||||
const text = {
|
||||
"res": "BVG",
|
||||
"text": "Berliner Verkehrsbetriebe"
|
||||
}
|
||||
t.deepEqual(parse(ctx, text), {
|
||||
t.same(parse(ctx, text), {
|
||||
type: 'BVG',
|
||||
title: 'Berliner Verkehrsbetriebe'
|
||||
})
|
||||
|
@ -23,7 +23,7 @@ test('parses icons correctly', (t) => {
|
|||
"res": "PROD_BUS",
|
||||
"txtS": "18"
|
||||
}
|
||||
t.deepEqual(parse(ctx, txtS), {
|
||||
t.same(parse(ctx, txtS), {
|
||||
type: 'PROD_BUS',
|
||||
title: '18'
|
||||
})
|
||||
|
@ -32,7 +32,7 @@ test('parses icons correctly', (t) => {
|
|||
"res": "RBB",
|
||||
"txt": "Regionalbus Braunschweig GmbH"
|
||||
}
|
||||
t.deepEqual(parse(ctx, txt), {
|
||||
t.same(parse(ctx, txt), {
|
||||
type: 'RBB',
|
||||
title: 'Regionalbus Braunschweig GmbH'
|
||||
})
|
||||
|
@ -40,7 +40,7 @@ test('parses icons correctly', (t) => {
|
|||
const noText = {
|
||||
"res": "attr_bike_r"
|
||||
}
|
||||
t.deepEqual(parse(ctx, noText), {
|
||||
t.same(parse(ctx, noText), {
|
||||
type: 'attr_bike_r',
|
||||
title: null
|
||||
})
|
||||
|
@ -60,7 +60,7 @@ test('parses icons correctly', (t) => {
|
|||
"a": 255
|
||||
}
|
||||
}
|
||||
t.deepEqual(parse(ctx, withColor), {
|
||||
t.same(parse(ctx, withColor), {
|
||||
type: 'prod_sub_t',
|
||||
title: null,
|
||||
fgColor: {r: 255, g: 255, b: 255, a: 255},
|
||||
|
|
|
@ -1,12 +0,0 @@
|
|||
'use strict'
|
||||
|
||||
Error.stackTraceLimit = Infinity
|
||||
|
||||
require('./date-time')
|
||||
require('./icon')
|
||||
require('./operator')
|
||||
require('./location')
|
||||
require('./when')
|
||||
require('./line')
|
||||
require('./hint')
|
||||
require('./warning')
|
|
@ -1,6 +1,6 @@
|
|||
'use strict'
|
||||
|
||||
const test = require('tape')
|
||||
const tap = require('tap')
|
||||
const parse = require('../../parse/line')
|
||||
|
||||
const profile = {
|
||||
|
@ -16,7 +16,7 @@ const ctx = {
|
|||
profile
|
||||
}
|
||||
|
||||
test('parses lines correctly', (t) => {
|
||||
tap.test('parses lines correctly', (t) => {
|
||||
const input = {
|
||||
line: 'foo line',
|
||||
prodCtx: {
|
||||
|
@ -32,23 +32,23 @@ test('parses lines correctly', (t) => {
|
|||
public: true
|
||||
}
|
||||
|
||||
t.deepEqual(parse(ctx, input), expected)
|
||||
t.same(parse(ctx, input), expected)
|
||||
|
||||
t.deepEqual(parse(ctx, {
|
||||
t.same(parse(ctx, {
|
||||
...input, line: null, addName: input.line
|
||||
}), expected)
|
||||
t.deepEqual(parse(ctx, {
|
||||
t.same(parse(ctx, {
|
||||
...input, line: null, name: input.line
|
||||
}), expected)
|
||||
|
||||
// no prodCtx.lineId
|
||||
t.deepEqual(parse(ctx, {
|
||||
t.same(parse(ctx, {
|
||||
...input, prodCtx: {...input.prodCtx, lineId: null}
|
||||
}), {
|
||||
...expected, id: 'foo-line'
|
||||
})
|
||||
// no prodCtx
|
||||
t.deepEqual(parse(ctx, {
|
||||
t.same(parse(ctx, {
|
||||
...input, prodCtx: undefined
|
||||
}), {
|
||||
...expected, id: 'foo-line', fahrtNr: null
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
'use strict'
|
||||
|
||||
const test = require('tape')
|
||||
const tap = require('tap')
|
||||
const omit = require('lodash/omit')
|
||||
const parse = require('../../parse/location')
|
||||
|
||||
|
@ -20,7 +20,7 @@ const ctx = {
|
|||
profile
|
||||
}
|
||||
|
||||
test('parses an address correctly', (t) => {
|
||||
tap.test('parses an address correctly', (t) => {
|
||||
const input = {
|
||||
type: 'A',
|
||||
name: 'Foo street 3',
|
||||
|
@ -29,7 +29,7 @@ test('parses an address correctly', (t) => {
|
|||
}
|
||||
|
||||
const address = parse(ctx, input)
|
||||
t.deepEqual(address, {
|
||||
t.same(address, {
|
||||
type: 'location',
|
||||
id: 'some id',
|
||||
address: 'Foo street 3',
|
||||
|
@ -40,7 +40,7 @@ test('parses an address correctly', (t) => {
|
|||
t.end()
|
||||
})
|
||||
|
||||
test('parses a POI correctly', (t) => {
|
||||
tap.test('parses a POI correctly', (t) => {
|
||||
const input = {
|
||||
type: 'P',
|
||||
name: 'some POI',
|
||||
|
@ -49,7 +49,7 @@ test('parses a POI correctly', (t) => {
|
|||
}
|
||||
|
||||
const poi = parse(ctx, input)
|
||||
t.deepEqual(poi, {
|
||||
t.same(poi, {
|
||||
type: 'location',
|
||||
poi: true,
|
||||
id: 'some id',
|
||||
|
@ -75,9 +75,9 @@ const fooBusStop = {
|
|||
pCls: 123
|
||||
}
|
||||
|
||||
test('parses a stop correctly', (t) => {
|
||||
tap.test('parses a stop correctly', (t) => {
|
||||
const stop = parse(ctx, fooBusStop)
|
||||
t.deepEqual(stop, {
|
||||
t.same(stop, {
|
||||
type: 'stop',
|
||||
id: 'foo stop',
|
||||
name: 'foo bus stop', // lower-cased!
|
||||
|
@ -106,12 +106,12 @@ test('parses a stop correctly', (t) => {
|
|||
}, {
|
||||
...fooBusStop, lines: [lineA]
|
||||
})
|
||||
t.deepEqual(withLines.lines, [lineA])
|
||||
t.same(withLines.lines, [lineA])
|
||||
|
||||
t.end()
|
||||
})
|
||||
|
||||
test('falls back to coordinates from `lid`', (t) => {
|
||||
tap.test('falls back to coordinates from `lid`', (t) => {
|
||||
const {location} = parse(ctx, {
|
||||
type: 'S',
|
||||
name: 'foo',
|
||||
|
@ -123,7 +123,7 @@ test('falls back to coordinates from `lid`', (t) => {
|
|||
t.end()
|
||||
})
|
||||
|
||||
test('handles recursive references properly', (t) => {
|
||||
tap.test('handles recursive references properly', (t) => {
|
||||
const southernInput = {
|
||||
type: 'S',
|
||||
name: 'Southern Platform',
|
||||
|
@ -171,14 +171,14 @@ test('handles recursive references properly', (t) => {
|
|||
...fooBusStop,
|
||||
entryLocL: [0]
|
||||
})
|
||||
t.deepEqual(entrances, [southernExpected.location])
|
||||
t.same(entrances, [southernExpected.location])
|
||||
|
||||
const {type, stops} = parse(_ctx, {
|
||||
...fooBusStop,
|
||||
stopLocL: [0]
|
||||
})
|
||||
t.equal(type, 'station')
|
||||
t.deepEqual(stops, [southernExpected])
|
||||
t.same(stops, [southernExpected])
|
||||
|
||||
t.end()
|
||||
})
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
'use strict'
|
||||
|
||||
const test = require('tape')
|
||||
const tap = require('tap')
|
||||
const parse = require('../../parse/operator')
|
||||
|
||||
const ctx = {
|
||||
|
@ -8,14 +8,14 @@ const ctx = {
|
|||
opt: {},
|
||||
profile: {}
|
||||
}
|
||||
test('parses an operator correctly', (t) => {
|
||||
tap.test('parses an operator correctly', (t) => {
|
||||
const op = {
|
||||
"name": "Berliner Verkehrsbetriebe",
|
||||
"icoX": 1,
|
||||
"id": "Berliner Verkehrsbetriebe"
|
||||
}
|
||||
|
||||
t.deepEqual(parse(ctx, op), {
|
||||
t.same(parse(ctx, op), {
|
||||
type: 'operator',
|
||||
id: 'berliner-verkehrsbetriebe',
|
||||
name: 'Berliner Verkehrsbetriebe'
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
'use strict'
|
||||
|
||||
const test = require('tape')
|
||||
const tap = require('tap')
|
||||
const parse = require('../../parse/warning')
|
||||
|
||||
const profile = {
|
||||
|
@ -13,7 +13,7 @@ const ctx = {
|
|||
profile
|
||||
}
|
||||
|
||||
test('parses warnings correctly', (t) => {
|
||||
tap.test('parses warnings correctly', (t) => {
|
||||
const input = {
|
||||
hid: 'some warning ID', // todo: null
|
||||
head: 'some<br>summary', // todo: null
|
||||
|
@ -32,26 +32,26 @@ test('parses warnings correctly', (t) => {
|
|||
category: 1
|
||||
}
|
||||
|
||||
t.deepEqual(parse(ctx, input), expected)
|
||||
t.same(parse(ctx, input), expected)
|
||||
|
||||
// without basic fields
|
||||
t.deepEqual(parse(ctx, {...input, hid: null}), {...expected, id: null})
|
||||
t.deepEqual(parse(ctx, {...input, head: null}), {...expected, summary: null})
|
||||
t.deepEqual(parse(ctx, {...input, text: null}), {...expected, text: null})
|
||||
t.deepEqual(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.deepEqual(parse(ctx, {...input, icon: null}), {
|
||||
t.same(parse(ctx, {...input, icon: null}), {
|
||||
...expected, type: 'warning', icon: null
|
||||
})
|
||||
|
||||
// with products
|
||||
t.deepEqual(parse(ctx, {...input, prod: 123}), {
|
||||
t.same(parse(ctx, {...input, prod: 123}), {
|
||||
...expected, products: [123]
|
||||
})
|
||||
|
||||
// validFrom, validUntil, modified
|
||||
t.deepEqual(parse(ctx, {
|
||||
t.same(parse(ctx, {
|
||||
...input,
|
||||
sDate: '20190101', sTime: '094020',
|
||||
eDate: '20190101', eTime: '114020',
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
'use strict'
|
||||
|
||||
const test = require('tape')
|
||||
const tap = require('tap')
|
||||
const parse = require('../../parse/when')
|
||||
|
||||
const profile = {
|
||||
|
@ -15,7 +15,7 @@ const ctx = {
|
|||
profile
|
||||
}
|
||||
|
||||
test('parseWhen works correctly', (t) => {
|
||||
tap.test('parseWhen works correctly', (t) => {
|
||||
const date = '20190606'
|
||||
const timeS = '163000'
|
||||
const timeR = '163130'
|
||||
|
@ -26,15 +26,15 @@ test('parseWhen works correctly', (t) => {
|
|||
delay: 130 // seconds
|
||||
}
|
||||
|
||||
t.deepEqual(parse(ctx, date, timeS, timeR, tzOffset), expected)
|
||||
t.same(parse(ctx, date, timeS, timeR, tzOffset), expected)
|
||||
|
||||
// no realtime data
|
||||
t.deepEqual(parse(ctx, date, timeS, null, tzOffset), {
|
||||
t.same(parse(ctx, date, timeS, null, tzOffset), {
|
||||
...expected, when: expected.plannedWhen, delay: null
|
||||
})
|
||||
|
||||
// cancelled
|
||||
t.deepEqual(parse(ctx, date, timeS, timeR, tzOffset, true), {
|
||||
t.same(parse(ctx, date, timeS, timeR, tzOffset, true), {
|
||||
...expected,
|
||||
when: null,
|
||||
prognosedWhen: expected.when
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
'use strict'
|
||||
|
||||
const test = require('tape')
|
||||
const tap = require('tap')
|
||||
|
||||
const createClient = require('..')
|
||||
const rawProfile = require('../p/rejseplanen')
|
||||
|
@ -19,11 +19,11 @@ const opt = {
|
|||
when: '2020-07-11T16:49:00+02:00',
|
||||
}
|
||||
|
||||
test('parses a trip correctly (Rejseplanen)', (t) => {
|
||||
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)
|
||||
|
||||
t.deepEqual(trip, expected)
|
||||
t.same(trip, expected)
|
||||
t.end()
|
||||
})
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
'use strict'
|
||||
|
||||
const test = require('tape')
|
||||
const tap = require('tap')
|
||||
|
||||
const createClient = require('..')
|
||||
const withRetrying = require('../retry')
|
||||
|
@ -9,7 +9,7 @@ const vbbProfile = require('../p/vbb')
|
|||
const userAgent = 'public-transport/hafas-client:test'
|
||||
const spichernstr = '900000042101'
|
||||
|
||||
test('withRetrying works', (t) => {
|
||||
tap.test('withRetrying works', (t) => {
|
||||
// for the first 3 calls, return different kinds of errors
|
||||
let calls = 0
|
||||
const failingRequest = async (ctx, userAgent, reqData) => {
|
||||
|
@ -44,7 +44,7 @@ test('withRetrying works', (t) => {
|
|||
|
||||
t.plan(1 + 4)
|
||||
client.departures(spichernstr, {duration: 1})
|
||||
.then(deps => t.deepEqual(deps, [], 'resolved with invalid value'))
|
||||
.then(deps => t.same(deps, [], 'resolved with invalid value'))
|
||||
.catch(t.ifError)
|
||||
|
||||
setTimeout(() => t.equal(calls, 1), 50) // buffer
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
'use strict'
|
||||
|
||||
const test = require('tape')
|
||||
const tap = require('tap')
|
||||
|
||||
const createClient = require('..')
|
||||
const rawProfile = require('../p/rsag')
|
||||
|
@ -20,11 +20,11 @@ const opt = {
|
|||
products: {}
|
||||
}
|
||||
|
||||
test('parses a journey correctly (RSAG)', (t) => {
|
||||
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])
|
||||
|
||||
t.deepEqual(journey, expected)
|
||||
t.same(journey, expected)
|
||||
t.end()
|
||||
})
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
'use strict'
|
||||
|
||||
const test = require('tape')
|
||||
const tap = require('tap')
|
||||
|
||||
const createClient = require('..')
|
||||
const rawProfile = require('../p/sbb')
|
||||
|
@ -30,11 +30,11 @@ const opt = {
|
|||
products: {},
|
||||
}
|
||||
|
||||
test('parses a journeys() response correctly (SBB)', (t) => {
|
||||
tap.test('parses a journeys() response correctly (SBB)', (t) => {
|
||||
const common = profile.parseCommon({profile, opt, res})
|
||||
const ctx = {profile, opt, common, res}
|
||||
const journeys = res.outConL.map(j => profile.parseJourney(ctx, j))
|
||||
|
||||
t.deepEqual(journeys, expected)
|
||||
t.same(journeys, expected)
|
||||
t.end()
|
||||
})
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
'use strict'
|
||||
|
||||
const test = require('tape')
|
||||
const tap = require('tap')
|
||||
|
||||
const createClient = require('..')
|
||||
const withThrottling = require('../throttle')
|
||||
|
@ -10,7 +10,7 @@ const depsRes = require('./fixtures/vbb-departures.json')
|
|||
const ua = 'public-transport/hafas-client:test'
|
||||
const spichernstr = '900000042101'
|
||||
|
||||
test('withThrottling works', {timeout: 2600}, (t) => {
|
||||
tap.test('withThrottling works', {timeout: 3000}, (t) => {
|
||||
let calls = 0
|
||||
const mockedRequest = async (ctx, userAgent, reqData) => {
|
||||
calls++
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
'use strict'
|
||||
|
||||
const test = require('tape')
|
||||
const tap = require('tap')
|
||||
|
||||
const createClient = require('..')
|
||||
const rawProfile = require('../p/vbb')
|
||||
|
@ -21,11 +21,11 @@ const opt = {
|
|||
products: {}
|
||||
}
|
||||
|
||||
test('parses a departure correctly (VBB)', (t) => {
|
||||
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))
|
||||
|
||||
t.deepEqual(departures, expected)
|
||||
t.same(departures, expected)
|
||||
t.end()
|
||||
})
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
'use strict'
|
||||
|
||||
const test = require('tape')
|
||||
const tap = require('tap')
|
||||
|
||||
const createClient = require('..')
|
||||
const rawProfile = require('../p/vbb')
|
||||
|
@ -30,11 +30,11 @@ const opt = {
|
|||
products: {},
|
||||
}
|
||||
|
||||
test('parses a journeys() response correctly (VBB)', (t) => {
|
||||
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))
|
||||
|
||||
t.deepEqual(journeys, expected)
|
||||
t.same(journeys, expected)
|
||||
t.end()
|
||||
})
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
'use strict'
|
||||
|
||||
const test = require('tape')
|
||||
const tap = require('tap')
|
||||
|
||||
const createClient = require('..')
|
||||
const rawProfile = require('../p/vsn')
|
||||
|
@ -28,11 +28,11 @@ const opt = {
|
|||
// products: {}
|
||||
}
|
||||
|
||||
test('parses departures correctly (VSN)', (t) => {
|
||||
tap.test('parses departures correctly (VSN)', (t) => {
|
||||
const common = profile.parseCommon({profile, opt, res})
|
||||
const ctx = {profile, opt, common, res}
|
||||
|
||||
const dep = profile.parseDeparture(ctx, res.jnyL[0])
|
||||
t.deepEqual(dep, expected)
|
||||
t.same(dep, expected)
|
||||
t.end()
|
||||
})
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
'use strict'
|
||||
|
||||
const test = require('tape')
|
||||
const tap = require('tap')
|
||||
|
||||
const createClient = require('..')
|
||||
const rawProfile = require('../p/vsn')
|
||||
|
@ -17,11 +17,11 @@ const opt = {
|
|||
products: null, // filter by affected products
|
||||
}
|
||||
|
||||
test('parses a remarks() response correctly (VSN)', (t) => {
|
||||
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))
|
||||
|
||||
t.deepEqual(warnings, expected)
|
||||
t.same(warnings, expected)
|
||||
t.end()
|
||||
})
|
||||
|
|
Loading…
Add table
Reference in a new issue