mirror of
https://gitlab.com/mobicoop/v3/service/matcher.git
synced 2026-01-01 14:02:39 +00:00
spacetime VO tests
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
import { GeorouterPort } from '../application/ports/georouter.port';
|
||||
import { GeorouterSettings } from '../application/types/georouter-settings.type';
|
||||
import { SpacetimePointProps } from './value-objects/timepoint.value-object';
|
||||
import { SpacetimePointProps } from './value-objects/spacetime-point.value-object';
|
||||
import { WaypointProps } from './value-objects/waypoint.value-object';
|
||||
|
||||
// All properties that a Route has
|
||||
|
||||
@@ -1,4 +1,8 @@
|
||||
import { ArgumentInvalidException, ValueObject } from '@mobicoop/ddd-library';
|
||||
import {
|
||||
ArgumentInvalidException,
|
||||
ArgumentOutOfRangeException,
|
||||
ValueObject,
|
||||
} from '@mobicoop/ddd-library';
|
||||
|
||||
/** Note:
|
||||
* Value Objects with multiple properties can contain
|
||||
@@ -38,5 +42,9 @@ export class SpacetimePoint extends ValueObject<SpacetimePointProps> {
|
||||
throw new ArgumentInvalidException(
|
||||
'distance must be greater than or equal to 0',
|
||||
);
|
||||
if (props.lon > 180 || props.lon < -180)
|
||||
throw new ArgumentOutOfRangeException('lon must be between -180 and 180');
|
||||
if (props.lat > 90 || props.lat < -90)
|
||||
throw new ArgumentOutOfRangeException('lat must be between -90 and 90');
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user