Fix some tests

This commit is contained in:
pietervdvn 2022-06-20 01:55:29 +02:00
parent bae64ab2f3
commit ca91241c3b
3 changed files with 67 additions and 17 deletions

View file

@ -380,7 +380,7 @@ export class DetectMappingsWithImages extends DesugaringStep<TagRenderingConfigJ
}
/**
* const r = new DetectMappingsWithImages().convert({
* const r = new DetectMappingsWithImages(new Set<string>()).convert({
* "mappings": [
* {
* "if": "bicycle_parking=stands",
@ -457,7 +457,7 @@ export class ValidateLayer extends DesugaringStep<LayerConfigJson> {
*/
private readonly _path?: string;
private readonly _isBuiltin: boolean;
private knownImagePaths: Set<string>;
private knownImagePaths: Set<string> | undefined;
constructor(path: string, isBuiltin: boolean, knownImagePaths: Set<string>) {
super("Doesn't change anything, but emits warnings and errors", [], "ValidateLayer");

View file

@ -1,13 +1,24 @@
{
"id": "mapcomplete-changes",
"title": {
"en": "Changes made with MapComplete"
"en": "Changes made with MapComplete",
"de": "Änderungen mit MapComplete",
"es": "Cambios hechos con MapComplete",
"nb_NO": "Endringer utført med MapComplete",
"nl": "Wijzigingen gemaakt met MapComplete"
},
"shortDescription": {
"en": "Shows changes made by MapComplete"
"en": "Shows changes made by MapComplete",
"de": "Zeigt Änderungen von MapComplete",
"es": "Muestra los cambios hechos por MapComplete",
"nb_NO": "Vis endringer utført med MapComplete",
"nl": "Toont wijzigingen gemaakt met MapComplete"
},
"description": {
"en": "This maps shows all the changes made with MapComplete"
"en": "This maps shows all the changes made with MapComplete",
"de": "Diese Karte zeigt alle Änderungen die mit MapComplete gemacht wurden",
"es": "Este mapa muestra todos los cambios hechos con MapComplete",
"nl": "Deze kaart toont alle wijzigingen die met MapComplete werden gemaakt"
},
"maintainer": "",
"icon": "./assets/svg/logo.svg",
@ -22,7 +33,10 @@
{
"id": "mapcomplete-changes",
"name": {
"en": "Changeset centers"
"en": "Changeset centers",
"de": "Schwerpunkte von Änderungssätzen",
"es": "Centros de conjuntos de cambios",
"nb_NO": "Endringssettsenter"
},
"minzoom": 0,
"source": {
@ -36,35 +50,55 @@
],
"title": {
"render": {
"en": "Changeset for {theme}"
"en": "Changeset for {theme}",
"de": "Änderungen für {theme}",
"es": "Conjunto de cambios para {theme}",
"nb_NO": "Endringssett for {theme}",
"nl": "Wijzigingset voor {theme}"
}
},
"description": {
"en": "Shows all MapComplete changes"
"en": "Shows all MapComplete changes",
"de": "Zeigt alle MapComplete Änderungen",
"es": "Muestra todos los cambios de MapComplete",
"nl": "Toont alle wijzigingen met MapComplete"
},
"tagRenderings": [
{
"id": "render_id",
"render": {
"en": "Changeset <a href='https://openstreetmap.org/changeset/{id}' target='_blank'>{id}</a>"
"en": "Changeset <a href='https://openstreetmap.org/changeset/{id}' target='_blank'>{id}</a>",
"de": "Änderung <a href='https://openstreetmap.org/changeset/{id}' target='_blank'>{id}</a>",
"es": "Conjunto de cambios <a href='https://openstreetmap.org/changeset/{id}' target='_blank'>{id}</a>",
"nb_NO": "Endringssett <a href='https://openstreetmap.org/changeset/{id}' target='_blank'>{id}</a>",
"nl": "Wijzigingset <a href='https://openstreetmap.org/changeset/{id}' target='_blank'>{id}</a>"
}
},
{
"id": "contributor",
"render": {
"en": "Change made by <a href='https://openstreetmap.org/user/{_last_edit:contributor}' target='_blank'>{_last_edit:contributor}</a>"
"en": "Change made by <a href='https://openstreetmap.org/user/{_last_edit:contributor}' target='_blank'>{_last_edit:contributor}</a>",
"de": "Änderung wurde von <a href='https://openstreetmap.org/user/{_last_edit:contributor}' target='_blank'>{_last_edit:contributor}</a> gemacht",
"es": "Cambio hecho por <a href='https://openstreetmap.org/user/{_last_edit:contributor}' target='_blank'>{_last_edit:contributor}</a>",
"nl": "Wijziging gemaakt door <a href='https://openstreetmap.org/user/{_last_edit:contributor}' target='_blank'>{_last_edit:contributor}</a>"
}
},
{
"id": "theme",
"render": {
"en": "Change with theme <a href='https://mapcomplete.osm.be/{theme}'>{theme}</a>"
"en": "Change with theme <a href='https://mapcomplete.osm.be/{theme}'>{theme}</a>",
"de": "Änderung mit Thema <a href='https://mapcomplete.osm.be/{theme}'>{theme}</a>",
"es": "Cambio con tema <a href='https://mapcomplete.osm.be/{theme}'>{theme}</a>",
"nl": "Wijziging met thema <a href='https://mapcomplete.osm.be/{theme}'>{theme}</a>"
},
"mappings": [
{
"if": "theme~http.*",
"then": {
"en": "Change with <b>unofficial</b> theme <a href='https://mapcomplete.osm.be/theme.html?userlayout={theme}'>{theme}</a>"
"en": "Change with <b>unofficial</b> theme <a href='https://mapcomplete.osm.be/theme.html?userlayout={theme}'>{theme}</a>",
"de": "Änderung mit <b>inoffiziellem</b> Thema <a href='https://mapcomplete.osm.be/theme.html?userlayout={theme}'>{theme}</a>",
"es": "Cambio con tema <b>no oficial</b> <a href='https://mapcomplete.osm.be/theme.html?userlayout={theme}'>{theme}</a>",
"nl": "Wijziging met <b>officieus</b> thema <a href='https://mapcomplete.osm.be/theme.html?userlayout={theme}'>{theme}</a>"
}
}
]
@ -332,7 +366,11 @@
}
],
"question": {
"en": "Themename contains {search}"
"en": "Themename contains {search}",
"de": "Themenname enthält {search}",
"es": "Nombre del tema contiene {search}",
"nb_NO": "Temanavn inneholder {search}",
"nl": "Themanaam bevat {search}"
}
}
]
@ -348,7 +386,10 @@
}
],
"question": {
"en": "Made by contributor {search}"
"en": "Made by contributor {search}",
"de": "Erstellt von {search}",
"es": "Hecho por contributor/a {search}",
"nl": "Gemaakt door bijdrager {search}"
}
}
]
@ -364,7 +405,10 @@
}
],
"question": {
"en": "<b>Not</b> made by contributor {search}"
"en": "<b>Not</b> made by contributor {search}",
"de": "<b>Nicht</b> erstellt von {search}",
"es": "<b>No</b> hecho por contributor/a {search}",
"nl": "<b>Niet</b> gemaakt door bijdrager {search}"
}
}
]
@ -379,7 +423,10 @@
{
"id": "link_to_more",
"render": {
"en": "More statistics can be found <a href='https://github.com/pietervdvn/MapComplete/tree/develop/Docs/Tools/graphs' target='_blank'>here</a>"
"en": "More statistics can be found <a href='https://github.com/pietervdvn/MapComplete/tree/develop/Docs/Tools/graphs' target='_blank'>here</a>",
"de": "Weitere Statistiken finden Sie <a href='https://github.com/pietervdvn/MapComplete/tree/develop/Docs/Tools/graphs' target='_blank'>hier</a>",
"es": "Se pueden encontrar más estadísticas <a href='https://github.com/pietervdvn/MapComplete/tree/develop/Docs/Tools/graphs' target='_blank'>aquí</a>",
"nl": "Meer statistieken kunnen <a href='https://github.com/pietervdvn/MapComplete/tree/develop/Docs/Tools/graphs' target='_blank'>hier</a> gevonden worden"
}
},
{

View file

@ -2,6 +2,7 @@ import {describe} from 'mocha'
import {expect} from 'chai'
import Translations from "../../UI/i18n/Translations";
import ValidatedTextField from "../../UI/Input/ValidatedTextField";
import {fail} from "assert";
describe("ValidatedTextFields", () => {
@ -9,6 +10,8 @@ describe("ValidatedTextFields", () => {
const ts = Translations.t.validation;
const missingTranslations = Array.from(ValidatedTextField.allTypes.keys())
.filter(key => ts[key] === undefined || ts[key].description === undefined)
expect(missingTranslations, "These validated text fields don't have a type name defined in en.json. (Did you just add one? Run `npm run generate:translations`)").to.be.empty
if(missingTranslations !== []){
fail("undefined", "a `description` for "+missingTranslations.join(", ") , "These validated text fields don't have a type name defined in en.json. (Did you just add one? Run `npm run generate:translations`)")
}
})
})