diff --git a/apps/datafeeder/src/app/presentation/components/data-import-validation-map-panel/data-import-validation-map-panel.component.ts b/apps/datafeeder/src/app/presentation/components/data-import-validation-map-panel/data-import-validation-map-panel.component.ts index b8be903946..4dd3f60b7d 100644 --- a/apps/datafeeder/src/app/presentation/components/data-import-validation-map-panel/data-import-validation-map-panel.component.ts +++ b/apps/datafeeder/src/app/presentation/components/data-import-validation-map-panel/data-import-validation-map-panel.component.ts @@ -17,7 +17,8 @@ import GeoJSON from 'ol/format/GeoJSON' import { Geometry } from 'ol/geom' import TileLayer from 'ol/layer/Tile' import VectorLayer from 'ol/layer/Vector' -import { Map, Feature } from 'ol' +import Map from 'ol/Map' +import Feature from 'ol/Feature' import OSM from 'ol/source/OSM' import VectorSource from 'ol/source/Vector' import { Fill, RegularShape, Stroke, Style } from 'ol/style' diff --git a/libs/feature/dataviz/src/lib/geo-table-view/geo-table-view.component.spec.ts b/libs/feature/dataviz/src/lib/geo-table-view/geo-table-view.component.spec.ts index 21686a2ff1..ea5334ff02 100644 --- a/libs/feature/dataviz/src/lib/geo-table-view/geo-table-view.component.spec.ts +++ b/libs/feature/dataviz/src/lib/geo-table-view/geo-table-view.component.spec.ts @@ -12,7 +12,8 @@ import { MapManagerService, } from '@geonetwork-ui/feature/map' import { FEATURE_COLLECTION_POINT_FIXTURE_4326 } from '@geonetwork-ui/common/fixtures' -import { Feature, Map } from 'ol' +import Map from 'ol/Map' +import Feature from 'ol/Feature' import GeoJSON from 'ol/format/GeoJSON' import TileLayer from 'ol/layer/Tile' import VectorLayer from 'ol/layer/Vector' @@ -23,13 +24,6 @@ import { Subject } from 'rxjs' import { GeoTableViewComponent } from './geo-table-view.component' import { Geometry } from 'ol/geom' -class ResizeObserverMock { - observe = jest.fn() - unobserve = jest.fn() -} - -;(window as any).ResizeObserver = ResizeObserverMock - const vectorLayer = new VectorLayer({ source: new VectorSource({ features: new GeoJSON().readFeatures( diff --git a/libs/feature/dataviz/src/test-setup.ts b/libs/feature/dataviz/src/test-setup.ts index 70e41af1c8..19b403b6c7 100644 --- a/libs/feature/dataviz/src/test-setup.ts +++ b/libs/feature/dataviz/src/test-setup.ts @@ -13,3 +13,10 @@ getTestBed().initTestEnvironment( platformBrowserDynamicTesting(), { teardown: { destroyAfterEach: false } } ) + +class ResizeObserverMock { + observe = jest.fn() + unobserve = jest.fn() +} + +;(window as any).ResizeObserver = ResizeObserverMock diff --git a/libs/feature/map/src/lib/map-context/map-context.service.spec.ts b/libs/feature/map/src/lib/map-context/map-context.service.spec.ts index d0efddef4b..0bc5494d30 100644 --- a/libs/feature/map/src/lib/map-context/map-context.service.spec.ts +++ b/libs/feature/map/src/lib/map-context/map-context.service.spec.ts @@ -34,13 +34,6 @@ import { } from './map-context.service' import Feature from 'ol/Feature' -class ResizeObserverMock { - observe = jest.fn() - unobserve = jest.fn() -} - -;(window as any).ResizeObserver = ResizeObserverMock - const mapStyleServiceMock = { createDefaultStyle: jest.fn(() => new Style()), styles: { diff --git a/libs/feature/map/src/lib/utils/map-utils-wms.service.ts b/libs/feature/map/src/lib/utils/map-utils-wms.service.ts index 3f2782ee7b..1b03dc36e7 100644 --- a/libs/feature/map/src/lib/utils/map-utils-wms.service.ts +++ b/libs/feature/map/src/lib/utils/map-utils-wms.service.ts @@ -32,10 +32,6 @@ export class MapUtilsWMSService { ) } - async getProjFromEPSG(EPSGCode) { - return fromEPSGCode(EPSGCode) - } - async getLonLatBBox(wmsLayerFull: WmsLayerFull): Promise { const { boundingBoxes } = wmsLayerFull const lonLatCRS = Object.keys(boundingBoxes)?.find((crs) => @@ -46,7 +42,7 @@ export class MapUtilsWMSService { } else { const availableEPSGCode = Object.keys(boundingBoxes)[0] register(proj4) - const proj = await this.getProjFromEPSG(availableEPSGCode) + const proj = await fromEPSGCode(availableEPSGCode) proj4.defs(availableEPSGCode, proj) const bboxWithFiniteNumbers = [ diff --git a/libs/feature/map/src/lib/utils/map-utils.service.spec.ts b/libs/feature/map/src/lib/utils/map-utils.service.spec.ts index aa90637537..2dc0bf257a 100644 --- a/libs/feature/map/src/lib/utils/map-utils.service.spec.ts +++ b/libs/feature/map/src/lib/utils/map-utils.service.spec.ts @@ -36,12 +36,6 @@ jest.mock('ol/proj/proj4', () => { register: registerMock, } }) -class ResizeObserverMock { - observe = jest.fn() - unobserve = jest.fn() -} - -;(window as any).ResizeObserver = ResizeObserverMock const wmsUtilsMock = { getLayerLonLatBBox: jest.fn(() => of([1.33, 48.81, 4.3, 51.1])), diff --git a/libs/feature/map/src/test-setup.ts b/libs/feature/map/src/test-setup.ts index 70e41af1c8..19b403b6c7 100644 --- a/libs/feature/map/src/test-setup.ts +++ b/libs/feature/map/src/test-setup.ts @@ -13,3 +13,10 @@ getTestBed().initTestEnvironment( platformBrowserDynamicTesting(), { teardown: { destroyAfterEach: false } } ) + +class ResizeObserverMock { + observe = jest.fn() + unobserve = jest.fn() +} + +;(window as any).ResizeObserver = ResizeObserverMock