From 3a4a2a2016bc76dbc76a934df9630f88bafbe7dd Mon Sep 17 00:00:00 2001 From: pietervdvn Date: Wed, 26 Jan 2022 21:28:22 +0100 Subject: [PATCH] Improve tests --- test/CreateNoteImportLayer.spec.ts | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/test/CreateNoteImportLayer.spec.ts b/test/CreateNoteImportLayer.spec.ts index 2e64984f4..802ce8c02 100644 --- a/test/CreateNoteImportLayer.spec.ts +++ b/test/CreateNoteImportLayer.spec.ts @@ -6,6 +6,8 @@ import {LayerConfigJson} from "../Models/ThemeConfig/Json/LayerConfigJson"; import {TagRenderingConfigJson} from "../Models/ThemeConfig/Json/TagRenderingConfigJson"; import LayerConfig from "../Models/ThemeConfig/LayerConfig"; import {PrepareLayer} from "../Models/ThemeConfig/Conversion/PrepareLayer"; +import TagRenderingConfigJsonJSC from "../Docs/Schemas/TagRenderingConfigJsonJSC"; +import {Utils} from "../Utils"; export default class CreateNoteImportLayerSpec extends T { @@ -20,9 +22,12 @@ export default class CreateNoteImportLayerSpec extends T { const layerPrepare = new PrepareLayer() const layer =layerPrepare.convertStrict(desugaringState, bookcases, "ImportLayerGeneratorTest:Parse bookcases") const generator = new CreateNoteImportLayer() - const generatedLayer = generator.convertStrict(desugaringState, layer, "ImportLayerGeneratorTest: convert") - // fs.writeFileSync("bookcases-import-layer.generated.json", JSON.stringify(generatedLayer, null, " "), "utf8") -console.log(JSON.stringify(generatedLayer, null, " ")) + const generatedLayer : LayerConfigJson = generator.convertStrict(desugaringState, layer, "ImportLayerGeneratorTest: convert") + T.equals("_tags~(^|.*;)amenity=public_bookcase($|;.*)", generatedLayer.isShown.mappings[1].if["and"][1].or[0].and[0]) + let renderings = Utils.NoNull(Utils.NoNull(generatedLayer.tagRenderings + .map(tr => ( tr).render)) + .map(render => render["en"])) + T.equals(true, renderings.some(r => r.indexOf("import_button") > 0)) }] ]); }