mirror of
https://github.com/public-transport/db-vendo-client.git
synced 2025-06-07 04:42:34 +03:00
add unit test for implicitly unconstrained transfers
This commit is contained in:
parent
7147c51b28
commit
ef99283e02
1 changed files with 20 additions and 0 deletions
|
@ -114,3 +114,23 @@ tap.test('formats a journeys() request with BC correctly (DB)', (t) => {
|
|||
});
|
||||
t.end();
|
||||
});
|
||||
|
||||
tap.test('formats a journeys() request with unlimited transfers (DB)', (t) => {
|
||||
const _opt = {...opt};
|
||||
const ctx = {profile, opt: _opt};
|
||||
|
||||
ctx.opt.transfers = 0; // no transfers
|
||||
const reqZeroTransfers = profile.formatJourneysReq(ctx, '8098160', '8000284', new Date('2024-12-07T23:50:12+01:00'), true, null);
|
||||
t.same(reqZeroTransfers.body.maxUmstiege, 0);
|
||||
|
||||
ctx.opt.transfers = null; // unconstrained transfers implicit
|
||||
const reqUnlimitedTransfersImplicit = profile.formatJourneysReq(ctx, '8098160', '8000284', new Date('2024-12-07T23:50:12+01:00'), true, null);
|
||||
t.same(reqUnlimitedTransfersImplicit.body.maxUmstiege, undefined);
|
||||
|
||||
ctx.opt.transfers = -1; // unconstrained transfers explicit
|
||||
const reqUnlimitedTransfersExplicit = profile.formatJourneysReq(ctx, '8098160', '8000284', new Date('2024-12-07T23:50:12+01:00'), true, null);
|
||||
t.same(reqUnlimitedTransfersExplicit.body.maxUmstiege, undefined);
|
||||
|
||||
t.end();
|
||||
|
||||
});
|
||||
|
|
Loading…
Add table
Reference in a new issue