From b2fde654d3182cdad985352f885222f974c757e9 Mon Sep 17 00:00:00 2001 From: Max Reichmann Date: Wed, 10 Apr 2024 14:54:41 +0200 Subject: [PATCH] test: Refactor UI5YamlLinter test --- test/lib/linter/UI5YamlLinter.ts | 30 +++++++++++++++++++++++------- 1 file changed, 23 insertions(+), 7 deletions(-) diff --git a/test/lib/linter/UI5YamlLinter.ts b/test/lib/linter/UI5YamlLinter.ts index 27cdcd698..c7e6c82b2 100644 --- a/test/lib/linter/UI5YamlLinter.ts +++ b/test/lib/linter/UI5YamlLinter.ts @@ -15,7 +15,7 @@ framework: name: OpenUI5 version: "1.121.0" libraries: - - name: sap.ca.scfld.md + - name: sap.ca.scfld.md - name: sap.ca.ui - name: sap.fe.common`; @@ -28,10 +28,26 @@ framework: // Test returned messages t.is(messages.length, 3, "Detection of 3 deprecated libraries expected"); - for (const m of messages) { - t.is(m.ruleId, "ui5-linter-no-deprecated-api", - `Rule ID 'ui5-linter-no-deprecated-api' of message '${m.message}' expected`); - t.is(typeof m.column, "number", `'Column' value of message '${m.message}' should be a number`); - t.is(typeof m.line, "number", `'Line' value of message '${m.message}' should be a number`); - } + + // Test each message + t.is(messages[0].ruleId, "ui5-linter-no-deprecated-api", + `RuleId is correct`); + t.is(messages[0].message, `Use of deprecated library 'sap.ca.scfld.md'`, + `Message is correct`); + t.is(messages[0].column, 7, `Column is correct`); + t.is(messages[0].line, 9, `Line is correct`); + + t.is(messages[1].ruleId, "ui5-linter-no-deprecated-api", + `RuleId is correct`); + t.is(messages[1].message, `Use of deprecated library 'sap.ca.ui'`, + `Message is correct`); + t.is(messages[1].column, 7, `Column is correct`); + t.is(messages[1].line, 10, `Line is correct`); + + t.is(messages[2].ruleId, "ui5-linter-no-deprecated-api", + `RuleId is correct`); + t.is(messages[2].message, `Use of deprecated library 'sap.fe.common'`, + `Message is correct`); + t.is(messages[2].column, 7, `Column is correct`); + t.is(messages[2].line, 11, `Line is correct`); });