diff --git a/src/modules/ad/core/domain/value-objects/carpool-path-item.value-object.ts b/src/modules/ad/core/domain/value-objects/carpool-path-item.value-object.ts index 377000a..8c5f53d 100644 --- a/src/modules/ad/core/domain/value-objects/carpool-path-item.value-object.ts +++ b/src/modules/ad/core/domain/value-objects/carpool-path-item.value-object.ts @@ -2,8 +2,7 @@ import { ArgumentOutOfRangeException, ValueObject, } from '@mobicoop/ddd-library'; -import { Actor, ActorProps } from './actor.value-object'; -import { Role } from '../ad.types'; +import { ActorProps } from './actor.value-object'; import { Point, PointProps } from './point.value-object'; /** Note: @@ -36,12 +35,5 @@ export class CarpoolPathItem extends ValueObject { }); if (props.actors.length <= 0) throw new ArgumentOutOfRangeException('at least one actor is required'); - if ( - props.actors.filter((actor: Actor) => actor.role == Role.DRIVER).length > - 1 - ) - throw new ArgumentOutOfRangeException( - 'a carpoolStep can contain only one driver', - ); } } diff --git a/src/modules/ad/tests/unit/core/carpool-path-item.value-object.spec.ts b/src/modules/ad/tests/unit/core/carpool-path-item.value-object.spec.ts index 9da4378..ed093d9 100644 --- a/src/modules/ad/tests/unit/core/carpool-path-item.value-object.spec.ts +++ b/src/modules/ad/tests/unit/core/carpool-path-item.value-object.spec.ts @@ -33,22 +33,4 @@ describe('Carpool Path Item value object', () => { }); }).toThrow(ArgumentOutOfRangeException); }); - it('should throw an exception if actors contains more than one driver', () => { - expect(() => { - new CarpoolPathItem({ - lat: 48.689445, - lon: 6.17651, - actors: [ - new Actor({ - role: Role.DRIVER, - target: Target.NEUTRAL, - }), - new Actor({ - role: Role.DRIVER, - target: Target.START, - }), - ], - }); - }).toThrow(ArgumentOutOfRangeException); - }); });