2024-02-06 22:58:49 +01:00
|
|
|
import tap from 'tap';
|
2021-08-05 19:32:41 +02:00
|
|
|
|
2024-02-06 22:58:49 +01:00
|
|
|
import {createWhen} from './lib/util.js';
|
|
|
|
import {createClient} from '../../index.js';
|
|
|
|
import {profile as oövvProfile} from '../../p/ooevv/index.js';
|
|
|
|
import {createValidateFptfWith as createValidate} from './lib/validate-fptf-with.js';
|
2021-08-05 19:32:41 +02:00
|
|
|
|
2024-02-06 22:58:49 +01:00
|
|
|
const T_MOCK = 1671260400 * 1000; // 2022-12-17T08:00:00+01:00
|
|
|
|
const when = createWhen(oövvProfile.timezone, oövvProfile.locale, T_MOCK);
|
2022-04-23 14:40:51 +02:00
|
|
|
|
2021-08-05 19:32:41 +02:00
|
|
|
const cfg = {
|
|
|
|
when,
|
|
|
|
stationCoordsOptional: false,
|
|
|
|
products: oövvProfile.products,
|
|
|
|
maxLatitude: 49.7921,
|
|
|
|
maxLongitude: 17.0892,
|
|
|
|
minLatitude: 45.7206,
|
|
|
|
minLongitude: 7.8635,
|
2024-02-06 22:58:49 +01:00
|
|
|
};
|
|
|
|
const validate = createValidate(cfg);
|
2021-08-05 19:32:41 +02:00
|
|
|
|
2024-02-06 22:58:49 +01:00
|
|
|
const client = createClient(oövvProfile, 'public-transport/hafas-client:test');
|
2021-08-05 19:32:41 +02:00
|
|
|
|
2024-02-06 22:58:49 +01:00
|
|
|
const linzTheatergasse = '444670100';
|
2021-08-05 19:32:41 +02:00
|
|
|
|
|
|
|
tap.test('locations named "theatergasse"', async (t) => {
|
2024-02-06 22:58:49 +01:00
|
|
|
const locations = await client.locations('theatergasse');
|
2021-08-05 19:32:41 +02:00
|
|
|
|
2024-02-06 22:58:49 +01:00
|
|
|
validate(t, locations, 'locations', 'locations');
|
2021-08-05 19:32:41 +02:00
|
|
|
t.ok(locations.some((l) => {
|
2024-02-06 22:58:49 +01:00
|
|
|
return l.station && l.station.id === linzTheatergasse || l.id === linzTheatergasse;
|
|
|
|
}), 'Linz Theatergasse not found');
|
2021-08-05 19:32:41 +02:00
|
|
|
|
2024-02-06 22:58:49 +01:00
|
|
|
t.end();
|
|
|
|
});
|