tests: fix messages

This commit is contained in:
Jannis R 2018-12-03 11:47:51 +01:00
parent d9126d531a
commit b208a3dda4
No known key found for this signature in database
GPG key ID: 0FE83946296A88A5
3 changed files with 5 additions and 6 deletions

View file

@ -107,7 +107,7 @@ test('journeys  only subway', co(function* (t) {
for (let j = 0; j < journey.legs.length; j++) { for (let j = 0; j < journey.legs.length; j++) {
const leg = journey.legs[j] const leg = journey.legs[j]
const name = `journeys[${i}].legs[${i}].line` const name = `journeys[${i}].legs[${j}].line`
if (leg.line) { if (leg.line) {
t.equal(leg.line.mode, 'train', name + '.mode is invalid') t.equal(leg.line.mode, 'train', name + '.mode is invalid')
t.equal(leg.line.product, 'subway', name + '.product is invalid') t.equal(leg.line.product, 'subway', name + '.product is invalid')

View file

@ -98,11 +98,11 @@ const createValidateStopover = (cfg) => {
const validateStopover = (val, s, name = 'stopover') => { const validateStopover = (val, s, name = 'stopover') => {
if (is(s.arrival)) { if (is(s.arrival)) {
val.date(val, s.arrival, name + '.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)) { if (is(s.departure)) {
val.date(val, s.departure, name + '.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)) { if (!is(s.arrival) && !is(s.departure)) {
a.fail(name + ' contains neither arrival nor 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') 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) { if (dep.delay !== null) {
const msg = name + '.delay must be a number' const msg = name + '.delay must be a number'
a.strictEqual(typeof dep.delay, 'number', msg) a.strictEqual(typeof dep.delay, 'number', msg)

View file

@ -261,8 +261,7 @@ test('departures at Wien Leibenfrostgasse', co(function* (t) {
for (let i = 0; i < deps.length; i++) { for (let i = 0; i < deps.length; i++) {
const dep = deps[i] const dep = deps[i]
const msg = `deps[${i}].stop.id is invalid` t.ok(ids.includes(dep.stop.id), `deps[${i}].stop.id ("${dep.stop.id}") is invalid`)
t.ok(ids.includes(dep.stop.id, msg))
} }
t.end() t.end()