fix tests

This commit is contained in:
sbriat 2023-09-06 16:54:53 +02:00
parent d16997a84f
commit 61a1d56717
5 changed files with 98 additions and 2 deletions

View File

@ -28,7 +28,7 @@ export class MatchQueryHandler implements IQueryHandler {
@Inject(INPUT_DATETIME_TRANSFORMER)
private readonly datetimeTransformer: DateTimeTransformerPort,
@Inject(AD_CARPOOL_ROUTE_PROVIDER)
private readonly routeProvider: CarpoolRouteProviderPort,
private readonly carpoolRouteProvider: CarpoolRouteProviderPort,
) {
this._defaultParams = defaultParamsProvider.getParams();
}
@ -54,7 +54,7 @@ export class MatchQueryHandler implements IQueryHandler {
maxDetourDurationRatio: this._defaultParams.MAX_DETOUR_DURATION_RATIO,
})
.setDatesAndSchedule(this.datetimeTransformer);
await query.setCarpoolRoute(this.routeProvider);
await query.setCarpoolRoute(this.carpoolRouteProvider);
let algorithm: Algorithm;
switch (query.algorithmType) {

View File

@ -39,6 +39,7 @@ export class PassengerOrientedSelector extends Selector {
id: adReadModel.uuid,
},
role: adsRole.role,
baseCarpoolRoute: this.query.carpoolRoute,
},
),
)

View File

@ -1,12 +1,19 @@
import { Role } from '../../domain/ad.types';
import { CarpoolRoute } from './carpool-route.type';
export enum AlgorithmType {
PASSENGER_ORIENTED = 'PASSENGER_ORIENTED',
}
/**
* A candidate is a potential match
*/
export type Candidate = {
ad: Ad;
role: Role;
baseCarpoolRoute: CarpoolRoute;
// driverRoute?: Route; ?
// crewRoute?: Route; ?
};
export type Ad = {

View File

@ -48,12 +48,56 @@ const candidates: Candidate[] = [
id: 'cc260669-1c6d-441f-80a5-19cd59afb777',
},
role: Role.DRIVER,
baseCarpoolRoute: {
driverDistance: 350101,
driverDuration: 14422,
passengerDistance: 350101,
passengerDuration: 14422,
fwdAzimuth: 273,
backAzimuth: 93,
points: [
{
lon: 6.1765102,
lat: 48.689445,
},
{
lon: 4.984578,
lat: 48.725687,
},
{
lon: 2.3522,
lat: 48.8566,
},
],
},
},
{
ad: {
id: '5600ccfb-ab69-4d03-aa30-0fbe84fcedc0',
},
role: Role.PASSENGER,
baseCarpoolRoute: {
driverDistance: 350101,
driverDuration: 14422,
passengerDistance: 350101,
passengerDuration: 14422,
fwdAzimuth: 273,
backAzimuth: 93,
points: [
{
lon: 6.1765102,
lat: 48.689445,
},
{
lon: 4.984578,
lat: 48.725687,
},
{
lon: 2.3522,
lat: 48.8566,
},
],
},
},
];

View File

@ -48,12 +48,56 @@ const candidates: Candidate[] = [
id: 'cc260669-1c6d-441f-80a5-19cd59afb777',
},
role: Role.DRIVER,
baseCarpoolRoute: {
driverDistance: 350101,
driverDuration: 14422,
passengerDistance: 350101,
passengerDuration: 14422,
fwdAzimuth: 273,
backAzimuth: 93,
points: [
{
lon: 6.1765102,
lat: 48.689445,
},
{
lon: 4.984578,
lat: 48.725687,
},
{
lon: 2.3522,
lat: 48.8566,
},
],
},
},
{
ad: {
id: '5600ccfb-ab69-4d03-aa30-0fbe84fcedc0',
},
role: Role.PASSENGER,
baseCarpoolRoute: {
driverDistance: 350101,
driverDuration: 14422,
passengerDistance: 350101,
passengerDuration: 14422,
fwdAzimuth: 273,
backAzimuth: 93,
points: [
{
lon: 6.1765102,
lat: 48.689445,
},
{
lon: 4.984578,
lat: 48.725687,
},
{
lon: 2.3522,
lat: 48.8566,
},
],
},
},
];