change dbweb-departures test covering enrichStation feature for stop and stopovers

This commit is contained in:
dabund24 2025-02-08 16:15:44 +01:00
parent 9a2308123f
commit 57ac6a98ee
3 changed files with 1614 additions and 6911 deletions

View file

@ -10,25 +10,83 @@ import {profile as rawProfile} from '../p/dbweb/index.js';
const res = require('./fixtures/dbweb-departures.json'); const res = require('./fixtures/dbweb-departures.json');
import {dbwebDepartures as expected} from './fixtures/dbweb-departures.js'; import {dbwebDepartures as expected} from './fixtures/dbweb-departures.js';
const client = createClient(rawProfile, 'public-transport/hafas-client:test', {enrichStations: false}); const client = createClient(rawProfile, 'public-transport/hafas-client:test', {enrichStations: true});
const {profile} = client; const {profile} = client;
const opt = { const opt = {
direction: null, direction: null,
duration: 10, duration: null,
linesOfStops: true, linesOfStops: true,
remarks: true, remarks: true,
stopovers: true, stopovers: true,
includeRelatedStations: true, includeRelatedStations: true,
when: '2025-02-05T15:00:00', when: '2025-02-08T15:37:00',
products: {}, products: {},
vias: 5, };
const osterburken = {
type: 'station',
id: '8000295',
name: 'Osterburken',
location: {
type: 'location',
id: '8000295',
latitude: 49.42992,
longitude: 9.422996,
},
products: {
nationalExpress: false,
national: false,
regionalExp: false,
regional: true,
suburban: true,
bus: true,
ferry: false,
subway: false,
tram: false,
taxi: true,
},
weight: 5.6,
};
const moeckmuehl = {
type: 'station',
id: '8004050',
name: 'Möckmühl',
location: {
type: 'location',
id: '8004050',
latitude: 49.321187,
longitude: 9.357977,
},
products: {
nationalExpress: false,
national: false,
regionalExp: false,
regional: true,
suburban: false,
bus: true,
ferry: false,
subway: false,
tram: false,
taxi: false,
},
distance: 2114,
weight: 6.45,
};
const common = {
locations: {
Osterburken: osterburken,
8000295: osterburken,
Möckmühl: moeckmuehl,
},
}; };
tap.test('parses a dbweb departure correctly', (t) => { tap.test('parses a dbweb departure correctly', (t) => {
const ctx = {profile, opt, common: null, res}; const ctx = {profile, opt, common, res};
const departures = res.entries.map(d => profile.parseDeparture(ctx, d)); const departures = res.entries.map(d => profile.parseDeparture(ctx, d));
// t.same(departures, expected); t.same(departures, expected);
t.end(); t.end();
}); });

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff