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

36 lines
1.1 KiB
JavaScript
Raw Permalink Normal View History

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