Fix tests

This commit is contained in:
Pieter Vander Vennet 2025-04-03 00:36:39 +02:00
parent 7c57047d30
commit 33405b7995

View file

@ -10,9 +10,12 @@ import { Tag } from "../../../../src/Logic/Tags/Tag"
import { DesugaringContext } from "../../../../src/Models/ThemeConfig/Conversion/Conversion"
import { And } from "../../../../src/Logic/Tags/And"
import { describe, expect, it } from "vitest"
import { QuestionableTagRenderingConfigJson } from "../../../../src/Models/ThemeConfig/Json/QuestionableTagRenderingConfigJson"
import {
QuestionableTagRenderingConfigJson
} from "../../../../src/Models/ThemeConfig/Json/QuestionableTagRenderingConfigJson"
import Constants from "../../../../src/Models/Constants"
import { ConversionContext } from "../../../../src/Models/ThemeConfig/Conversion/ConversionContext"
import { MinimalTagRenderingConfigJson } from "../../../../src/Models/ThemeConfig/Json/TagRenderingConfigJson"
const themeConfigJson: ThemeConfigJson = {
description: "Descr",
@ -46,6 +49,14 @@ function constructSharedLayers(): Map<string, LayerConfigJson> {
title: null,
source: "special",
})
sharedLayers.set("walls_and_buildings", <LayerConfigJson>{
id: "walls_and_buildings",
pointRendering: null,
tagRenderings: null,
lineRendering: null,
title: null,
source: "special"
})
for (const defaultLayer of Constants.added_by_default) {
sharedLayers.set(defaultLayer, <LayerConfigJson>{
id: defaultLayer,
@ -70,7 +81,7 @@ describe("PrepareTheme", () => {
publicLayers: new Set<string>(),
tagRenderingOrder: [],
})
let themeConfigJsonPrepared = prepareStep.convertStrict(theme, ConversionContext.test())
const themeConfigJsonPrepared = prepareStep.convertStrict(theme, ConversionContext.test())
const themeConfig = new ThemeConfig(themeConfigJsonPrepared)
const layerUnderTest = <LayerConfig>(
themeConfig.layers.find((l) => l.id === "public_bookcase")
@ -83,7 +94,7 @@ describe("PrepareTheme", () => {
it("should apply override", () => {
const sharedLayers = constructSharedLayers()
sharedLayers.set("public_bookcase", <any>bookcaseLayer)
let themeConfigJsonPrepared = new PrepareTheme({
const themeConfigJsonPrepared = new PrepareTheme({
tagRenderings: new Map<string, QuestionableTagRenderingConfigJson>(),
sharedLayers,
publicLayers: new Set<string>(),
@ -99,7 +110,7 @@ describe("PrepareTheme", () => {
it("should apply override", () => {
const sharedLayers = constructSharedLayers()
sharedLayers.set("public_bookcase", <any>bookcaseLayer)
let themeConfigJsonPrepared = new PrepareTheme({
const themeConfigJsonPrepared = new PrepareTheme({
tagRenderings: new Map<string, QuestionableTagRenderingConfigJson>(),
sharedLayers,
publicLayers: new Set<string>(),
@ -135,7 +146,7 @@ describe("PrepareTheme", () => {
iconBadges: [
{
if: "_favourite=yes",
then: <any>{
then: <MinimalTagRenderingConfigJson & { id: string }>{
id: "circlewhiteheartred",
render: "circle:white;heart:red",
},