db-vendo-client/test/lib/journeys-fails-with-no-product.js
2018-05-31 14:00:58 +02:00

23 lines
447 B
JavaScript

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