From 104559d03d39e882fe6c366490cc0e7c81118479 Mon Sep 17 00:00:00 2001 From: Romain Thouvenin Date: Fri, 5 Apr 2024 11:44:10 +0200 Subject: [PATCH] Add a test for punctual search matching a recurrent driver schedule --- .../tests/unit/core/candidate.entity.spec.ts | 27 +++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/src/modules/ad/tests/unit/core/candidate.entity.spec.ts b/src/modules/ad/tests/unit/core/candidate.entity.spec.ts index c3af46f..bf1f5ef 100644 --- a/src/modules/ad/tests/unit/core/candidate.entity.spec.ts +++ b/src/modules/ad/tests/unit/core/candidate.entity.spec.ts @@ -550,6 +550,33 @@ describe('Candidate entity', () => { )[0].journeyItems[1].actorTimes[1].firstMinDatetime.getUTCMinutes(), ).toBe(42); }); + it('should create a journey for a punctual search from a recurrent driver schedule', () => { + const candidateEntity: CandidateEntity = CandidateEntity.create({ + id: '5600ccfb-ab69-4d03-aa30-0fbe84fcedc0', + role: Role.PASSENGER, + frequency: Frequency.PUNCTUAL, + dateInterval: { + lowerDate: '2024-04-01', //This is a Monday + higherDate: '2024-04-01', + }, + driverWaypoints: waypointsSet1, + passengerWaypoints: waypointsSet2, + driverDistance: 350145, + driverDuration: 13548, + driverSchedule: weekdayMornings, + passengerSchedule: mondayAt7, + spacetimeDetourRatio, + }) + .setCarpoolPath(carpoolPath2) + .setSteps(steps) + .createJourneys(); + expect(candidateEntity.getProps().journeys).toHaveLength(1); + expect( + ( + candidateEntity.getProps().journeys as Journey[] + )[0].firstDate.getDate(), + ).toBe(1); + }); it('should not create journeys if dates does not match', () => { const candidateEntity: CandidateEntity = CandidateEntity.create({