forked from MapComplete/MapComplete
Fix tests
This commit is contained in:
parent
7c57047d30
commit
33405b7995
1 changed files with 16 additions and 5 deletions
|
@ -10,9 +10,12 @@ import { Tag } from "../../../../src/Logic/Tags/Tag"
|
||||||
import { DesugaringContext } from "../../../../src/Models/ThemeConfig/Conversion/Conversion"
|
import { DesugaringContext } from "../../../../src/Models/ThemeConfig/Conversion/Conversion"
|
||||||
import { And } from "../../../../src/Logic/Tags/And"
|
import { And } from "../../../../src/Logic/Tags/And"
|
||||||
import { describe, expect, it } from "vitest"
|
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 Constants from "../../../../src/Models/Constants"
|
||||||
import { ConversionContext } from "../../../../src/Models/ThemeConfig/Conversion/ConversionContext"
|
import { ConversionContext } from "../../../../src/Models/ThemeConfig/Conversion/ConversionContext"
|
||||||
|
import { MinimalTagRenderingConfigJson } from "../../../../src/Models/ThemeConfig/Json/TagRenderingConfigJson"
|
||||||
|
|
||||||
const themeConfigJson: ThemeConfigJson = {
|
const themeConfigJson: ThemeConfigJson = {
|
||||||
description: "Descr",
|
description: "Descr",
|
||||||
|
@ -46,6 +49,14 @@ function constructSharedLayers(): Map<string, LayerConfigJson> {
|
||||||
title: null,
|
title: null,
|
||||||
source: "special",
|
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) {
|
for (const defaultLayer of Constants.added_by_default) {
|
||||||
sharedLayers.set(defaultLayer, <LayerConfigJson>{
|
sharedLayers.set(defaultLayer, <LayerConfigJson>{
|
||||||
id: defaultLayer,
|
id: defaultLayer,
|
||||||
|
@ -70,7 +81,7 @@ describe("PrepareTheme", () => {
|
||||||
publicLayers: new Set<string>(),
|
publicLayers: new Set<string>(),
|
||||||
tagRenderingOrder: [],
|
tagRenderingOrder: [],
|
||||||
})
|
})
|
||||||
let themeConfigJsonPrepared = prepareStep.convertStrict(theme, ConversionContext.test())
|
const themeConfigJsonPrepared = prepareStep.convertStrict(theme, ConversionContext.test())
|
||||||
const themeConfig = new ThemeConfig(themeConfigJsonPrepared)
|
const themeConfig = new ThemeConfig(themeConfigJsonPrepared)
|
||||||
const layerUnderTest = <LayerConfig>(
|
const layerUnderTest = <LayerConfig>(
|
||||||
themeConfig.layers.find((l) => l.id === "public_bookcase")
|
themeConfig.layers.find((l) => l.id === "public_bookcase")
|
||||||
|
@ -83,7 +94,7 @@ describe("PrepareTheme", () => {
|
||||||
it("should apply override", () => {
|
it("should apply override", () => {
|
||||||
const sharedLayers = constructSharedLayers()
|
const sharedLayers = constructSharedLayers()
|
||||||
sharedLayers.set("public_bookcase", <any>bookcaseLayer)
|
sharedLayers.set("public_bookcase", <any>bookcaseLayer)
|
||||||
let themeConfigJsonPrepared = new PrepareTheme({
|
const themeConfigJsonPrepared = new PrepareTheme({
|
||||||
tagRenderings: new Map<string, QuestionableTagRenderingConfigJson>(),
|
tagRenderings: new Map<string, QuestionableTagRenderingConfigJson>(),
|
||||||
sharedLayers,
|
sharedLayers,
|
||||||
publicLayers: new Set<string>(),
|
publicLayers: new Set<string>(),
|
||||||
|
@ -99,7 +110,7 @@ describe("PrepareTheme", () => {
|
||||||
it("should apply override", () => {
|
it("should apply override", () => {
|
||||||
const sharedLayers = constructSharedLayers()
|
const sharedLayers = constructSharedLayers()
|
||||||
sharedLayers.set("public_bookcase", <any>bookcaseLayer)
|
sharedLayers.set("public_bookcase", <any>bookcaseLayer)
|
||||||
let themeConfigJsonPrepared = new PrepareTheme({
|
const themeConfigJsonPrepared = new PrepareTheme({
|
||||||
tagRenderings: new Map<string, QuestionableTagRenderingConfigJson>(),
|
tagRenderings: new Map<string, QuestionableTagRenderingConfigJson>(),
|
||||||
sharedLayers,
|
sharedLayers,
|
||||||
publicLayers: new Set<string>(),
|
publicLayers: new Set<string>(),
|
||||||
|
@ -135,7 +146,7 @@ describe("PrepareTheme", () => {
|
||||||
iconBadges: [
|
iconBadges: [
|
||||||
{
|
{
|
||||||
if: "_favourite=yes",
|
if: "_favourite=yes",
|
||||||
then: <any>{
|
then: <MinimalTagRenderingConfigJson & { id: string }>{
|
||||||
id: "circlewhiteheartred",
|
id: "circlewhiteheartred",
|
||||||
render: "circle:white;heart:red",
|
render: "circle:white;heart:red",
|
||||||
},
|
},
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue