mirror of
https://github.com/public-transport/db-vendo-client.git
synced 2025-02-23 15:19:35 +02:00
fix tests 💚
This commit is contained in:
parent
d8bc5d2bd8
commit
ef40e827ae
4 changed files with 9 additions and 9 deletions
|
@ -10,14 +10,14 @@ const journeysFailsWithNoProduct = (cfg) => {
|
||||||
products
|
products
|
||||||
} = cfg
|
} = cfg
|
||||||
|
|
||||||
const productsObj = Object.create(null)
|
const noProducts = Object.create(null)
|
||||||
for (let p of products) productsObj[p.id] = false
|
for (let p of products) noProducts[p.id] = false
|
||||||
|
|
||||||
t.throws(() => {
|
t.throws(() => {
|
||||||
client.journeys(fromId, toId, {departure: when, products})
|
fetchJourneys(fromId, toId, {departure: when, products: noProducts})
|
||||||
// silence rejections, we're only interested in exceptions
|
// silence rejections, we're only interested in exceptions
|
||||||
.catch(() => {})
|
.catch(() => {})
|
||||||
})
|
}, 'no products used')
|
||||||
}
|
}
|
||||||
|
|
||||||
module.exports = journeysFailsWithNoProduct
|
module.exports = journeysFailsWithNoProduct
|
||||||
|
|
|
@ -332,7 +332,7 @@ const validateMovement = (val, m, name = 'movement') => {
|
||||||
a.ok(Array.isArray(m.nextStops), name + '.nextStops must be an array')
|
a.ok(Array.isArray(m.nextStops), name + '.nextStops must be an array')
|
||||||
for (let i = 0; i < m.nextStops.length; i++) {
|
for (let i = 0; i < m.nextStops.length; i++) {
|
||||||
const st = m.nextStops[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')
|
a.ok(Array.isArray(m.frames), name + '.frames must be an array')
|
||||||
|
|
|
@ -306,9 +306,9 @@ test('locations named Kiel', co(function* (t) {
|
||||||
validate(t, locations, 'locations', 'locations')
|
validate(t, locations, 'locations', 'locations')
|
||||||
t.ok(locations.length <= 20)
|
t.ok(locations.length <= 20)
|
||||||
|
|
||||||
t.ok(locations.find(s => s.type === 'stop' || s.type === 'station'))
|
t.ok(locations.find(l => l.type === 'stop' || l.type === 'station'))
|
||||||
t.ok(locations.find(s => s.id && s.name)) // POIs
|
t.ok(locations.find(l => l.id && l.name)) // POIs
|
||||||
t.ok(locations.some(l => l.station && s.station.id === kielHbf || l.id === kielHbf))
|
t.ok(locations.some(l => l.station && l.station.id === kielHbf || l.id === kielHbf))
|
||||||
|
|
||||||
t.end()
|
t.end()
|
||||||
}))
|
}))
|
||||||
|
|
|
@ -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.type === 'stop' || s.type === 'station'))
|
||||||
t.ok(locations.find(s => s.id && s.name)) // POIs
|
t.ok(locations.find(s => s.id && s.name)) // POIs
|
||||||
t.ok(locations.some((loc) => {
|
t.ok(locations.some((l) => {
|
||||||
// todo: trim IDs
|
// todo: trim IDs
|
||||||
if (l.station) {
|
if (l.station) {
|
||||||
if (l.station.id === '008010224' || l.station.id === bremenHbf) return true
|
if (l.station.id === '008010224' || l.station.id === bremenHbf) return true
|
||||||
|
|
Loading…
Add table
Reference in a new issue