mirror of
https://github.com/public-transport/db-vendo-client.git
synced 2025-02-23 07:09:35 +02:00
remove E2E/integration opt.includeRelatedStations tests ✅
This commit is contained in:
parent
62843f79d4
commit
3d50a212b5
4 changed files with 0 additions and 81 deletions
|
@ -31,7 +31,6 @@ const testRefreshJourney = require('./lib/refresh-journey')
|
||||||
const journeysFailsWithNoProduct = require('./lib/journeys-fails-with-no-product')
|
const journeysFailsWithNoProduct = require('./lib/journeys-fails-with-no-product')
|
||||||
const testDepartures = require('./lib/departures')
|
const testDepartures = require('./lib/departures')
|
||||||
const testDeparturesInDirection = require('./lib/departures-in-direction')
|
const testDeparturesInDirection = require('./lib/departures-in-direction')
|
||||||
const testDeparturesWithoutRelatedStations = require('./lib/departures-without-related-stations')
|
|
||||||
const testArrivals = require('./lib/arrivals')
|
const testArrivals = require('./lib/arrivals')
|
||||||
const testJourneysWithDetour = require('./lib/journeys-with-detour')
|
const testJourneysWithDetour = require('./lib/journeys-with-detour')
|
||||||
const testReachableFrom = require('./lib/reachable-from')
|
const testReachableFrom = require('./lib/reachable-from')
|
||||||
|
@ -353,19 +352,6 @@ test('departures at 7-digit station', async (t) => {
|
||||||
t.end()
|
t.end()
|
||||||
})
|
})
|
||||||
|
|
||||||
// todo: `opt.includeRelatedStations` is currently not supported by BVG
|
|
||||||
test.skip('departures without related stations', async (t) => {
|
|
||||||
await testDeparturesWithoutRelatedStations({
|
|
||||||
test: t,
|
|
||||||
fetchDepartures: client.departures,
|
|
||||||
id: '900000024101', // Charlottenburg
|
|
||||||
when,
|
|
||||||
products: {bus: false, suburban: false, regional: false},
|
|
||||||
linesOfRelatedStations: ['U7']
|
|
||||||
})
|
|
||||||
t.end()
|
|
||||||
})
|
|
||||||
|
|
||||||
test('arrivals', async (t) => {
|
test('arrivals', async (t) => {
|
||||||
const arrivals = await client.arrivals(spichernstr, {
|
const arrivals = await client.arrivals(spichernstr, {
|
||||||
duration: 5, when
|
duration: 5, when
|
||||||
|
|
|
@ -22,7 +22,6 @@ const testRefreshJourney = require('./lib/refresh-journey')
|
||||||
const journeysFailsWithNoProduct = require('./lib/journeys-fails-with-no-product')
|
const journeysFailsWithNoProduct = require('./lib/journeys-fails-with-no-product')
|
||||||
const testDepartures = require('./lib/departures')
|
const testDepartures = require('./lib/departures')
|
||||||
const testDeparturesInDirection = require('./lib/departures-in-direction')
|
const testDeparturesInDirection = require('./lib/departures-in-direction')
|
||||||
const testDeparturesWithoutRelatedStations = require('./lib/departures-without-related-stations')
|
|
||||||
const testArrivals = require('./lib/arrivals')
|
const testArrivals = require('./lib/arrivals')
|
||||||
const testJourneysWithDetour = require('./lib/journeys-with-detour')
|
const testJourneysWithDetour = require('./lib/journeys-with-detour')
|
||||||
const testReachableFrom = require('./lib/reachable-from')
|
const testReachableFrom = require('./lib/reachable-from')
|
||||||
|
@ -321,20 +320,6 @@ test('departures at Berlin Hbf in direction of Berlin Ostbahnhof', async (t) =>
|
||||||
t.end()
|
t.end()
|
||||||
})
|
})
|
||||||
|
|
||||||
test('departures without related stations', async (t) => {
|
|
||||||
await pStations
|
|
||||||
|
|
||||||
await testDeparturesWithoutRelatedStations({
|
|
||||||
test: t,
|
|
||||||
fetchDepartures: client.departures,
|
|
||||||
id: '8089051', // Berlin Yorckstr. (S1)
|
|
||||||
when,
|
|
||||||
products: {bus: false},
|
|
||||||
linesOfRelatedStations: ['S 2', 'S 25', 'S 26', 'U 7']
|
|
||||||
})
|
|
||||||
t.end()
|
|
||||||
})
|
|
||||||
|
|
||||||
test('arrivals at Berlin Schwedter Str.', async (t) => {
|
test('arrivals at Berlin Schwedter Str.', async (t) => {
|
||||||
await pStations
|
await pStations
|
||||||
|
|
||||||
|
|
|
@ -1,39 +0,0 @@
|
||||||
'use strict'
|
|
||||||
|
|
||||||
const testDeparturesWithoutUnrelatedStations = async (cfg) => {
|
|
||||||
const {
|
|
||||||
test: t,
|
|
||||||
fetchDepartures,
|
|
||||||
id,
|
|
||||||
when
|
|
||||||
// duration, products
|
|
||||||
} = cfg
|
|
||||||
|
|
||||||
const relatedLines = cfg.linesOfRelatedStations
|
|
||||||
.map(lName => lName.toLowerCase().trim())
|
|
||||||
|
|
||||||
const isUnrelatedLine = (dep) => {
|
|
||||||
if (!dep.line || !dep.line.name) return false
|
|
||||||
return relatedLines.includes(dep.line.name.toLowerCase().trim())
|
|
||||||
}
|
|
||||||
|
|
||||||
const depsWith = await fetchDepartures(id, {
|
|
||||||
when,
|
|
||||||
duration: cfg.duration || 20,
|
|
||||||
products: cfg.products || {}
|
|
||||||
})
|
|
||||||
t.ok(depsWith.some(isUnrelatedLine), 'precondition failed: no line at related station found')
|
|
||||||
|
|
||||||
const depsWithout = await fetchDepartures(id, {
|
|
||||||
includeRelatedStations: false,
|
|
||||||
when,
|
|
||||||
duration: cfg.duration || 20,
|
|
||||||
products: cfg.products || {}
|
|
||||||
})
|
|
||||||
|
|
||||||
const unrelatedDep = depsWithout.find(isUnrelatedLine)
|
|
||||||
if (unrelatedDep) t.fail('line at related station: ' + unrelatedDep.line.name)
|
|
||||||
else t.pass('no lines from related stations')
|
|
||||||
}
|
|
||||||
|
|
||||||
module.exports = testDeparturesWithoutUnrelatedStations
|
|
|
@ -22,7 +22,6 @@ const testRefreshJourney = require('./lib/refresh-journey')
|
||||||
const journeysFailsWithNoProduct = require('./lib/journeys-fails-with-no-product')
|
const journeysFailsWithNoProduct = require('./lib/journeys-fails-with-no-product')
|
||||||
const testDepartures = require('./lib/departures')
|
const testDepartures = require('./lib/departures')
|
||||||
const testDeparturesInDirection = require('./lib/departures-in-direction')
|
const testDeparturesInDirection = require('./lib/departures-in-direction')
|
||||||
const testDeparturesWithoutRelatedStations = require('./lib/departures-without-related-stations')
|
|
||||||
const testArrivals = require('./lib/arrivals')
|
const testArrivals = require('./lib/arrivals')
|
||||||
const testJourneysWithDetour = require('./lib/journeys-with-detour')
|
const testJourneysWithDetour = require('./lib/journeys-with-detour')
|
||||||
const testReachableFrom = require('./lib/reachable-from')
|
const testReachableFrom = require('./lib/reachable-from')
|
||||||
|
@ -296,18 +295,6 @@ test('departures at 7-digit station', async (t) => {
|
||||||
t.end()
|
t.end()
|
||||||
})
|
})
|
||||||
|
|
||||||
test('departures without related stations', async (t) => {
|
|
||||||
await testDeparturesWithoutRelatedStations({
|
|
||||||
test: t,
|
|
||||||
fetchDepartures: client.departures,
|
|
||||||
id: '900000024101', // Charlottenburg
|
|
||||||
when,
|
|
||||||
products: {bus: false, suburban: false, regional: false},
|
|
||||||
linesOfRelatedStations: ['U7']
|
|
||||||
})
|
|
||||||
t.end()
|
|
||||||
})
|
|
||||||
|
|
||||||
test('arrivals', async (t) => {
|
test('arrivals', async (t) => {
|
||||||
const arrivals = await client.arrivals(spichernstr, {
|
const arrivals = await client.arrivals(spichernstr, {
|
||||||
duration: 5, when,
|
duration: 5, when,
|
||||||
|
|
Loading…
Add table
Reference in a new issue