mirror of
https://github.com/public-transport/db-vendo-client.git
synced 2025-04-20 23:23:56 +03:00
allow letting hafas decide the amount of vias
This commit is contained in:
parent
bb480cdb6a
commit
239c279573
2 changed files with 6 additions and 1 deletions
|
@ -11,7 +11,7 @@ const formatStationBoardReq = (ctx, station, type) => {
|
|||
zeit: profile.formatTimeOfDay(profile, opt.when),
|
||||
datum: profile.formatDate(profile, opt.when),
|
||||
mitVias: maxVias !== 0 ? true : undefined,
|
||||
maxVias,
|
||||
maxVias: maxVias === -1 ? undefined : maxVias,
|
||||
verkehrsmittel: profile.formatProductsFilter(ctx, opt.products || {}),
|
||||
},
|
||||
method: 'GET',
|
||||
|
|
|
@ -62,6 +62,11 @@ tap.test('formats an arrivals() request with different vias option', (t) => {
|
|||
t.equal(reqViasNull.query.mitVias, undefined);
|
||||
t.equal(reqViasNull.query.maxVias, 0);
|
||||
|
||||
ctx.opt.vias = -1;
|
||||
const reqViasUnlimited = profile.formatStationBoardReq(ctx, '8011160', 'arrivals');
|
||||
t.equal(reqViasUnlimited.query.mitVias, true);
|
||||
t.equal(reqViasUnlimited.query.maxVias, undefined);
|
||||
|
||||
ctx.opt.vias = 42;
|
||||
const reqViasFourtyTwo = profile.formatStationBoardReq(ctx, '8011160', 'arrivals');
|
||||
t.equal(reqViasFourtyTwo.query.mitVias, true);
|
||||
|
|
Loading…
Add table
Reference in a new issue