db-vendo-client/test/e2e/ivb.js

36 lines
1 KiB
JavaScript
Raw Normal View History

2022-05-07 16:17:37 +02:00
import tap from 'tap'
2021-08-05 19:06:03 +02:00
2022-05-07 16:17:37 +02:00
import {createWhen} from './lib/util.js'
import {createClient} from '../../index.js'
import {profile as ivbProfile} from '../../p/ivb/index.js'
import {createValidateFptfWith as createValidate} from './lib/validate-fptf-with.js'
2021-08-05 19:06:03 +02:00
const T_MOCK = 1671260400 * 1000 // 2022-12-17T08:00:00+01:00
const when = createWhen(ivbProfile.timezone, ivbProfile.locale, T_MOCK)
2021-08-05 19:06:03 +02:00
const cfg = {
when,
stationCoordsOptional: false,
products: ivbProfile.products,
maxLatitude: 47.9504,
maxLongitude: 17.0892,
minLatitude: 45.7206,
minLongitude: 7.8635,
}
const validate = createValidate(cfg)
const client = createClient(ivbProfile, 'public-transport/hafas-client:test')
const innsbruckGriesauweg = '476162400'
tap.test('locations named "griesauweg"', async (t) => {
const locations = await client.locations('griesauweg')
validate(t, locations, 'locations', 'locations')
t.ok(locations.some((l) => {
return l.station && l.station.id === innsbruckGriesauweg || l.id === innsbruckGriesauweg
}), 'Innsbruck Griesauweg not found')
t.end()
})