mirror of
https://github.com/public-transport/db-vendo-client.git
synced 2025-02-23 15:19:35 +02:00
E2E/integration tests: fix stopover & leg validation 🐛
This commit is contained in:
parent
c9f8cc680e
commit
b2a3ce4d66
1 changed files with 9 additions and 7 deletions
|
@ -123,10 +123,10 @@ const createValidateStopover = (cfg) => {
|
||||||
val.date(val, s.plannedDeparture, name + '.plannedDeparture')
|
val.date(val, s.plannedDeparture, name + '.plannedDeparture')
|
||||||
assertValidWhen(s.plannedDeparture, cfg.when, name + '.plannedDeparture')
|
assertValidWhen(s.plannedDeparture, cfg.when, name + '.plannedDeparture')
|
||||||
}
|
}
|
||||||
if (is(s.plannedArrival) && !is(s.arrival)) {
|
if (is(s.plannedArrival) && !is(s.arrival) && !s.cancelled) {
|
||||||
a.fail(name + ' has .plannedArrival but not .arrival')
|
a.fail(name + ' has .plannedArrival but not .arrival')
|
||||||
}
|
}
|
||||||
if (is(s.plannedDeparture) && !is(s.departure)) {
|
if (is(s.plannedDeparture) && !is(s.departure) && !s.cancelled) {
|
||||||
a.fail(name + ' has .plannedDeparture but not .departure')
|
a.fail(name + ' has .plannedDeparture but not .departure')
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -225,8 +225,8 @@ const createValidateJourneyLeg = (cfg) => {
|
||||||
// FPTF doesn't support cancelled journey legs yet.
|
// FPTF doesn't support cancelled journey legs yet.
|
||||||
// see https://github.com/public-transport/friendly-public-transport-format/issues/27
|
// see https://github.com/public-transport/friendly-public-transport-format/issues/27
|
||||||
// todo: remove once this is resolved upstream
|
// todo: remove once this is resolved upstream
|
||||||
fakeLeg.departure = leg.formerScheduledDeparture
|
fakeLeg.departure = leg.plannedDeparture
|
||||||
fakeLeg.arrival = leg.formerScheduledArrival
|
fakeLeg.arrival = leg.plannedArrival
|
||||||
}
|
}
|
||||||
defaultValidators.journeyLeg(val, fakeLeg, name)
|
defaultValidators.journeyLeg(val, fakeLeg, name)
|
||||||
|
|
||||||
|
@ -272,9 +272,11 @@ const createValidateJourneyLeg = (cfg) => {
|
||||||
a.strictEqual(typeof leg.tripId, 'string', name + '.tripId must be a string')
|
a.strictEqual(typeof leg.tripId, 'string', name + '.tripId must be a string')
|
||||||
a.ok(leg.tripId, name + '.tripId must not be empty')
|
a.ok(leg.tripId, name + '.tripId must not be empty')
|
||||||
|
|
||||||
const msg = name + '.direction must be a string'
|
if (!leg.cancelled) {
|
||||||
a.strictEqual(typeof leg.direction, 'string', msg)
|
const msg = name + '.direction must be a string'
|
||||||
a.ok(leg.direction, name + '.direction must not be empty')
|
a.strictEqual(typeof leg.direction, 'string', msg)
|
||||||
|
a.ok(leg.direction, name + '.direction must not be empty')
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if ('cycle' in leg) {
|
if ('cycle' in leg) {
|
||||||
|
|
Loading…
Add table
Reference in a new issue