2022-05-07 16:17:37 +02:00
|
|
|
import tap from 'tap'
|
2021-11-27 23:41:40 +01:00
|
|
|
|
2022-05-07 16:17:37 +02:00
|
|
|
import {createWhen} from './lib/util.js'
|
|
|
|
import {createClient} from '../../index.js'
|
|
|
|
import {profile as kvbProfile} from '../../p/kvb/index.js'
|
|
|
|
import {createValidateFptfWith as createValidate} from './lib/validate-fptf-with.js'
|
2021-11-27 23:41:40 +01:00
|
|
|
|
2022-04-23 14:40:51 +02:00
|
|
|
const T_MOCK = 1641897000 * 1000 // 2022-01-11T11:30:00+01
|
|
|
|
const when = createWhen(kvbProfile.timezone, kvbProfile.locale, T_MOCK)
|
|
|
|
|
2021-11-27 23:41:40 +01:00
|
|
|
const cfg = {
|
|
|
|
when,
|
|
|
|
stationCoordsOptional: false,
|
|
|
|
products: kvbProfile.products,
|
|
|
|
maxLatitude: 51.6479,
|
|
|
|
maxLongitude: 7.8333,
|
|
|
|
minLatitude: 50.3253,
|
|
|
|
minLongitude: 6.2320,
|
|
|
|
}
|
|
|
|
const validate = createValidate(cfg)
|
|
|
|
|
|
|
|
const client = createClient(kvbProfile, 'public-transport/hafas-client:test')
|
|
|
|
|
|
|
|
const heumarkt = '900000001'
|
|
|
|
|
|
|
|
tap.test('locations named "heumarkt"', async (t) => {
|
|
|
|
const locations = await client.locations('heumarkt')
|
|
|
|
|
|
|
|
validate(t, locations, 'locations', 'locations')
|
|
|
|
t.ok(locations.some((l) => {
|
|
|
|
return l.station && l.station.id === heumarkt || l.id === heumarkt
|
|
|
|
}), 'Heumarkt not found')
|
|
|
|
|
|
|
|
t.end()
|
|
|
|
})
|