mirror of
https://github.com/public-transport/db-vendo-client.git
synced 2025-02-23 07:09:35 +02:00
43 lines
1.3 KiB
JavaScript
43 lines
1.3 KiB
JavaScript
|
'use strict'
|
||
|
|
||
|
const tap = require('tap')
|
||
|
|
||
|
const createClient = require('..')
|
||
|
const rawProfile = require('../p/db')
|
||
|
const resDTZOffset0 = require('./fixtures/db-journey-dtzoffset-0.json')
|
||
|
const resATZOffset0 = require('./fixtures/db-journey-atzoffset-0.json')
|
||
|
|
||
|
const client = createClient(rawProfile, 'public-transport/hafas-client:test')
|
||
|
const {profile} = client
|
||
|
|
||
|
const opt = {
|
||
|
stopovers: false,
|
||
|
tickets: false,
|
||
|
polylines: false,
|
||
|
subStops: true,
|
||
|
entrances: true,
|
||
|
remarks: true,
|
||
|
}
|
||
|
|
||
|
// https://github.com/public-transport/hafas-client/issues/237
|
||
|
|
||
|
tap.test('parses a journey whose first leg has a dTZOffset of 0 (#237)', (t) => {
|
||
|
const common = profile.parseCommon({profile, opt, res: resDTZOffset0})
|
||
|
const ctx = {profile, opt, common, res: resDTZOffset0}
|
||
|
const journey = profile.parseJourney(ctx, resDTZOffset0.outConL[0])
|
||
|
|
||
|
const firstLeg = journey.legs[0]
|
||
|
t.notOk(/Z$/.test(firstLeg.departure), 'firstLeg.departure has TZ offset "Z"')
|
||
|
t.end()
|
||
|
})
|
||
|
|
||
|
tap.test('parses a journey whose first leg has a aTZOffset of 0 (#237)', (t) => {
|
||
|
const common = profile.parseCommon({profile, opt, res: resATZOffset0})
|
||
|
const ctx = {profile, opt, common, res: resATZOffset0}
|
||
|
const journey = profile.parseJourney(ctx, resATZOffset0.outConL[0])
|
||
|
|
||
|
const lastLeg = journey.legs[0]
|
||
|
t.notOk(/Z$/.test(lastLeg.departure), 'lastLeg.departure has TZ offset "Z"')
|
||
|
t.end()
|
||
|
})
|