Skip to content

Commit

Permalink
Remove unnecessary conversion
Browse files Browse the repository at this point in the history
  • Loading branch information
alimpens committed Aug 19, 2024
1 parent 9e3c622 commit f846825
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 20 deletions.
1 change: 0 additions & 1 deletion src/shared/services/map-location/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ export {
pointWithinBounds,
serviceResultToAddress,
wktPointToLocation,
convertCoordsToLatLng,
} from './map-location'
export type {
PdokResponse,
Expand Down
2 changes: 1 addition & 1 deletion src/shared/services/map-location/map-location.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import type { Incident } from 'types/api/incident'
import type { Geometrie, Location } from 'types/incident'
import type { RevGeo, Doc } from 'types/pdok/revgeo'

export const convertCoordsToLatLng = (coordinates: LatLngTuple) => {
const convertCoordsToLatLng = (coordinates: LatLngTuple) => {
const coordsWithoutAltitude = [coordinates[0], coordinates[1]]

return coordsWithoutAltitude
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,10 @@ import { Map } from '@amsterdam/react-maps'
import { act, render, screen, waitFor } from '@testing-library/react'
import type { FeatureCollection } from 'geojson'
import type { FetchMock } from 'jest-fetch-mock'
import type { LatLngTuple, MapOptions } from 'leaflet'
import type { MapOptions } from 'leaflet'

import configuration from 'shared/services/configuration/configuration'
import MAP_OPTIONS from 'shared/services/configuration/map-options'
import { convertCoordsToLatLng } from 'shared/services/map-location'
import assetsJson from 'utils/__tests__/fixtures/assets.json'

import WfsDataContext, { NO_DATA } from './context'
Expand Down Expand Up @@ -101,23 +100,8 @@ describe('src/signals/incident/components/form/AssetSelect/WfsLayer', () => {
)
)

const sanitizedAssetsJson = {
...assetsJson,
features: assetsJson.features.map((feature) => {
return {
...feature,
geometry: {
...feature.geometry,
coordinates: convertCoordsToLatLng(
feature.geometry.coordinates as LatLngTuple
),
},
}
}),
}

await waitFor(() => {
expect(setContextData).toHaveBeenCalledWith(sanitizedAssetsJson)
expect(setContextData).toHaveBeenCalledWith(assetsJson)
})
})

Expand Down

0 comments on commit f846825

Please sign in to comment.