add integration tests for bahn.de boards

This commit is contained in:
dabund24 2025-02-05 17:01:31 +01:00
parent 1089475ff4
commit bb480cdb6a
6 changed files with 8307 additions and 5 deletions

View file

@ -7,8 +7,8 @@ import tap from 'tap';
import {createClient} from '../index.js';
import {profile as rawProfile} from '../p/db/index.js';
const res = require('./fixtures/db-departures-regio-guide.json');
import {dbDepartures as expected} from './fixtures/db-departures-regio-guide.js';
const res = require('./fixtures/db-departures.json');
import {dbDepartures as expected} from './fixtures/db-departures.js';
const client = createClient(rawProfile, 'public-transport/hafas-client:test', {enrichStations: false});
const {profile} = client;
@ -20,13 +20,14 @@ const opt = {
remarks: true,
stopovers: true,
includeRelatedStations: true,
when: '2019-08-19T20:30:00+02:00',
when: '2025-02-05T15:00:00',
products: {},
vias: 5,
};
tap.test('parses a regio-guide departure correctly', (t) => {
tap.test('parses a db departure correctly', (t) => {
const ctx = {profile, opt, common: null, res};
const departures = res.items.map(d => profile.parseDeparture(ctx, d));
const departures = res.entries.map(d => profile.parseDeparture(ctx, d));
t.same(departures, expected);
t.end();

File diff suppressed because one or more lines are too long

4267
test/fixtures/db-departures.js vendored Normal file

File diff suppressed because it is too large Load diff

2785
test/fixtures/db-departures.json vendored Normal file

File diff suppressed because it is too large Load diff

View file

@ -33,6 +33,7 @@ const dbnavDepartures = [
remarks: [],
origin: null,
destination: null,
vias: undefined,
},
{
tripId: '2|#VN#1#ST#1734722398#PI#1#ZI#214076#TA#1#DA#291224#1S#8005190#1T#1505#LS#8000091#LT#1520#PU#81#RT#1#CA#RB#ZE#58904#ZB#RB 58904#PC#3#FR#8005190#FT#1505#TO#8000091#TT#1520#',
@ -68,6 +69,7 @@ const dbnavDepartures = [
remarks: [],
origin: null,
destination: null,
vias: undefined,
},
{
tripId: '2|#VN#1#ST#1734722398#PI#1#ZI#863886#TA#3#DA#291224#1S#682943#1T#1450#LS#683407#LT#1531#PU#81#RT#1#CA#Bus#ZE#807#ZB#Bus 807#PC#5#FR#682943#FT#1450#TO#683407#TT#1531#',
@ -103,6 +105,7 @@ const dbnavDepartures = [
remarks: [],
origin: null,
destination: null,
vias: undefined,
},
{
tripId: '2|#VN#1#ST#1734722398#PI#1#ZI#863865#TA#0#DA#291224#1S#683407#1T#1532#LS#682943#LT#1624#PU#81#RT#1#CA#Bus#ZE#807#ZB#Bus 807#PC#5#FR#683407#FT#1532#TO#682943#TT#1624#',
@ -138,6 +141,7 @@ const dbnavDepartures = [
remarks: [],
origin: null,
destination: null,
vias: undefined,
},
{
tripId: '2|#VN#1#ST#1734722398#PI#1#ZI#863865#TA#0#DA#291224#1S#683407#1T#1532#LS#682943#LT#1624#PU#81#RT#1#CA#Bus#ZE#807#ZB#Bus 807#PC#5#FR#683407#FT#1532#TO#682943#TT#1624#',
@ -173,6 +177,7 @@ const dbnavDepartures = [
remarks: [],
origin: null,
destination: null,
vias: undefined,
},
{
tripId: '2|#VN#1#ST#1734722398#PI#1#ZI#864022#TA#1#DA#291224#1S#677019#1T#1458#LS#683407#LT#1548#PU#81#RT#1#CA#Bus#ZE#817#ZB#Bus 817#PC#5#FR#677019#FT#1458#TO#683407#TT#1548#',
@ -215,6 +220,7 @@ const dbnavDepartures = [
}],
origin: null,
destination: null,
vias: undefined,
cancelled: true,
},
];

View file

@ -43,6 +43,7 @@ const dbArrivals = [
name: 'Berlin Beusselstraße',
},
destination: null,
vias: undefined,
},
{
tripId: '20241208-89eeca5a-1768-3713-894a-dd088977f42b',
@ -94,6 +95,7 @@ const dbArrivals = [
name: 'Rudow (U), Berlin',
},
destination: null,
vias: undefined,
},
{
tripId: '20241208-2dc4f2d4-a1e1-3bbf-a607-98ff71c927d0',
@ -145,6 +147,7 @@ const dbArrivals = [
name: 'Goerdelersteg, Berlin',
},
destination: null,
vias: undefined,
},
{
tripId: '20241208-6fa6d37c-a1c0-3f84-bdac-0424705bffaf',
@ -190,6 +193,7 @@ const dbArrivals = [
name: 'Berlin Beusselstraße',
},
destination: null,
vias: undefined,
},
{
tripId: '20241208-c4abf007-d667-3bf1-87a8-2d1b153c014d',
@ -241,6 +245,7 @@ const dbArrivals = [
name: 'Rudow (U), Berlin',
},
destination: null,
vias: undefined,
},
{
tripId: '20241208-c8b6e3e4-6acb-3237-b89e-1fca72497555',
@ -286,6 +291,7 @@ const dbArrivals = [
name: 'Berlin Beusselstraße',
},
destination: null,
vias: undefined,
},
{
tripId: '20241208-f9d83ab7-d603-3344-87c0-a65ecf0f8524',
@ -337,6 +343,7 @@ const dbArrivals = [
name: 'Rathaus Spandau (S+U), Berlin',
},
destination: null,
vias: undefined,
},
];