fix tests 💚

This commit is contained in:
Jannis R 2018-11-13 20:34:12 +01:00
parent d8bc5d2bd8
commit ef40e827ae
No known key found for this signature in database
GPG key ID: 0FE83946296A88A5
4 changed files with 9 additions and 9 deletions

View file

@ -10,14 +10,14 @@ const journeysFailsWithNoProduct = (cfg) => {
products
} = cfg
const productsObj = Object.create(null)
for (let p of products) productsObj[p.id] = false
const noProducts = Object.create(null)
for (let p of products) noProducts[p.id] = false
t.throws(() => {
client.journeys(fromId, toId, {departure: when, products})
fetchJourneys(fromId, toId, {departure: when, products: noProducts})
// silence rejections, we're only interested in exceptions
.catch(() => {})
})
}, 'no products used')
}
module.exports = journeysFailsWithNoProduct

View file

@ -332,7 +332,7 @@ const validateMovement = (val, m, name = 'movement') => {
a.ok(Array.isArray(m.nextStops), name + '.nextStops must be an array')
for (let i = 0; i < m.nextStops.length; i++) {
const st = m.nextStops[i]
val.stopover(val, m.nextStops[i], name + `.nextStops[${i}]`)
val.stopover(val, st, name + `.nextStops[${i}]`)
}
a.ok(Array.isArray(m.frames), name + '.frames must be an array')

View file

@ -306,9 +306,9 @@ test('locations named Kiel', co(function* (t) {
validate(t, locations, 'locations', 'locations')
t.ok(locations.length <= 20)
t.ok(locations.find(s => s.type === 'stop' || s.type === 'station'))
t.ok(locations.find(s => s.id && s.name)) // POIs
t.ok(locations.some(l => l.station && s.station.id === kielHbf || l.id === kielHbf))
t.ok(locations.find(l => l.type === 'stop' || l.type === 'station'))
t.ok(locations.find(l => l.id && l.name)) // POIs
t.ok(locations.some(l => l.station && l.station.id === kielHbf || l.id === kielHbf))
t.end()
}))

View file

@ -230,7 +230,7 @@ test.skip('locations named Magdeburg', co(function*(t) {
t.ok(locations.find(s => s.type === 'stop' || s.type === 'station'))
t.ok(locations.find(s => s.id && s.name)) // POIs
t.ok(locations.some((loc) => {
t.ok(locations.some((l) => {
// todo: trim IDs
if (l.station) {
if (l.station.id === '008010224' || l.station.id === bremenHbf) return true