CFL tests: ignore missing direction

This commit is contained in:
Jannis R 2018-06-11 20:50:35 +02:00 committed by Jannis Redmann
parent 75432fcf4c
commit d5f9675c2a

View file

@ -10,6 +10,8 @@ const createClient = require('..')
const cflProfile = require('../p/cfl')
const products = require('../p/cfl/products')
const {
line: createValidateLine,
journeyLeg: createValidateJourneyLeg,
movement: _validateMovement
} = require('./lib/validators')
const createValidate = require('./lib/validate-fptf-with')
@ -32,6 +34,18 @@ const cfg = {
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') => {
// todo: fix this upstream
const withFakeLocation = Object.assign({}, m)
@ -48,6 +62,8 @@ const validateMovement = (val, m, name = 'movement') => {
}
const validate = createValidate(cfg, {
line: validateLine,
journeyLeg: validateJourneyLeg,
movement: validateMovement
})
@ -130,7 +146,7 @@ test('Luxembourg to Centre Hospitalier du Nord', async (t) => {
res,
validate,
fromId: luxembourg,
to: kloster
to: centreHospitalier
})
t.end()
})