This repository has been archived by the owner on Mar 8, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 197
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
MINOR: Adds support for DataSourceOptions in WebTileDataSource (#1819)
Signed-off-by: Frauke Fritz <frauke.fritz@here.com>
- Loading branch information
Showing
4 changed files
with
351 additions
and
72 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
73 changes: 73 additions & 0 deletions
73
@here/harp-webtile-datasource/test/HereWebTileDataSourceTest.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,73 @@ | ||
/* | ||
* Copyright (C) 2017-2020 HERE Europe B.V. | ||
* Licensed under Apache 2.0, see full license in LICENSE | ||
* SPDX-License-Identifier: Apache-2.0 | ||
*/ | ||
|
||
// Mocha discourages using arrow functions, see https://mochajs.org/#arrow-functions | ||
|
||
import { assert } from "chai"; | ||
|
||
import { HereTileProvider, HereWebTileDataSource, WebTileDataSource } from "../index"; | ||
|
||
describe("HereWebTileDataSource", function() { | ||
it("#createWebTileDataSource has default values", async function() { | ||
const apikey = "123"; | ||
const webTileDataSource = new HereWebTileDataSource({ | ||
apikey | ||
}); | ||
assert(webTileDataSource.maxDataLevel === 19); | ||
}); | ||
it("#createWebTileDataSource with token authentication", async function() { | ||
const webTileDataSource = new HereWebTileDataSource({ | ||
authenticationCode: "foo123" | ||
}); | ||
assert(webTileDataSource.maxDataLevel === 19); | ||
}); | ||
it("#createWebTileDataSource with 256px and ppi320", async function() { | ||
const apikey = "123"; | ||
const webTileDataSource = new HereWebTileDataSource({ | ||
apikey, | ||
resolution: WebTileDataSource.resolutionValue.resolution256, | ||
ppi: WebTileDataSource.ppiValue.ppi320 | ||
}); | ||
assert(webTileDataSource.maxDataLevel === 20); | ||
}); | ||
it("#createWebTileDataSource with satellite.day", async function() { | ||
const apikey = "123"; | ||
const webTileDataSource = new HereWebTileDataSource({ | ||
apikey, | ||
tileBaseAddress: HereTileProvider.TILE_AERIAL_SATELLITE | ||
}); | ||
assert(webTileDataSource.maxDataLevel === 19); | ||
}); | ||
it("#createWebTileDataSource with satellite.day and 256px", async function() { | ||
const apikey = "123"; | ||
const webTileDataSource = new HereWebTileDataSource({ | ||
apikey, | ||
tileBaseAddress: HereTileProvider.TILE_AERIAL_SATELLITE, | ||
resolution: WebTileDataSource.resolutionValue.resolution256 | ||
}); | ||
assert(webTileDataSource.maxDataLevel === 20); | ||
}); | ||
it("#createWebTileDataSource throws with satellite.day and ppi320", async function() { | ||
const apikey = "123"; | ||
assert.throw( | ||
() => | ||
new HereWebTileDataSource({ | ||
apikey, | ||
tileBaseAddress: HereTileProvider.TILE_AERIAL_SATELLITE, | ||
ppi: WebTileDataSource.ppiValue.ppi320 | ||
}) | ||
); | ||
}); | ||
it("#createWebTileDataSource throws w/o auth.", async function() { | ||
assert.throw(() => new HereWebTileDataSource({} as any)); | ||
}); | ||
it("#createWebTileDataSource throws w/ missing appCode", async function() { | ||
assert.throw(() => new HereWebTileDataSource({ appId: "42" } as any)); | ||
}); | ||
it("#createWebTileDataSource throws w/ missing appId", async function() { | ||
assert.throw(() => new HereWebTileDataSource({ appCode: "42" } as any)); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.