mirror of
https://github.com/public-transport/db-vendo-client.git
synced 2025-02-23 07:09:35 +02:00
BVG/VBB integration/E2E tests: don' try to identify stations ✅
This commit is contained in:
parent
3412a66f6a
commit
40ec157869
3 changed files with 5 additions and 39 deletions
|
@ -69,8 +69,7 @@
|
||||||
"replayer": "^2.2.3",
|
"replayer": "^2.2.3",
|
||||||
"tap-spec": "^5.0.0",
|
"tap-spec": "^5.0.0",
|
||||||
"tape": "^5.0.0",
|
"tape": "^5.0.0",
|
||||||
"validate-fptf": "^3.0.0",
|
"validate-fptf": "^3.0.0"
|
||||||
"vbb-stations-autocomplete": "^4.1.0"
|
|
||||||
},
|
},
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"lint": "eslint .",
|
"lint": "eslint .",
|
||||||
|
|
|
@ -2,8 +2,6 @@
|
||||||
|
|
||||||
// todo: DRY with vbb tests
|
// todo: DRY with vbb tests
|
||||||
|
|
||||||
const stations = require('vbb-stations-autocomplete')
|
|
||||||
const shorten = require('vbb-short-station-name')
|
|
||||||
const isRoughlyEqual = require('is-roughly-equal')
|
const isRoughlyEqual = require('is-roughly-equal')
|
||||||
const {DateTime} = require('luxon')
|
const {DateTime} = require('luxon')
|
||||||
const flatMap = require('lodash/flatMap')
|
const flatMap = require('lodash/flatMap')
|
||||||
|
@ -37,12 +35,6 @@ const testReachableFrom = require('./lib/reachable-from')
|
||||||
|
|
||||||
const when = cfg.when
|
const when = cfg.when
|
||||||
|
|
||||||
const validateDirection = (dir, name) => {
|
|
||||||
if (!stations(dir, true, false)[0]) {
|
|
||||||
console.error(name + `: station "${dir}" is unknown`)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
const validate = createValidate(cfg, {
|
const validate = createValidate(cfg, {
|
||||||
station: validateStation,
|
station: validateStation,
|
||||||
line: validateLine,
|
line: validateLine,
|
||||||
|
|
|
@ -1,8 +1,6 @@
|
||||||
'use strict'
|
'use strict'
|
||||||
|
|
||||||
const stations = require('vbb-stations-autocomplete')
|
|
||||||
const a = require('assert')
|
const a = require('assert')
|
||||||
const shorten = require('vbb-short-station-name')
|
|
||||||
const products = require('../../../p/bvg/products')
|
const products = require('../../../p/bvg/products')
|
||||||
|
|
||||||
const {createWhen} = require('./util')
|
const {createWhen} = require('./util')
|
||||||
|
@ -22,19 +20,8 @@ const cfg = {
|
||||||
products
|
products
|
||||||
}
|
}
|
||||||
|
|
||||||
const validateDirection = (dir, name) => {
|
|
||||||
if (!stations(dir, true, false)[0]) {
|
|
||||||
console.error(name + `: station "${dir}" is unknown`)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// todo: coordsOptional = false
|
// todo: coordsOptional = false
|
||||||
const _validateStation = createValidateStation(cfg)
|
const validateStation = createValidateStation(cfg)
|
||||||
const validateStation = (validate, s, name) => {
|
|
||||||
_validateStation(validate, s, name)
|
|
||||||
// todo: find station by ID
|
|
||||||
a.equal(s.name, shorten(s.name), name + '.name must be shortened')
|
|
||||||
}
|
|
||||||
|
|
||||||
const _validateLine = createValidateLine(cfg)
|
const _validateLine = createValidateLine(cfg)
|
||||||
const validateLine = (validate, l, name) => {
|
const validateLine = (validate, l, name) => {
|
||||||
|
@ -58,23 +45,11 @@ const validateLine = (validate, l, name) => {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const _validateJourneyLeg = createValidateJourneyLeg(cfg)
|
const validateJourneyLeg = createValidateJourneyLeg(cfg)
|
||||||
const validateJourneyLeg = (validate, l, name) => {
|
|
||||||
_validateJourneyLeg(validate, l, name)
|
|
||||||
if (!l.walking) validateDirection(l.direction, name + '.direction')
|
|
||||||
}
|
|
||||||
|
|
||||||
const _validateDeparture = createValidateDeparture(cfg)
|
const validateDeparture = createValidateDeparture(cfg)
|
||||||
const validateDeparture = (validate, dep, name) => {
|
|
||||||
_validateDeparture(validate, dep, name)
|
|
||||||
validateDirection(dep.direction, name + '.direction')
|
|
||||||
}
|
|
||||||
|
|
||||||
const _validateMovement = createValidateMovement(cfg)
|
const validateMovement = createValidateMovement(cfg)
|
||||||
const validateMovement = (validate, m, name) => {
|
|
||||||
_validateMovement(validate, m, name)
|
|
||||||
validateDirection(m.direction, name + '.direction')
|
|
||||||
}
|
|
||||||
|
|
||||||
module.exports = {
|
module.exports = {
|
||||||
cfg,
|
cfg,
|
||||||
|
|
Loading…
Add table
Reference in a new issue