add steps to route response

This commit is contained in:
sbriat
2023-09-19 14:30:56 +02:00
parent 1f1502a623
commit 7cac8cbef9
5 changed files with 34 additions and 3 deletions

View File

@@ -26,6 +26,11 @@ const mockHttpService = {
.mockImplementationOnce(() => {
return throwError(() => 'Router unavailable');
})
.mockImplementationOnce(() => {
return of({
status: 200,
});
})
.mockImplementationOnce(() => {
return of({
status: 200,
@@ -338,6 +343,28 @@ describe('Graphhopper Georouter', () => {
).rejects.toBeInstanceOf(GeorouterUnavailableException);
});
it('should fail if georouter response is corrupted', async () => {
await expect(
graphhopperGeorouter.route(
[
{
lon: 0,
lat: 0,
},
{
lon: 1,
lat: 1,
},
],
{
detailedDistance: false,
detailedDuration: false,
points: false,
},
),
).rejects.toBeInstanceOf(GeorouterUnavailableException);
});
it('should create a basic route', async () => {
const route: Route = await graphhopperGeorouter.route(
[