mirror of
https://github.com/public-transport/db-vendo-client.git
synced 2025-02-23 15:19:35 +02:00
tests: fix messages ✅
This commit is contained in:
parent
d9126d531a
commit
b208a3dda4
3 changed files with 5 additions and 6 deletions
|
@ -107,7 +107,7 @@ test('journeys – only subway', co(function* (t) {
|
|||
for (let j = 0; j < journey.legs.length; j++) {
|
||||
const leg = journey.legs[j]
|
||||
|
||||
const name = `journeys[${i}].legs[${i}].line`
|
||||
const name = `journeys[${i}].legs[${j}].line`
|
||||
if (leg.line) {
|
||||
t.equal(leg.line.mode, 'train', name + '.mode is invalid')
|
||||
t.equal(leg.line.product, 'subway', name + '.product is invalid')
|
||||
|
|
|
@ -98,11 +98,11 @@ const createValidateStopover = (cfg) => {
|
|||
const validateStopover = (val, s, name = 'stopover') => {
|
||||
if (is(s.arrival)) {
|
||||
val.date(val, s.arrival, name + '.arrival')
|
||||
assertValidWhen(s.arrival, cfg.when, name)
|
||||
assertValidWhen(s.arrival, cfg.when, name + '.arrival')
|
||||
}
|
||||
if (is(s.departure)) {
|
||||
val.date(val, s.departure, name + '.departure')
|
||||
assertValidWhen(s.departure, cfg.when, name)
|
||||
assertValidWhen(s.departure, cfg.when, name + '.departure')
|
||||
}
|
||||
if (!is(s.arrival) && !is(s.departure)) {
|
||||
a.fail(name + ' contains neither arrival nor departure')
|
||||
|
@ -312,7 +312,7 @@ const createValidateArrivalOrDeparture = (type, cfg) => {
|
|||
|
||||
anyOf(['stop', 'station'], val, dep.stop, name + '.stop')
|
||||
|
||||
assertValidWhen(dep.when, cfg.when, name)
|
||||
assertValidWhen(dep.when, cfg.when, name + '.when')
|
||||
if (dep.delay !== null) {
|
||||
const msg = name + '.delay must be a number'
|
||||
a.strictEqual(typeof dep.delay, 'number', msg)
|
||||
|
|
|
@ -261,8 +261,7 @@ test('departures at Wien Leibenfrostgasse', co(function* (t) {
|
|||
|
||||
for (let i = 0; i < deps.length; i++) {
|
||||
const dep = deps[i]
|
||||
const msg = `deps[${i}].stop.id is invalid`
|
||||
t.ok(ids.includes(dep.stop.id, msg))
|
||||
t.ok(ids.includes(dep.stop.id), `deps[${i}].stop.id ("${dep.stop.id}") is invalid`)
|
||||
}
|
||||
|
||||
t.end()
|
||||
|
|
Loading…
Add table
Reference in a new issue