Skip to content

Commit

Permalink
Fix the unit test
Browse files Browse the repository at this point in the history
  • Loading branch information
Dlurak committed Oct 8, 2024
1 parent cd3eb08 commit 2c7a5b3
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 7 deletions.
6 changes: 4 additions & 2 deletions src/services/__tests__/osmApi.fixture.ts
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ export const RELATION = {

export const RELATION_FEATURE = {
type: 'Feature',
center: [15, 51],
center: [14, 50],
members: [
{
ref: 8166328,
Expand Down Expand Up @@ -134,5 +134,7 @@ export const RELATION_FEATURE = {
amenity: 'university',
type: 'multipolygon',
},
imageDefs: [{ type: 'center', service: 'mapillary', center: [15, 51] }],
deleted: undefined,
geometry: undefined,
imageDefs: [{ type: 'center', service: 'mapillary', center: [14, 50] }],
};
6 changes: 1 addition & 5 deletions src/services/__tests__/osmApi.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -67,16 +67,12 @@ describe('fetchFeature', () => {
expect(feature).toEqual(WAY_FEATURE);
});

const OVERPASS_GEOM_RESPONSE = {
elements: [{ geometry: { coordinates: [15, 51] } }],
};

it('should work for relation', async () => {
const fetchJson = jest
.spyOn(fetch, 'fetchJson')
.mockImplementation((url) =>
Promise.resolve(
url.match(/overpass/) ? OVERPASS_GEOM_RESPONSE : RELATION,
url.match(/overpass/) ? OVERPASS_CENTER_RESPONSE : RELATION,
),
);

Expand Down

0 comments on commit 2c7a5b3

Please sign in to comment.