forked from MapComplete/MapComplete
Improve tests
This commit is contained in:
parent
148e056f96
commit
3a4a2a2016
1 changed files with 8 additions and 3 deletions
|
@ -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 => (<TagRenderingConfigJson> tr).render))
|
||||
.map(render => render["en"]))
|
||||
T.equals(true, renderings.some(r => r.indexOf("import_button") > 0))
|
||||
}]
|
||||
]);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue