allow line.fahrtNr of null 💚

This commit is contained in:
Jannis R 2018-08-22 19:33:38 +02:00
parent 9257d3ad7d
commit 1f13f68926
No known key found for this signature in database
GPG key ID: 0FE83946296A88A5

View file

@ -83,8 +83,11 @@ const createValidateLine = (cfg) => {
const validateLine = (val, line, name = 'line') => {
defaultValidators.line(val, line, name)
a.strictEqual(typeof line.fahrtNr, 'string', name + ' must be string')
a.ok(line.fahrtNr, name + ' must not be empty')
const msg = name + '.fahrtNr must be '
if (line.fahrtNr !== null) {
a.strictEqual(typeof line.fahrtNr, 'string', msg + 'a string')
a.ok(line.fahrtNr, msg + ' be empty')
}
a.ok(validLineModes.includes(line.mode), name + '.mode is invalid')
}