mirror of
https://github.com/public-transport/db-vendo-client.git
synced 2025-02-22 22:59:35 +02:00
add priority where available as int (dbnav)
This commit is contained in:
parent
32792507ba
commit
911ac17510
4 changed files with 27 additions and 1 deletions
|
@ -45,8 +45,10 @@ const parseRemarks = (ctx, ref) => {
|
|||
if (remark.modDateTime || remark.letzteAktualisierung) {
|
||||
res.modified = ctx.profile.parseDateTime(ctx, null, remark.modDateTime || remark.letzteAktualisierung);
|
||||
}
|
||||
if (remark.priority) {
|
||||
res.priority = remark.priority;
|
||||
}
|
||||
// TODO fromStops, toStops = routeIdxFrom ??
|
||||
// TODO prio
|
||||
return res;
|
||||
})
|
||||
.filter(remark => remark.code != 'BEF' && remark.code != 'OP');
|
||||
|
|
1
test/fixtures/dbnav-refresh-journey.js
vendored
1
test/fixtures/dbnav-refresh-journey.js
vendored
|
@ -194,6 +194,7 @@ const dbNavJourney = {
|
|||
summary: 'Einstieg mit Rollstuhl stufenfrei',
|
||||
text: 'Einstieg mit Rollstuhl stufenfrei',
|
||||
type: 'hint',
|
||||
priority: 560,
|
||||
},
|
||||
{
|
||||
text: 'Intercity 2: visit www.bahn.de/ic2 for more information',
|
||||
|
|
4
test/fixtures/dbnav-trip.js
vendored
4
test/fixtures/dbnav-trip.js
vendored
|
@ -80,6 +80,7 @@ const dbTrip = {
|
|||
summary: 'As ag 84100 heading towards Nürnberg Hbf from here',
|
||||
text: 'As ag 84100 heading towards Nürnberg Hbf from here',
|
||||
type: 'hint',
|
||||
priority: 100,
|
||||
},
|
||||
],
|
||||
},
|
||||
|
@ -373,6 +374,7 @@ const dbTrip = {
|
|||
summary: 'As ag 63070 heading towards Nürnberg Hbf from here',
|
||||
text: 'As ag 63070 heading towards Nürnberg Hbf from here',
|
||||
type: 'hint',
|
||||
priority: 100,
|
||||
},
|
||||
],
|
||||
},
|
||||
|
@ -487,6 +489,7 @@ const dbTrip = {
|
|||
summary: 'vertraglicher Beförderer DB Regio (München Flughafen Terminal - Regensburg Hbf)',
|
||||
text: 'vertraglicher Beförderer DB Regio (München Flughafen Terminal - Regensburg Hbf)',
|
||||
type: 'hint',
|
||||
priority: 150,
|
||||
},
|
||||
{
|
||||
text: 'Number of bicycles conveyed limited',
|
||||
|
@ -499,6 +502,7 @@ const dbTrip = {
|
|||
summary: 'Behindertengerechte Ausstattung',
|
||||
text: 'Behindertengerechte Ausstattung',
|
||||
type: 'hint',
|
||||
priority: 560,
|
||||
},
|
||||
{
|
||||
text: 'power sockets for laptop',
|
||||
|
|
|
@ -216,6 +216,25 @@ tap.test('parses dbnav attributes correctly', (t) => {
|
|||
summary: 'Komfort Check-in possible (visit bahn.de/kci for more information)',
|
||||
text: 'Komfort Check-in possible (visit bahn.de/kci for more information)',
|
||||
type: 'hint',
|
||||
priority: 200,
|
||||
},
|
||||
];
|
||||
|
||||
t.same(parse(ctx, input), expected);
|
||||
t.end();
|
||||
});
|
||||
|
||||
tap.test('parses dbnav ruf attributes correctly', (t) => {
|
||||
const input = {
|
||||
attributNotizen: [{text: 'Tel. 0981-9714925, Anmeldung bis 90 Min. vor Abfahrt (Mo-So: 9-15 Uhr)', key: 'cB', priority: 1}],
|
||||
};
|
||||
const expected = [
|
||||
{
|
||||
code: 'cB',
|
||||
summary: 'Tel. 0981-9714925, Anmeldung bis 90 Min. vor Abfahrt (Mo-So: 9-15 Uhr)',
|
||||
text: 'Tel. 0981-9714925, Anmeldung bis 90 Min. vor Abfahrt (Mo-So: 9-15 Uhr)',
|
||||
type: 'warning',
|
||||
priority: 1,
|
||||
},
|
||||
];
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue