diff --git a/test/db.js b/test/db.js index b60a4aa7..d8a7d640 100644 --- a/test/db.js +++ b/test/db.js @@ -312,5 +312,10 @@ test('location', co(function* (t) { assertValidStation(t, loc) t.equal(loc.id, regensburgHbf) + t.ok(Array.isArray(loc.lines)) + if (Array.isArray(loc.lines)) { + for (let line of loc.lines) assertValidLine(t, line) + } + t.end() })) diff --git a/test/util.js b/test/util.js index d338f9bb..fbd0d8c5 100644 --- a/test/util.js +++ b/test/util.js @@ -6,9 +6,11 @@ const {DateTime} = require('luxon') const isValidWGS84 = require('is-coordinates') const validateFptfWith = (t, item, allowedTypes, name) => { - t.doesNotThrow(() => { + try { validateFptf.recurse(allowedTypes, item, name) - }) + } catch (err) { + t.ifError(err) + } } const assertValidStation = (t, s, coordsOptional = false) => { @@ -18,11 +20,6 @@ const assertValidStation = (t, s, coordsOptional = false) => { t.ok(s.location) assertValidLocation(t, s.location, coordsOptional) } - - if ('lines' in s) { - t.ok(Array.isArray(s.lines)) - for (let l of s.lines) assertValidLine(t, l) - } } const assertValidPoi = (t, p) => { diff --git a/test/vbb.js b/test/vbb.js index 95d34545..e24a1ef8 100644 --- a/test/vbb.js +++ b/test/vbb.js @@ -367,6 +367,11 @@ test('location', co(function* (t) { assertValidStation(t, loc) t.equal(loc.id, spichernstr) + t.ok(Array.isArray(loc.lines)) + if (Array.isArray(loc.lines)) { + for (let line of loc.lines) assertValidLine(t, line) + } + t.end() }))