Fix tests
This commit is contained in:
parent
4085bbc1ac
commit
e6dab1a83f
4 changed files with 9 additions and 2 deletions
|
@ -23,7 +23,7 @@ export class AvailableRasterLayers {
|
|||
const eli = await Utils.downloadJson<{ features: EditorLayerIndex }>(
|
||||
"./assets/data/editor-layer-index.json"
|
||||
)
|
||||
this._editorLayerIndex = eli.features.filter((l) => l.properties.id !== "Bing")
|
||||
this._editorLayerIndex = eli.features?.filter((l) => l.properties.id !== "Bing") ?? []
|
||||
this._editorLayerIndexStore.set(this._editorLayerIndex)
|
||||
return this._editorLayerIndex
|
||||
}
|
||||
|
|
|
@ -962,6 +962,10 @@ export default class ThemeViewState implements SpecialVisualizationState {
|
|||
}
|
||||
|
||||
public async reportError(message: string | Error | XMLHttpRequest, extramessage:string = "") {
|
||||
if(Utils.runningFromConsole){
|
||||
console.error("Got (in themeViewSTate.reportError):", message, extramessage)
|
||||
return
|
||||
}
|
||||
const isTesting = this.featureSwitchIsTesting.data
|
||||
console.log(
|
||||
isTesting
|
||||
|
|
|
@ -43,6 +43,8 @@ Utils.injectJsonDownloadForTests("https://www.openstreetmap.org/api/0.6/node/556
|
|||
],
|
||||
})
|
||||
|
||||
Utils.injectJsonDownloadForTests("./assets/data/editor-layer-index.json", '{"features": [] }')
|
||||
|
||||
it("should download the latest version", async () => {
|
||||
const state = new ThemeViewState(new LayoutConfig(<any>bookcaseJson, true), new Set<string>())
|
||||
const feature: Feature<Geometry, OsmTags> = {
|
||||
|
@ -83,6 +85,6 @@ it("should download the latest version", async () => {
|
|||
|
||||
// The name should be updated
|
||||
expect(feature.properties.name).toEqual("Stubbekwartier-buurtbibliotheek")
|
||||
// The fixme should be removed
|
||||
// The fix_me should be removed
|
||||
expect(feature.properties.fixme).toBeUndefined()
|
||||
})
|
||||
|
|
|
@ -11,6 +11,7 @@ beforeEach(async () => {
|
|||
|
||||
// Block internet access
|
||||
Utils.externalDownloadFunction = async (url) => {
|
||||
console.trace("Fetching external data during tests:", url)
|
||||
throw "Fetching " + url + " blocked in tests, use Utils.injectJsonDownloadForTests instead"
|
||||
}
|
||||
})
|
||||
|
|
Loading…
Reference in a new issue