mirror of
https://github.com/public-transport/db-vendo-client.git
synced 2025-02-23 23:29:35 +02:00
CFL tests: ignore missing direction
This commit is contained in:
parent
75432fcf4c
commit
d5f9675c2a
1 changed files with 17 additions and 1 deletions
18
test/cfl.js
18
test/cfl.js
|
@ -10,6 +10,8 @@ const createClient = require('..')
|
||||||
const cflProfile = require('../p/cfl')
|
const cflProfile = require('../p/cfl')
|
||||||
const products = require('../p/cfl/products')
|
const products = require('../p/cfl/products')
|
||||||
const {
|
const {
|
||||||
|
line: createValidateLine,
|
||||||
|
journeyLeg: createValidateJourneyLeg,
|
||||||
movement: _validateMovement
|
movement: _validateMovement
|
||||||
} = require('./lib/validators')
|
} = require('./lib/validators')
|
||||||
const createValidate = require('./lib/validate-fptf-with')
|
const createValidate = require('./lib/validate-fptf-with')
|
||||||
|
@ -32,6 +34,18 @@ const cfg = {
|
||||||
maxLongitude: 14.07
|
maxLongitude: 14.07
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const _validateLine = createValidateLine(cfg)
|
||||||
|
const validateLine = (validate, l, name) => {
|
||||||
|
if (!l.direction) l = Object.assign({}, l, {direction: 'foo'})
|
||||||
|
_validateLine(validate, l, name)
|
||||||
|
}
|
||||||
|
|
||||||
|
const _validateJourneyLeg = createValidateJourneyLeg(cfg)
|
||||||
|
const validateJourneyLeg = (validate, l, name) => {
|
||||||
|
if (!l.direction) l = Object.assign({}, l, {direction: 'foo'})
|
||||||
|
_validateJourneyLeg(validate, l, name)
|
||||||
|
}
|
||||||
|
|
||||||
const validateMovement = (val, m, name = 'movement') => {
|
const validateMovement = (val, m, name = 'movement') => {
|
||||||
// todo: fix this upstream
|
// todo: fix this upstream
|
||||||
const withFakeLocation = Object.assign({}, m)
|
const withFakeLocation = Object.assign({}, m)
|
||||||
|
@ -48,6 +62,8 @@ const validateMovement = (val, m, name = 'movement') => {
|
||||||
}
|
}
|
||||||
|
|
||||||
const validate = createValidate(cfg, {
|
const validate = createValidate(cfg, {
|
||||||
|
line: validateLine,
|
||||||
|
journeyLeg: validateJourneyLeg,
|
||||||
movement: validateMovement
|
movement: validateMovement
|
||||||
})
|
})
|
||||||
|
|
||||||
|
@ -130,7 +146,7 @@ test('Luxembourg to Centre Hospitalier du Nord', async (t) => {
|
||||||
res,
|
res,
|
||||||
validate,
|
validate,
|
||||||
fromId: luxembourg,
|
fromId: luxembourg,
|
||||||
to: kloster
|
to: centreHospitalier
|
||||||
})
|
})
|
||||||
t.end()
|
t.end()
|
||||||
})
|
})
|
||||||
|
|
Loading…
Add table
Reference in a new issue