Fix tests

This commit is contained in:
pietervdvn 2021-12-21 21:15:07 +01:00
parent 7fe79600fb
commit 9b1bf96790
2 changed files with 16 additions and 4 deletions

View file

@ -6,7 +6,7 @@ import SelectedFeatureHandler from "../Logic/Actors/SelectedFeatureHandler";
import {UIEventSource} from "../Logic/UIEventSource";
import {ElementStorage} from "../Logic/ElementStorage";
import Loc from "../Models/Loc";
import * as bookcaseJson from "../assets/themes/bookcases/bookcases.json"
import * as bookcaseJson from "../assets/generated/themes/bookcases.json"
import LayoutConfig from "../Models/ThemeConfig/LayoutConfig";
export default class ActorsSpec extends T {

View file

@ -1,8 +1,13 @@
import T from "./TestHelper";
import {Utils} from "../Utils";
import * as assert from "assert";
import {LayoutConfigJson} from "../Models/ThemeConfig/Json/LayoutConfigJson";
import LayoutConfig from "../Models/ThemeConfig/LayoutConfig";
import * as bookcaseLayer from "../assets/generated/layers/public_bookcase.json"
import {PrepareLayer, PrepareTheme} from "../Models/ThemeConfig/LegacyJsonConvert";
import {TagRenderingConfigJson} from "../Models/ThemeConfig/Json/TagRenderingConfigJson";
import {LayerConfigJson} from "../Models/ThemeConfig/Json/LayerConfigJson";
import LayerConfig from "../Models/ThemeConfig/LayerConfig";
import Constants from "../Models/Constants";
export default class ThemeSpec extends T {
constructor() {
@ -10,7 +15,7 @@ export default class ThemeSpec extends T {
[
["Nested overrides work", () => {
const themeConfigJson: LayoutConfigJson = {
let themeConfigJson: LayoutConfigJson = {
description: "Descr",
icon: "",
language: ["en"],
@ -34,7 +39,14 @@ export default class ThemeSpec extends T {
version: "",
id: "test"
}
// TOtal cheat: disable the default layers:
Constants.added_by_default.splice(0, Constants.added_by_default.length)
const sharedLayers = new Map<string, LayerConfigJson>()
sharedLayers.set("public_bookcase", bookcaseLayer["default"])
themeConfigJson = new PrepareTheme().convertStrict({
tagRenderings: new Map<string, TagRenderingConfigJson>(),
sharedLayers: sharedLayers
}, themeConfigJson, "test")
const themeConfig = new LayoutConfig(themeConfigJson);
assert.equal("xyz", themeConfig.layers[0].source.geojsonSource)