Fix tests

This commit is contained in:
Pieter Vander Vennet 2022-02-18 00:12:32 +01:00
parent f55e5cf26c
commit fb4a3ea99a
2 changed files with 4 additions and 4 deletions

View file

@ -226,7 +226,7 @@ export class DetectShadowedMappings extends DesugaringStep<TagRenderingConfigJso
} }
const parsedConditions = json.mappings.map(m => TagUtils.Tag(m.if)) const parsedConditions = json.mappings.map(m => TagUtils.Tag(m.if))
for (let i = 0; i < json.mappings.length; i++) { for (let i = 0; i < json.mappings.length; i++) {
if (!parsedConditions[i].isUsableAsAnswer()) { if(json.mappings[i].hideInAnswer === true){
continue continue
} }
const keyValues = parsedConditions[i].asChange({}); const keyValues = parsedConditions[i].asChange({});
@ -241,7 +241,7 @@ export class DetectShadowedMappings extends DesugaringStep<TagRenderingConfigJso
const doesMatch = parsedConditions[j].matchesProperties(properties) const doesMatch = parsedConditions[j].matchesProperties(properties)
if (doesMatch) { if (doesMatch) {
// The current mapping is shadowed! // The current mapping is shadowed!
warnings.push(`At ${context}: Mapping ${i} is shadowed by mapping ${j} and will thus never be shown: errors.push(`At ${context}: Mapping ${i} is shadowed by mapping ${j} and will thus never be shown:
The mapping ${parsedConditions[i].asHumanString(false, false, {})} is fully matched by a previous mapping, which matches: The mapping ${parsedConditions[i].asHumanString(false, false, {})} is fully matched by a previous mapping, which matches:
${parsedConditions[j].asHumanString(false, false, {})}. ${parsedConditions[j].asHumanString(false, false, {})}.

View file

@ -423,7 +423,7 @@ export default class LegacyThemeLoaderSpec extends T {
} }
] ]
}, "test"); }, "test");
T.isTrue(r.errors.length > 0, "Failing case is not detected") T.isTrue(r.errors.length > 0, "Failing case 0 is not detected")
const r0 = new DetectShadowedMappings().convert( { const r0 = new DetectShadowedMappings().convert( {
mappings: [ mappings: [
@ -437,7 +437,7 @@ export default class LegacyThemeLoaderSpec extends T {
} }
] ]
}, "test"); }, "test");
T.isTrue(r0.errors.length > 0, "Failing case is not detected") T.isTrue(r0.errors.length > 0, "Failing case 1 is not detected")
} }
], ],
["Images are rewritten", () => { ["Images are rewritten", () => {