db-vendo-client/test/vbb-departures.js

32 lines
785 B
JavaScript
Raw Permalink Normal View History

2019-08-19 20:42:19 +02:00
'use strict'
2021-05-20 16:42:43 +01:00
const tap = require('tap')
2019-08-19 20:42:19 +02:00
const createClient = require('..')
const rawProfile = require('../p/vbb')
2019-10-25 23:42:17 +02:00
const res = require('./fixtures/vbb-departures.json')
2019-08-19 20:42:19 +02:00
const expected = require('./fixtures/vbb-departures.js')
const client = createClient(rawProfile, 'public-transport/hafas-client:test')
const {profile} = client
const opt = {
direction: null,
duration: 10,
linesOfStops: true,
remarks: true,
stopovers: true,
includeRelatedStations: true,
when: '2021-10-12T17:42:00+02:00',
2019-08-19 20:42:19 +02:00
products: {}
}
2021-05-20 16:42:43 +01:00
tap.test('parses a departure correctly (VBB)', (t) => {
2019-10-25 23:42:17 +02:00
const common = profile.parseCommon({profile, opt, res})
const ctx = {profile, opt, common, res}
const departures = res.jnyL.map(d => profile.parseDeparture(ctx, d))
2019-08-19 20:42:19 +02:00
2021-05-20 16:42:43 +01:00
t.same(departures, expected)
2019-08-19 20:42:19 +02:00
t.end()
})