2018-04-25 13:07:31 +02:00
|
|
|
'use strict'
|
|
|
|
|
|
|
|
const journeysFailsWithNoProduct = (cfg) => {
|
|
|
|
const {
|
|
|
|
test: t,
|
|
|
|
fetchJourneys,
|
|
|
|
fromId,
|
|
|
|
toId,
|
|
|
|
when,
|
|
|
|
products
|
|
|
|
} = cfg
|
|
|
|
|
2018-11-13 20:34:12 +01:00
|
|
|
const noProducts = Object.create(null)
|
|
|
|
for (let p of products) noProducts[p.id] = false
|
2018-04-25 13:07:31 +02:00
|
|
|
|
|
|
|
t.throws(() => {
|
2018-11-13 20:34:12 +01:00
|
|
|
fetchJourneys(fromId, toId, {departure: when, products: noProducts})
|
2018-04-25 13:07:31 +02:00
|
|
|
// silence rejections, we're only interested in exceptions
|
|
|
|
.catch(() => {})
|
2018-11-13 20:34:12 +01:00
|
|
|
}, 'no products used')
|
2018-04-25 13:07:31 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
module.exports = journeysFailsWithNoProduct
|