db-vendo-client/test/e2e/lib/journeys-fails-with-no-product.js

24 lines
475 B
JavaScript
Raw Normal View History

'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
t.throws(() => {
2018-11-13 20:34:12 +01:00
fetchJourneys(fromId, toId, {departure: when, products: noProducts})
// silence rejections, we're only interested in exceptions
.catch(() => {})
2018-11-13 20:34:12 +01:00
}, 'no products used')
}
module.exports = journeysFailsWithNoProduct