graphhopper georouter tests
This commit is contained in:
parent
0dec130396
commit
ed99b442eb
|
@ -82,9 +82,7 @@ export class GraphhopperGeorouter implements IGeorouter {
|
|||
].join('');
|
||||
const route = await lastValueFrom(
|
||||
this._httpService.get(url).pipe(
|
||||
map((res) =>
|
||||
res.data ? this._createRoute(path.key, res) : undefined,
|
||||
),
|
||||
map((res) => (res.data ? this._createRoute(res) : undefined)),
|
||||
catchError((error: AxiosError) => {
|
||||
throw new Error('Georouter unavailable : ' + error.message);
|
||||
}),
|
||||
|
@ -103,10 +101,7 @@ export class GraphhopperGeorouter implements IGeorouter {
|
|||
return [this._url, this._urlArgs.join('&')].join('');
|
||||
}
|
||||
|
||||
_createRoute(
|
||||
key: string,
|
||||
response: AxiosResponse<GraphhopperResponse>,
|
||||
): Route {
|
||||
_createRoute(response: AxiosResponse<GraphhopperResponse>): Route {
|
||||
const route = new Route(this._geodesic);
|
||||
if (response.data.paths && response.data.paths[0]) {
|
||||
const shortestPath = response.data.paths[0];
|
||||
|
|
|
@ -447,7 +447,6 @@ describe('Graphhopper Georouter', () => {
|
|||
withTime: true,
|
||||
},
|
||||
);
|
||||
console.log(routes[0].route.spacetimePoints);
|
||||
expect(routes).toHaveLength(1);
|
||||
expect(routes[0].route.spacetimePoints.length).toBe(3);
|
||||
expect(routes[0].route.spacetimePoints[1].duration).toBe(990);
|
||||
|
|
Loading…
Reference in New Issue