diff --git a/@here/harp-mapview-decoder/test/TileDataSourceTest.ts b/@here/harp-mapview-decoder/test/TileDataSourceTest.ts index 2dadb4e855..be38fdbee0 100644 --- a/@here/harp-mapview-decoder/test/TileDataSourceTest.ts +++ b/@here/harp-mapview-decoder/test/TileDataSourceTest.ts @@ -20,6 +20,7 @@ import { webMercatorTilingScheme } from "@here/harp-geoutils"; import { DataSource, MapView, Statistics, Tile, TileLoaderState } from "@here/harp-mapview"; +import { errorOnlyLoggingAroundFunction } from "@here/harp-test-utils"; import { assert, expect } from "chai"; import * as sinon from "sinon"; @@ -301,72 +302,78 @@ describe("TileDataSource", function() { }); it("supports deprecated minZoomLevel and maxZoomLevel in constructor", function() { - const testedDataSource = new TileDataSource(new TileFactory(Tile), { - styleSetName: "", - tilingScheme: webMercatorTilingScheme, - dataProvider: new MockDataProvider(), - decoder: createMockTileDecoder(), - minZoomLevel: 3, - maxZoomLevel: 17 + errorOnlyLoggingAroundFunction("DataSource", () => { + const testedDataSource = new TileDataSource(new TileFactory(Tile), { + styleSetName: "", + tilingScheme: webMercatorTilingScheme, + dataProvider: new MockDataProvider(), + decoder: createMockTileDecoder(), + minZoomLevel: 3, + maxZoomLevel: 17 + }); + + assert.equal(testedDataSource.minZoomLevel, 3); + assert.equal(testedDataSource.minDataLevel, 3); + assert.equal(testedDataSource.maxZoomLevel, 17); + assert.equal(testedDataSource.maxDataLevel, 17); }); - - assert.equal(testedDataSource.minZoomLevel, 3); - assert.equal(testedDataSource.minDataLevel, 3); - assert.equal(testedDataSource.maxZoomLevel, 17); - assert.equal(testedDataSource.maxDataLevel, 17); }); it("supports setting of theme", async function() { const mockDecoder = createMockTileDecoder(); - const testedDataSource = new TileDataSource(new TileFactory(Tile), { - styleSetName: "tilezen", - tilingScheme: webMercatorTilingScheme, - dataProvider: new MockDataProvider(), - decoder: mockDecoder, - minZoomLevel: 3, - maxZoomLevel: 17 + errorOnlyLoggingAroundFunction("DataSource", async () => { + const testedDataSource = new TileDataSource(new TileFactory(Tile), { + styleSetName: "tilezen", + tilingScheme: webMercatorTilingScheme, + dataProvider: new MockDataProvider(), + decoder: mockDecoder, + minZoomLevel: 3, + maxZoomLevel: 17 + }); + + testedDataSource.attach(createMockMapView()); + + const styles: StyleSet = [ + { + styleSet: "tilezen", + technique: "none" + } + ]; + + await testedDataSource.setTheme({ + styles + }); + + assert(mockDecoder.configure.calledOnce); + assert(mockDecoder.configure.calledWith(sinon.match({ styleSet: styles }))); }); - - testedDataSource.attach(createMockMapView()); - - const styles: StyleSet = [ - { - styleSet: "tilezen", - technique: "none" - } - ]; - - await testedDataSource.setTheme({ - styles - }); - - assert(mockDecoder.configure.calledOnce); - assert(mockDecoder.configure.calledWith(sinon.match({ styleSet: styles }))); }); it("supports setting of languages", async function() { const mockDecoder = createMockTileDecoder(); - const testedDataSource = new TileDataSource(new TileFactory(Tile), { - styleSetName: "tilezen", - tilingScheme: webMercatorTilingScheme, - dataProvider: new MockDataProvider(), - decoder: mockDecoder, - minZoomLevel: 3, - maxZoomLevel: 17, - languages: ["de"] - }); + errorOnlyLoggingAroundFunction("DataSource", async () => { + const testedDataSource = new TileDataSource(new TileFactory(Tile), { + styleSetName: "tilezen", + tilingScheme: webMercatorTilingScheme, + dataProvider: new MockDataProvider(), + decoder: mockDecoder, + minZoomLevel: 3, + maxZoomLevel: 17, + languages: ["de"] + }); - await testedDataSource.connect(); + await testedDataSource.connect(); - expect(mockDecoder.configure.calledOnce).to.be.true; - expect(mockDecoder.configure.calledWith(sinon.match({ languages: ["de"] }))).to.be.true; + expect(mockDecoder.configure.calledOnce).to.be.true; + expect(mockDecoder.configure.calledWith(sinon.match({ languages: ["de"] }))).to.be.true; - testedDataSource.attach(createMockMapView()); + testedDataSource.attach(createMockMapView()); - testedDataSource.setLanguages(["de", "en"]); + testedDataSource.setLanguages(["de", "en"]); - expect(mockDecoder.configure.calledTwice).to.be.true; - expect(mockDecoder.configure.calledWith(sinon.match({ languages: ["de", "en"] }))).to.be - .true; + expect(mockDecoder.configure.calledTwice).to.be.true; + expect(mockDecoder.configure.calledWith(sinon.match({ languages: ["de", "en"] }))).to.be + .true; + }); }); }); diff --git a/@here/harp-mapview/lib/MapView.ts b/@here/harp-mapview/lib/MapView.ts index ca1da830e4..97478ab90e 100644 --- a/@here/harp-mapview/lib/MapView.ts +++ b/@here/harp-mapview/lib/MapView.ts @@ -1327,6 +1327,8 @@ export class MapView extends EventDispatcher { ConcurrentDecoderFacade.destroyIfTerminated(); ConcurrentTilerFacade.destroyIfTerminated(); + this.m_taskScheduler.clearQueuedTasks(); + // Remove all event handlers. super.dispose(); } @@ -2158,7 +2160,7 @@ export class MapView extends EventDispatcher { dataSource.setLanguages(this.m_languages); if (theme !== undefined && theme.styles !== undefined) { - dataSource.setTheme(theme); + await dataSource.setTheme(theme); } this.m_connectedDataSources.add(dataSource.name); diff --git a/@here/harp-mapview/lib/MapViewTaskScheduler.ts b/@here/harp-mapview/lib/MapViewTaskScheduler.ts index ce7891d1d9..3ddd76b196 100644 --- a/@here/harp-mapview/lib/MapViewTaskScheduler.ts +++ b/@here/harp-mapview/lib/MapViewTaskScheduler.ts @@ -150,6 +150,13 @@ export class MapViewTaskScheduler extends THREE.EventDispatcher { } } + /** + * Removes all tasks that have been queued. + */ + clearQueuedTasks() { + this.m_taskQueue.clear(); + } + private spaceInFrame(frameStartTime: number): number { const passedTime = (performance || Date).now() - frameStartTime; return Math.max(1000 / this.m_maxFps - passedTime, 0); diff --git a/@here/harp-mapview/test/MapViewTest.ts b/@here/harp-mapview/test/MapViewTest.ts index 9f8aae9245..831a55b225 100644 --- a/@here/harp-mapview/test/MapViewTest.ts +++ b/@here/harp-mapview/test/MapViewTest.ts @@ -16,7 +16,11 @@ import { sphereProjection, webMercatorTilingScheme } from "@here/harp-geoutils"; -import { getTestResourceUrl, waitForEvent } from "@here/harp-test-utils"; +import { + errorOnlyLoggingAroundFunction, + getTestResourceUrl, + waitForEvent +} from "@here/harp-test-utils"; import * as TestUtils from "@here/harp-test-utils/lib/WebGLStub"; import { FontCatalog } from "@here/harp-text-canvas"; import { getAppBaseUrl } from "@here/harp-utils"; @@ -101,8 +105,9 @@ describe("MapView", function() { } as unknown) as HTMLCanvasElement; }); - afterEach(function() { + afterEach(async function() { if (mapView !== undefined) { + await mapView.getTheme(); mapView.dispose(); mapView = undefined; } @@ -640,25 +645,27 @@ describe("MapView", function() { const webGlContextRestoredHandler = addEventListenerSpy.getCall(1).args[1]; const webGlContextLostHandler = addEventListenerSpy.getCall(0).args[1]; - await mapView.setTheme({ - clearColor: "#ffffff" - }); - expect(clearColorStub.calledWith("#ffffff")); + await errorOnlyLoggingAroundFunction(["MapViewThemeManager", "MapView"], async () => { + await mapView!.setTheme({ + clearColor: "#ffffff" + }); - await webGlContextRestoredHandler(); - expect(clearColorStub.calledWith(DEFAULT_CLEAR_COLOR)); + expect(clearColorStub.calledWith("#ffffff")); + await webGlContextRestoredHandler(); + expect(clearColorStub.calledWith(DEFAULT_CLEAR_COLOR)); - await mapView.setTheme({ - clearColor: undefined - }); + await mapView!.setTheme({ + clearColor: undefined + }); - expect(clearColorStub.calledWith(DEFAULT_CLEAR_COLOR)); + expect(clearColorStub.calledWith(DEFAULT_CLEAR_COLOR)); - await webGlContextRestoredHandler(); - expect(clearColorStub.calledWith(DEFAULT_CLEAR_COLOR)); + await webGlContextRestoredHandler(); + expect(clearColorStub.calledWith(DEFAULT_CLEAR_COLOR)); - webGlContextLostHandler(); - expect(clearColorStub.calledWith(DEFAULT_CLEAR_COLOR)); + webGlContextLostHandler(); + expect(clearColorStub.calledWith(DEFAULT_CLEAR_COLOR)); + }); }); it("Correctly sets and removes all event listeners by API", function() { @@ -702,7 +709,9 @@ describe("MapView", function() { it("ignore set and get tile wrapping mode for sphere projection", function() { mapView = new MapView({ canvas, projection: sphereProjection }); - mapView.tileWrappingEnabled = false; + errorOnlyLoggingAroundFunction("MapView", () => { + mapView!.tileWrappingEnabled = false; // Ignore warning here + }); expect(mapView.tileWrappingEnabled).equal(true); }); @@ -710,7 +719,8 @@ describe("MapView", function() { const dataSource = new FakeOmvDataSource({ name: "omv" }); const dataSourceDisposeStub = sinon.stub(dataSource, "dispose"); mapView = new MapView({ canvas }); - mapView.addDataSource(dataSource); + await mapView.getTheme(); + await mapView.addDataSource(dataSource); const disposeStub = sinon.stub(); mapView!.addEventListener(MapViewEventNames.Dispose, disposeStub); @@ -732,7 +742,8 @@ describe("MapView", function() { it("#dispose removes event listeners", async function() { const dataSource = new FakeOmvDataSource({ name: "omv" }); mapView = new MapView({ canvas }); - mapView.addDataSource(dataSource); + await mapView.getTheme(); + await mapView.addDataSource(dataSource); await dataSource.connect(); const eventStubs: Map = new Map(); @@ -869,7 +880,7 @@ describe("MapView", function() { expect(mapView.fog instanceof MapViewFog).to.equal(true); }); - it("converts screen coords to geo to screen w/ different pixel ratio", function() { + it("converts screen coords to geo to screen w/ different pixel ratio", async function() { const customCanvas = { clientWidth: 1920, clientHeight: 1080, @@ -878,14 +889,20 @@ describe("MapView", function() { removeEventListener: sinon.stub() }; + const mapViewOptions = { + canvas: (customCanvas as any) as HTMLCanvasElement, + addBackgroundDatasource: false + }; for (let x = -100; x <= 100; x += 100) { for (let y = -100; y <= 100; y += 100) { - mapView = new MapView({ canvas: (customCanvas as any) as HTMLCanvasElement }); + mapView = new MapView(mapViewOptions); + await mapView.getTheme(); const resultA = mapView.getScreenPosition(mapView.getGeoCoordinatesAt(x, y)!); mapView.dispose(); customCanvas.pixelRatio = 2; - mapView = new MapView({ canvas: (customCanvas as any) as HTMLCanvasElement }); + mapView = new MapView(mapViewOptions); + await mapView.getTheme(); const resultB = mapView.getScreenPosition(mapView.getGeoCoordinatesAt(x, y)!); expect(resultA!.x).to.be.closeTo(resultB!.x, 0.00000001); @@ -897,7 +914,7 @@ describe("MapView", function() { } } }); - it("converts screen coords to world to screen w/ different pixel ratio", function() { + it("converts screen coords to world to screen w/ different pixel ratio", async function() { const customCanvas = { clientWidth: 1920, clientHeight: 1080, @@ -906,14 +923,20 @@ describe("MapView", function() { removeEventListener: sinon.stub() }; + const mapViewOptions = { + canvas: (customCanvas as any) as HTMLCanvasElement, + addBackgroundDatasource: false + }; for (let x = -100; x <= 100; x += 100) { for (let y = -100; y <= 100; y += 100) { - mapView = new MapView({ canvas: (customCanvas as any) as HTMLCanvasElement }); + mapView = new MapView(mapViewOptions); + await mapView.getTheme(); const resultA = mapView.getScreenPosition(mapView.getWorldPositionAt(x, y)!); mapView.dispose(); customCanvas.pixelRatio = 2; - mapView = new MapView({ canvas: (customCanvas as any) as HTMLCanvasElement }); + mapView = new MapView(mapViewOptions); + await mapView.getTheme(); const resultB = mapView.getScreenPosition(mapView.getWorldPositionAt(x, y)!); expect(resultA!.x).to.be.closeTo(resultB!.x, 0.00000001); @@ -1434,6 +1457,7 @@ describe("MapView", function() { }; } mapView = new MapView({ canvas, theme: {} }); + await mapView.getTheme(); const dataSource = new FakeOmvDataSource({ name: "omv" }); @@ -1454,6 +1478,7 @@ describe("MapView", function() { it("languages set in MapView are also set in datasources", async function() { const dataSource = new FakeOmvDataSource({ name: "omv" }); mapView = new MapView({ canvas, theme: {} }); + await mapView.getTheme(); await mapView.addDataSource(dataSource); mapView.languages = ["Goblin"]; @@ -1466,6 +1491,7 @@ describe("MapView", function() { it("languages set in MapView are also set in datasources added later", async function() { const dataSource = new FakeOmvDataSource({ name: "omv" }); mapView = new MapView({ canvas, theme: {} }); + await mapView.getTheme(); mapView.languages = ["Goblin"]; await mapView.addDataSource(dataSource); diff --git a/@here/harp-mapview/test/StatisticsTest.ts b/@here/harp-mapview/test/StatisticsTest.ts index 7bcd1c61db..96a5d352b3 100644 --- a/@here/harp-mapview/test/StatisticsTest.ts +++ b/@here/harp-mapview/test/StatisticsTest.ts @@ -3,6 +3,7 @@ * Licensed under Apache 2.0, see full license in LICENSE * SPDX-License-Identifier: Apache-2.0 */ +import { errorOnlyLoggingAroundFunction } from "@here/harp-test-utils"; import { assert } from "chai"; import { @@ -181,7 +182,9 @@ describe("mapview-statistics", function() { assert.isNumber(tx); assert.isAbove(tx, t); - stats.log(); + errorOnlyLoggingAroundFunction("Statistics", () => { + stats.log(); + }); done(); }, 2); }, 2); @@ -223,7 +226,9 @@ describe("mapview-statistics", function() { assert.isNumber(tx); assert.isAbove(tx, t); - stats.log(); + errorOnlyLoggingAroundFunction("Statistics", () => { + stats.log(); + }); done(); }, 2); }, 2); @@ -266,7 +271,9 @@ describe("mapview-statistics", function() { assert.isNumber(stats.getTimer("post").value); assert.isAbove(stats.getTimer("post").value ?? 0, 0); - stats.log(); + errorOnlyLoggingAroundFunction("Statistics", () => { + stats.log(); + }); done(); }, 2); diff --git a/@here/harp-mapview/test/TextElementStateCacheTest.ts b/@here/harp-mapview/test/TextElementStateCacheTest.ts index 63c33bfcbf..b91a4feca5 100644 --- a/@here/harp-mapview/test/TextElementStateCacheTest.ts +++ b/@here/harp-mapview/test/TextElementStateCacheTest.ts @@ -4,6 +4,7 @@ * SPDX-License-Identifier: Apache-2.0 */ import { TileKey } from "@here/harp-geoutils"; +import { errorOnlyLoggingAroundFunction } from "@here/harp-test-utils"; import { expect } from "chai"; import * as THREE from "three"; @@ -257,8 +258,10 @@ describe("TextElementStateCache", function() { poiState1.updateFading(1, true); expect(poiState1.visible).to.be.true; - const didReplace = cache.replaceElement(0, poiState1); - expect(didReplace).to.be.false; + errorOnlyLoggingAroundFunction("TextElementsStateCache", () => { + const didReplace = cache.replaceElement(0, poiState1); + expect(didReplace).to.be.false; + }); }); it("replaceElement POI failed (feature ID mismatch)", function() { diff --git a/@here/harp-mapview/test/TextElementsRendererTestFixture.ts b/@here/harp-mapview/test/TextElementsRendererTestFixture.ts index 26044517b0..65c8b29f0f 100644 --- a/@here/harp-mapview/test/TextElementsRendererTestFixture.ts +++ b/@here/harp-mapview/test/TextElementsRendererTestFixture.ts @@ -6,6 +6,7 @@ import { MapEnv, Theme } from "@here/harp-datasource-protocol"; import { identityProjection, TileKey } from "@here/harp-geoutils"; +import { errorOnlyLoggingAroundFunction } from "@here/harp-test-utils"; import { TextCanvas } from "@here/harp-text-canvas"; import { assert, expect } from "chai"; import * as sinon from "sinon"; @@ -343,7 +344,9 @@ export class TestFixture { } this.m_viewState.frameNumber++; - this.textRenderer.placeText(this.tileLists, time); + errorOnlyLoggingAroundFunction(["TextElementsRenderer", "TextElementsStateCache"], () => { + this.textRenderer.placeText(this.tileLists, time); + }); } private get textRenderer(): TextElementsRenderer { diff --git a/@here/harp-mapview/test/TileTest.ts b/@here/harp-mapview/test/TileTest.ts index d34bd17954..0b5ec1fdb6 100644 --- a/@here/harp-mapview/test/TileTest.ts +++ b/@here/harp-mapview/test/TileTest.ts @@ -13,6 +13,7 @@ import { TileKey, webMercatorTilingScheme } from "@here/harp-geoutils"; +import { errorOnlyLoggingAroundFunction } from "@here/harp-test-utils"; import { TaskQueue } from "@here/harp-utils"; import { assert, expect } from "chai"; import * as sinon from "sinon"; @@ -344,8 +345,10 @@ describe("Tile", function() { expect(tile.isVisible).not.throw; expect(tile.isVisible).is.true; stubDataSource.detach(mapView as MapView); - expect(tile.isVisible).not.throw; - expect(tile.isVisible).is.false; + errorOnlyLoggingAroundFunction("Tile", () => { + expect(tile.isVisible).not.throw; + expect(tile.isVisible).is.false; + }); }); it("cancels geometry loader if tile is made invisible", function() { diff --git a/@here/harp-test-utils/lib/TestUtils.ts b/@here/harp-test-utils/lib/TestUtils.ts index 9d28b9e37b..1845293348 100644 --- a/@here/harp-test-utils/lib/TestUtils.ts +++ b/@here/harp-test-utils/lib/TestUtils.ts @@ -4,6 +4,7 @@ * SPDX-License-Identifier: Apache-2.0 */ +import { LoggerManager, LogLevel } from "@here/harp-utils"; import { assert } from "chai"; import * as sinon from "sinon"; @@ -316,3 +317,33 @@ if (typeof beforeEach !== "undefined") { mochaCurrentTest = this.currentTest; }); } + +/** + * Sets the specified loggers to only report errors. Only use this function when you know that you + * can safely ignore a warning, otherwise you should consider to fix the issue. + * All previous logging levels are reset after the function is executed. + * @param loggerName The loggerName, or array of names to set to error + * @param func The function to execute with the changed logging + */ +export async function errorOnlyLoggingAroundFunction( + loggerName: string | string[], + func: () => void +) { + const previousLogLevels: Array<{ level: LogLevel; loggerName: string }> = []; + const loggers = !Array.isArray(loggerName) ? [loggerName] : loggerName; + for (const loggerName of loggers) { + const logger = LoggerManager.instance.getLogger(loggerName); + if (logger) { + previousLogLevels.push({ loggerName, level: logger.level }); + LoggerManager.instance.setLogLevel(loggerName, LogLevel.Error); + } + } + + try { + await func(); + } finally { + for (const logger of previousLogLevels) { + LoggerManager.instance.setLogLevel(logger.loggerName, logger.level); + } + } +} diff --git a/@here/harp-utils/lib/TaskQueue.ts b/@here/harp-utils/lib/TaskQueue.ts index 08932b5b32..2d088fe9b1 100644 --- a/@here/harp-utils/lib/TaskQueue.ts +++ b/@here/harp-utils/lib/TaskQueue.ts @@ -197,6 +197,10 @@ export class TaskQueue { return true; } + clear() { + this.m_taskLists.clear(); + } + private pull(group: string, checkIfExpired: boolean = false): Task | undefined { const taskList = this.getTaskList(group); let nextTask; diff --git a/@here/harp-vectortile-datasource/test/MapViewPickingTest.ts b/@here/harp-vectortile-datasource/test/MapViewPickingTest.ts index 34f6689689..5bc3f0255e 100644 --- a/@here/harp-vectortile-datasource/test/MapViewPickingTest.ts +++ b/@here/harp-vectortile-datasource/test/MapViewPickingTest.ts @@ -29,7 +29,11 @@ import { TileLoaderState } from "@here/harp-mapview"; import { GeoJsonTiler } from "@here/harp-mapview-decoder/lib/GeoJsonTiler"; -import { getTestResourceUrl, waitForEvent } from "@here/harp-test-utils/"; +import { + errorOnlyLoggingAroundFunction, + getTestResourceUrl, + waitForEvent +} from "@here/harp-test-utils/"; import * as TestUtils from "@here/harp-test-utils/lib/WebGLStub"; import { FontCatalog } from "@here/harp-text-canvas"; import { getAppBaseUrl } from "@here/harp-utils"; @@ -83,7 +87,11 @@ describe("MapView Picking", async function() { }; g.navigator = {}; g.requestAnimationFrame = (cb: (delta: number) => void) => { - return setTimeout(() => cb(15), 15); + return setTimeout(() => { + errorOnlyLoggingAroundFunction("TextElementsRenderer", () => { + cb(15); + }); + }, 15); }; g.cancelAnimationFrame = (id: any) => { return clearTimeout(id); diff --git a/@here/harp-vectortile-datasource/test/OmvDataSourceTest.ts b/@here/harp-vectortile-datasource/test/OmvDataSourceTest.ts index 610376ba51..6d23f472b8 100644 --- a/@here/harp-vectortile-datasource/test/OmvDataSourceTest.ts +++ b/@here/harp-vectortile-datasource/test/OmvDataSourceTest.ts @@ -12,6 +12,7 @@ import { FeatureCollection } from "@here/harp-datasource-protocol"; import { TileKey } from "@here/harp-geoutils"; import { DataProvider } from "@here/harp-mapview-decoder"; import { GeoJsonTiler } from "@here/harp-mapview-decoder/index-worker"; +import { errorOnlyLoggingAroundFunction } from "@here/harp-test-utils"; import { assert } from "chai"; import * as sinon from "sinon"; @@ -96,20 +97,21 @@ describe("DataProviders", function() { it("supports deprecated minZoomLevel and maxZoomLevel in constructor", function() { const mockDataProvider = new MockDataProvider(); - const omvDataSource = new VectorTileDataSource({ - decoder: new VectorTileDecoder(), - baseUrl: "https://a.tiles.mapbox.com/v4/mapbox.mapbox-streets-v7", - apiFormat: APIFormat.MapboxV4, - authenticationCode: "123", - dataProvider: mockDataProvider, - minZoomLevel: 3, - maxZoomLevel: 17 + errorOnlyLoggingAroundFunction("DataSource", () => { + const omvDataSource = new VectorTileDataSource({ + decoder: new VectorTileDecoder(), + baseUrl: "https://a.tiles.mapbox.com/v4/mapbox.mapbox-streets-v7", + apiFormat: APIFormat.MapboxV4, + authenticationCode: "123", + dataProvider: mockDataProvider, + minZoomLevel: 3, + maxZoomLevel: 17 + }); + assert.equal(omvDataSource.minZoomLevel, 3); + assert.equal(omvDataSource.minDataLevel, 3); + assert.equal(omvDataSource.maxZoomLevel, 17); + assert.equal(omvDataSource.maxDataLevel, 17); }); - - assert.equal(omvDataSource.minZoomLevel, 3); - assert.equal(omvDataSource.minDataLevel, 3); - assert.equal(omvDataSource.maxZoomLevel, 17); - assert.equal(omvDataSource.maxDataLevel, 17); }); it("supports minDataLevel and maxDataLevel in constructor", function() { @@ -124,10 +126,12 @@ describe("DataProviders", function() { maxDataLevel: 17 }); - assert.equal(omvDataSource.minZoomLevel, 3); - assert.equal(omvDataSource.minDataLevel, 3); - assert.equal(omvDataSource.maxZoomLevel, 17); - assert.equal(omvDataSource.maxDataLevel, 17); + errorOnlyLoggingAroundFunction("DataSource", () => { + assert.equal(omvDataSource.minZoomLevel, 3); + assert.equal(omvDataSource.minDataLevel, 3); + assert.equal(omvDataSource.maxZoomLevel, 17); + assert.equal(omvDataSource.maxDataLevel, 17); + }); }); describe("storageLevelOffset", function() { diff --git a/@here/harp-vectortile-datasource/test/VectorTileDecoderTest.ts b/@here/harp-vectortile-datasource/test/VectorTileDecoderTest.ts index 1e49200ca0..403a40d66d 100644 --- a/@here/harp-vectortile-datasource/test/VectorTileDecoderTest.ts +++ b/@here/harp-vectortile-datasource/test/VectorTileDecoderTest.ts @@ -4,6 +4,7 @@ * SPDX-License-Identifier: Apache-2.0 */ import { mercatorProjection, TileKey } from "@here/harp-geoutils"; +import { errorOnlyLoggingAroundFunction } from "@here/harp-test-utils"; import { expect } from "chai"; import { VectorTileDecoder } from "../index-worker"; @@ -14,8 +15,14 @@ describe("ThemedTileDecoder", function() { it("#decodeTile does not throw", async function() { const target = new VectorTileDecoder(); - expect( - await target.decodeTile(new ArrayBuffer(0), new TileKey(0, 0, 0), mercatorProjection) - ).to.not.throw; + errorOnlyLoggingAroundFunction("ThemedTileDecoder", async () => { + expect( + await target.decodeTile( + new ArrayBuffer(0), + new TileKey(0, 0, 0), + mercatorProjection + ) + ).to.not.throw; + }); }); });